diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-03 20:48:45 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-03 20:48:45 (GMT) |
| commit | 61739018759847c4d356a7596926652856030306 (patch) | |
| tree | 59dd50893ecb47bfab709d778b8a8a02dfc83331 /src/cat/LuaScriptInterface.cpp | |
| parent | f586a5585f3838e78cf6880b84d4c369040b5f67 (diff) | |
| download | powder-61739018759847c4d356a7596926652856030306.zip powder-61739018759847c4d356a7596926652856030306.tar.gz | |
Old TPT console commands with "!" prefix
Diffstat (limited to 'src/cat/LuaScriptInterface.cpp')
| -rw-r--r-- | src/cat/LuaScriptInterface.cpp | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/src/cat/LuaScriptInterface.cpp b/src/cat/LuaScriptInterface.cpp index edd111f..5aa6a73 100644 --- a/src/cat/LuaScriptInterface.cpp +++ b/src/cat/LuaScriptInterface.cpp @@ -8,13 +8,15 @@ #include <string> #include "Config.h" #include "LuaScriptInterface.h" +#include "TPTScriptInterface.h" #include "simulation/Simulation.h" #include "game/GameModel.h" #include "LuaScriptHelper.h" LuaScriptInterface::LuaScriptInterface(GameModel * m): CommandInterface(m), - currentCommand(false) + currentCommand(false), + legacy(new TPTScriptInterface(m)) { int i = 0, j; char tmpname[12]; @@ -284,16 +286,26 @@ void LuaScriptInterface::OnTick() int LuaScriptInterface::Command(std::string command) { - int ret; - lastError = ""; - currentCommand = true; - if((ret = luaL_dostring(l, command.c_str()))) + if(command[0] == '!') { - lastError = luacon_geterror(); - //Log(LogError, lastError); + lastError = ""; + int ret = legacy->Command(command.substr(1)); + lastError = legacy->GetLastError(); + return ret; + } + else + { + int ret; + lastError = ""; + currentCommand = true; + if((ret = luaL_dostring(l, command.c_str()))) + { + lastError = luacon_geterror(); + //Log(LogError, lastError); + } + currentCommand = false; + return ret; } - currentCommand = false; - return ret; } std::string LuaScriptInterface::FormatCommand(std::string command) @@ -302,7 +314,7 @@ std::string LuaScriptInterface::FormatCommand(std::string command) } LuaScriptInterface::~LuaScriptInterface() { - // TODO Auto-generated destructor stub + delete legacy; } #ifndef FFI |
