diff options
Diffstat (limited to 'win32/PlatWin.cxx')
-rw-r--r-- | win32/PlatWin.cxx | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 2eb2d12f0..654cf3a27 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -147,10 +147,10 @@ class FontCached : Font { FontCached *next; int usage; LOGFONT lf; - int hash; + int hash; FontCached(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_); ~FontCached() {} - bool SameAs(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_); + bool SameAs(const char *faceName_, int characterSet_, int size_, bool bold_, bool italic_); virtual void Release(); static FontCached *first; @@ -878,6 +878,32 @@ void Platform::DebugPrintf(const char *, ...) { } #endif +static bool assertionPopUps = true; + +void Platform::ShowAssertionPopUps(bool assertionPopUps_) { + assertionPopUps = assertionPopUps_; +} + +void Platform::Assert(const char *c, const char *file, int line) { + char buffer[2000]; + sprintf(buffer, "Assertion [%s] failed at %s %d", c, file, line); + if (assertionPopUps) { + int idButton = ::MessageBox(0, buffer, "Assertion failure", + MB_ABORTRETRYIGNORE|MB_ICONHAND|MB_SETFOREGROUND|MB_TASKMODAL); + if (idButton == IDRETRY) { + ::DebugBreak(); + } else if (idButton == IDIGNORE) { + // all OK + } else { + abort(); + } + } else { + strcat(buffer, "\r\n"); + Platform::DebugDisplay(buffer); + abort(); + } +} + int Platform::Clamp(int val, int minVal, int maxVal) { if (val > maxVal) val = maxVal; |