diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-09-01 17:13:13 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-09-01 17:13:13 (GMT) |
| commit | ba55da77a9dd2ed4fd7ce87adb2fc6622d130238 (patch) | |
| tree | 47df5e24377886ad55095694fa39d01529db7fe4 /src | |
| parent | 618e29d5d487a2215628b5cf70ccc72462878201 (diff) | |
| download | powder-ba55da77a9dd2ed4fd7ce87adb2fc6622d130238.zip powder-ba55da77a9dd2ed4fd7ce87adb2fc6622d130238.tar.gz | |
!load command for old console
Diffstat (limited to 'src')
| -rw-r--r-- | src/cat/CommandInterface.cpp | 4 | ||||
| -rw-r--r-- | src/cat/CommandInterface.h | 4 | ||||
| -rw-r--r-- | src/cat/LuaScriptInterface.cpp | 6 | ||||
| -rw-r--r-- | src/cat/LuaScriptInterface.h | 2 | ||||
| -rw-r--r-- | src/cat/TPTScriptInterface.cpp | 4 | ||||
| -rw-r--r-- | src/cat/TPTScriptInterface.h | 2 | ||||
| -rw-r--r-- | src/game/GameController.cpp | 2 |
7 files changed, 14 insertions, 10 deletions
diff --git a/src/cat/CommandInterface.cpp b/src/cat/CommandInterface.cpp index 2564141..7c6dd83 100644 --- a/src/cat/CommandInterface.cpp +++ b/src/cat/CommandInterface.cpp @@ -11,9 +11,11 @@ #include <strings.h> #include "CommandInterface.h" #include "game/GameModel.h" +#include "game/GameController.h" -CommandInterface::CommandInterface(GameModel * m) { +CommandInterface::CommandInterface(GameController * c, GameModel * m) { this->m = m; + this->c = c; } /*void CommandInterface::AttachGameModel(GameModel * m) diff --git a/src/cat/CommandInterface.h b/src/cat/CommandInterface.h index e89632e..e6119d3 100644 --- a/src/cat/CommandInterface.h +++ b/src/cat/CommandInterface.h @@ -13,14 +13,16 @@ //#include "game/GameModel.h" class GameModel; +class GameController; class CommandInterface { protected: std::string lastError; GameModel * m; + GameController * c; public: enum LogType { LogError, LogWarning, LogNotice }; enum FormatType { FormatInt, FormatString, FormatChar, FormatFloat }; - CommandInterface(GameModel * m); + CommandInterface(GameController * c, GameModel * m); int GetPropertyOffset(std::string key_, FormatType & format); int GetParticleType(std::string type); void Log(LogType type, std::string message); diff --git a/src/cat/LuaScriptInterface.cpp b/src/cat/LuaScriptInterface.cpp index 54e2292..18a9886 100644 --- a/src/cat/LuaScriptInterface.cpp +++ b/src/cat/LuaScriptInterface.cpp @@ -37,10 +37,10 @@ #endif #include <time.h> -LuaScriptInterface::LuaScriptInterface(GameModel * m): - CommandInterface(m), +LuaScriptInterface::LuaScriptInterface(GameController * c, GameModel * m): + CommandInterface(c, m), currentCommand(false), - legacy(new TPTScriptInterface(m)) + legacy(new TPTScriptInterface(c, m)) { luacon_model = m; luacon_sim = m->GetSimulation(); diff --git a/src/cat/LuaScriptInterface.h b/src/cat/LuaScriptInterface.h index 37adc65..b6ebcfe 100644 --- a/src/cat/LuaScriptInterface.h +++ b/src/cat/LuaScriptInterface.h @@ -67,7 +67,7 @@ class LuaScriptInterface: public CommandInterface { public: ui::Window * Window; lua_State *l; - LuaScriptInterface(GameModel * m); + LuaScriptInterface(GameController * c, GameModel * m); virtual bool OnBrushChanged(int brushType, int rx, int ry); virtual bool OnMouseMove(int x, int y, int dx, int dy); virtual bool OnMouseDown(int x, int y, unsigned button); diff --git a/src/cat/TPTScriptInterface.cpp b/src/cat/TPTScriptInterface.cpp index dc466db..ce7128f 100644 --- a/src/cat/TPTScriptInterface.cpp +++ b/src/cat/TPTScriptInterface.cpp @@ -15,7 +15,7 @@ #include "game/GameModel.h" #include "simulation/Air.h" -TPTScriptInterface::TPTScriptInterface(GameModel * m): CommandInterface(m) +TPTScriptInterface::TPTScriptInterface(GameController * c, GameModel * m): CommandInterface(c, m) { } @@ -365,7 +365,7 @@ AnyType TPTScriptInterface::tptS_load(std::deque<std::string> * words) //Arguments from stack NumberType saveID = eval(words); - throw GeneralException("Function not implemented"); + c->OpenSavePreview(saveID.Value(), 0); return NumberType(0); } diff --git a/src/cat/TPTScriptInterface.h b/src/cat/TPTScriptInterface.h index d451a6c..ba37fcd 100644 --- a/src/cat/TPTScriptInterface.h +++ b/src/cat/TPTScriptInterface.h @@ -22,7 +22,7 @@ protected: AnyType tptS_bubble(std::deque<std::string> * words); ValueType testType(std::string word); public: - TPTScriptInterface(GameModel * m); + TPTScriptInterface(GameController * c, GameModel * m); virtual void Tick() {} virtual int Command(std::string command); virtual std::string FormatCommand(std::string command); diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp index 910673e..2c98f87 100644 --- a/src/game/GameController.cpp +++ b/src/game/GameController.cpp @@ -150,7 +150,7 @@ GameController::GameController(): gameView->AttachController(this); gameModel->AddObserver(gameView); - commandInterface = new LuaScriptInterface(gameModel);//new TPTScriptInterface(); + commandInterface = new LuaScriptInterface(this, gameModel);//new TPTScriptInterface(); ((LuaScriptInterface*)commandInterface)->SetWindow(gameView); //sim = new Simulation(); |
