git repos / saland

commit 2b6c7e44

Poul Sander · 2019-04-18 08:57
2b6c7e4441164a67b074fa5222356eef3ea2609f patch · browse files
parent 166bb79f32407f9f4c413e601890023154bb69ee

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 {