00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #define WIN32_LEAN_AND_MEAN
00022 #include <stdlib.h>
00023 #include <stdarg.h>
00024 #include <common/Defines.h>
00025 #include <common/Logger.h>
00026 #include <windows.h>
00027 #include <string>
00028
00029 #pragma warning(disable : 4996)
00030
00031 extern bool wxWindowInit;
00032
00033 void S3D::dialogMessage(const std::string &header, const std::string &text)
00034 {
00035 std::string newtext;
00036 int count = 0;
00037 for (const char *t=text.c_str(); *t; t++)
00038 {
00039 if (*t == '\n') count = 0;
00040 else count++;
00041 if (count > 75)
00042 {
00043 newtext.append("...\n");
00044 count = 0;
00045 }
00046
00047 newtext.push_back(*t);
00048 }
00049
00050
00051 Logger::log(newtext.c_str());
00052 Logger::instance()->processLogEntries();
00053
00054
00055 #if defined(_WIN32) && !defined(S3D_SERVER)
00056 MessageBox(NULL, newtext.c_str(), header.c_str(), MB_OK);
00057 #else
00058 printf("%s : %s\n", header.c_str(), newtext.c_str());
00059 #endif
00060 }
00061
00062 void S3D::glAssert(unsigned int e, const int line, const char *file)
00063 {
00064
00065 char buffer[20048];
00066 snprintf(buffer, 20048, "%u\n%i:%s", e, line, file);
00067
00068
00069 }
00070
00071 void S3D::dialogAssert(const char *lineText, const int line, const char *file)
00072 {
00073
00074 char buffer[20048];
00075 snprintf(buffer, 20048, "%s\n%i:%s", lineText, line, file);
00076 S3D::dialogMessage("Program Assert", buffer);
00077 exit(64);
00078 }
00079
00080 void S3D::dialogExit(const std::string &header, const std::string &text)
00081 {
00082 S3D::dialogMessage(header, text);
00083 exit(64);
00084 }