]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Devtools/ConsoleCmds.cpp
Console: Return gracefully when loading missing level
[lugaru.git] / Source / Devtools / ConsoleCmds.cpp
index b9aabcc4dd812757d221d5272bf7deed4c9259d4..b11e12a7fb528b2b43e9ac62bf56fe3572afa239 100644 (file)
@@ -163,7 +163,14 @@ void ch_quit(const char *)
 
 void ch_map(const char *args)
 {
-    Loadlevel(args);
+    if (!LoadLevel(args)) {
+        // FIXME: Reduce code duplication with GameTick (should come from a Console class)
+        for (int k = 14; k >= 1; k--) {
+            consoletext[k] = consoletext[k - 1];
+        }
+        consoletext[0] = std::string("Could not load the requested level '") + args + "', aborting.";
+        consoleselected = 0;
+    }
     whichlevel = -2;
     campaign = 0;
 }