]> git.jsancho.org Git - lugaru.git/blobdiff - Source/main.cpp
Moved Account::active in Account class. Maybe it should be changed for a method and...
[lugaru.git] / Source / main.cpp
index e0bf4309188959db1be8b8f52e1946faeaa20e0e..7fb429108fba3fcf71ce3a5790ce750c3b9e0234 100644 (file)
@@ -581,7 +581,7 @@ const option::Descriptor usage[] =
     {SOUND,             OPENAL_OUTPUT_OSS,      "",     "force-oss",        option::Arg::None,  " --force-oss       Force use of OSS back-end." },
     {OPENALINFO,        0,                      "",     "openal-info",      option::Arg::None,  " --openal-info     Print info about OpenAL at launch." },
     {SHOWRESOLUTIONS,   0,                      "",     "showresolutions",  option::Arg::None,  " --showresolutions List the resolutions found by SDL at launch." },
-    {DEBUG,             0,                      "d",     "debug",           option::Arg::None,  " -d, --debug       Activates console, level editor and debug information." },
+    {DEVTOOLS,          0,                      "d",    "devtools",         option::Arg::None,  " -d, --devtools    Enable dev tools: console, level editor and debug info." },
     {0,0,0,0,0,0}
 };
 
@@ -617,8 +617,6 @@ int main(int argc, char **argv)
         return 1;
     }
 
-    debugmode = commandLineOptions[DEBUG];
-
     // !!! FIXME: we could use a Win32 API for this.  --ryan.
 #ifndef WIN32
     chdirToAppPath(argv[0]);
@@ -626,7 +624,9 @@ int main(int argc, char **argv)
 
     LOGFUNC;
 
-    //~ try {
+#ifdef NDEBUG
+    try {
+#endif
         {
             newGame();
 
@@ -635,6 +635,10 @@ int main(int argc, char **argv)
                 return 42;
             }
 
+            if (commandLineOptions[DEVTOOLS]) {
+                devtools = true;
+            }
+
             bool gameDone = false;
             bool gameFocused = true;
 
@@ -677,16 +681,18 @@ int main(int argc, char **argv)
         CleanUp ();
 
         return 0;
-    //~ } catch (const std::exception& error) {
-        //~ CleanUp();
+#ifdef NDEBUG
+    } catch (const std::exception& error) {
+        CleanUp();
 
-        //~ std::string e = "Caught exception: ";
-        //~ e += error.what();
+        std::string e = "Caught exception: ";
+        e += error.what();
 
-        //~ LOG(e);
+        LOG(e);
 
-        //~ SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Exception catched", error.what(), NULL);
+        SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Exception catched", error.what(), NULL);
 
-        //~ return -1;
-    //~ }
+        return -1;
+    }
+#endif
 }