From 4c8e15722822d0e5e872f872838a8d71af84e1d4 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 13 Mar 2021 15:30:20 -0500 Subject: Added debug info to Script object --- src/script_system.cpp | 4 ++++ src/script_system.h | 1 + 2 files changed, 5 insertions(+) diff --git a/src/script_system.cpp b/src/script_system.cpp index b993938..7889148 100644 --- a/src/script_system.cpp +++ b/src/script_system.cpp @@ -286,6 +286,9 @@ void ScriptSystem::runScript(std::string mapName, std::string scriptName) { Script newScript; newScript.runner.reset(new sol::thread(sol::thread::create(engine_.lua_state()))); newScript.callable.reset(new sol::coroutine(newScript.runner->state().traverse_get(mapName, scriptName))); +#ifdef TANETANE_DEBUG + newScript.debugInfo = mapName + "." + scriptName; +#endif if (!*newScript.callable) { throw std::runtime_error("Error running script: " + mapName + "." + scriptName); @@ -313,6 +316,7 @@ void ScriptSystem::runDebugScript(std::string script) { } newScript.callable.reset(new sol::coroutine(loaded_script)); + newScript.debugInfo = script; if (!*newScript.callable) { std::cout << "Error running debug command: " << script << std::endl; diff --git a/src/script_system.h b/src/script_system.h index 7ef2dee..6a28430 100644 --- a/src/script_system.h +++ b/src/script_system.h @@ -32,6 +32,7 @@ private: struct Script { std::unique_ptr runner; std::unique_ptr callable; + std::string debugInfo; }; Game& game_; -- cgit 1.4.1