summaryrefslogtreecommitdiff
path: root/win/System.cpp
diff options
context:
space:
mode:
authorleo2006-03-11 00:30:46 +0000
committerleo2006-03-11 00:30:46 +0000
commitfa77db06cc90dee5d58c9fe51ea580987449060a (patch)
tree159d048a13e8c7fa268b3f4c981999ceed008626 /win/System.cpp
parentb21daeffe9728a8bed09b46052cc02ab719fda31 (diff)
Better assert message box.
git-svn-id: http://svn.leocad.org/trunk@521 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'win/System.cpp')
-rw-r--r--win/System.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/win/System.cpp b/win/System.cpp
index cd56d3c..652346a 100644
--- a/win/System.cpp
+++ b/win/System.cpp
@@ -36,16 +36,18 @@
#include "piece.h"
#include "pieceinf.h"
+// Display a message box when an assert happens.
bool lcAssert(const char* FileName, int Line, const char* Expression, const char* Description)
{
char buf[1024];
- sprintf(buf, "Assertion failed on line %d of file %s: %s", Line, FileName, Description);
- AfxMessageBox(buf, MB_OK|MB_ICONSTOP);
+ sprintf(buf, "Assertion failed on line %d of file %s.\n%s\nDo you want to debug this?", Line, FileName, Description);
- // TODO: Add a real assert dialog instead of the message box.
- // TODO: Add an option to disable all asserts.
- // TODO: Add an option to disable only this assert.
- // TODO: Add an option to break into the debugger.
+ int ret = AfxMessageBox(buf, MB_YESNOCANCEL|MB_ICONERROR);
+
+ if (ret == IDYES)
+ DebugBreak();
+ else if (ret == IDCANCEL)
+ return true; // Disable this assert.
return false;
}