From 433207dc81cd5738d41673b1c3384c1c409276ed Mon Sep 17 00:00:00 2001 From: Ted John Date: Fri, 2 Dec 2016 17:16:26 +0000 Subject: [PATCH] Do not assert when testing --- openrct2.common.props | 10 ++++++++++ src/core/Guard.cpp | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/openrct2.common.props b/openrct2.common.props index 72eb374c7c..64d144e987 100644 --- a/openrct2.common.props +++ b/openrct2.common.props @@ -74,6 +74,16 @@ true + + + __TEST__;%(PreprocessorDefinitions) + + + + + NDEBUG;__TEST__;%(PreprocessorDefinitions) + + diff --git a/src/core/Guard.cpp b/src/core/Guard.cpp index 2b6518aa39..479f976104 100644 --- a/src/core/Guard.cpp +++ b/src/core/Guard.cpp @@ -78,7 +78,9 @@ namespace Guard char *bufend = (char *)strchr(buffer, 0); vsnprintf(bufend, sizeof(buffer) - (bufend - buffer), message, args); } - int result = MessageBox(nullptr, buffer, OPENRCT2_NAME, MB_ABORTRETRYIGNORE | MB_ICONEXCLAMATION); + // Only show message box if we are not building for testing +#ifndef __TEST__ + int result = MessageBoxA(nullptr, buffer, OPENRCT2_NAME, MB_ABORTRETRYIGNORE | MB_ICONEXCLAMATION); if (result == IDABORT) { #ifdef USE_BREAKPAD @@ -88,6 +90,7 @@ namespace Guard assert(false); #endif } +#endif #else assert(false); #endif