From fa77db06cc90dee5d58c9fe51ea580987449060a Mon Sep 17 00:00:00 2001 From: leo Date: Sat, 11 Mar 2006 00:30:46 +0000 Subject: Better assert message box. git-svn-id: http://svn.leocad.org/trunk@521 c7d43263-9d01-0410-8a33-9dba5d9f93d6 --- win/System.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'win/System.cpp') 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; } -- cgit v1.2.3