commit 2b6c7e44
No longer teleports on wrong parameters and exceptions are colored red in the console
Changed files
| M | src/saland/Game.cpp before |
| M | src/saland/console/Console.cpp before |
diff --git a/src/saland/Game.cpp b/src/saland/Game.cpp
index afbdeda..14760b5 100644
--- a/src/saland/Game.cpp
+++ b/src/saland/Game.cpp
@@ -87,9 +87,9 @@ struct GotoConsoleCommand : public ConsoleCommand {
if (args.size() != 3) {
return "Must be ran like \"goto X Y\"";
}
- teleport = true;
teleportX = string2int_trows(args[1]);
teleportY = string2int_trows(args[2]);
+ teleport = true;
return "Teleport queued!";
}
diff --git a/src/saland/console/Console.cpp b/src/saland/console/Console.cpp
index ffb5c26..8f708e0 100644
--- a/src/saland/console/Console.cpp
+++ b/src/saland/console/Console.cpp
@@ -26,6 +26,9 @@ https://github.com/sago007/saland
#include "../globals.hpp"
#include <boost/tokenizer.hpp>
+
+const SDL_Color error_color = { 255, 64, 64, 255 };
+
static void SetFieldValues(sago::SagoTextField& field) {
field.SetHolder(&globalData.spriteHolder->GetDataHolder());
field.SetFont("freeserif");
@@ -142,6 +145,7 @@ void Console::ProcessCommand(const std::string& command) {
response.SetText(ret);
} catch (std::exception& e) {
response.SetText(e.what());
+ response.SetColor(error_color);
}
}
else {