summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/game')
-rw-r--r--src/game/GameController.cpp10
-rw-r--r--src/game/GameController.h1
2 files changed, 9 insertions, 2 deletions
diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp
index 2258239..ffa763f 100644
--- a/src/game/GameController.cpp
+++ b/src/game/GameController.cpp
@@ -140,7 +140,8 @@ GameController::GameController():
options(NULL),
activePreview(NULL),
localBrowser(NULL),
- HasDone(false)
+ HasDone(false),
+ firstTick(true)
{
gameView = new GameView();
gameModel = new GameModel();
@@ -149,7 +150,7 @@ GameController::GameController():
gameModel->AddObserver(gameView);
commandInterface = new LuaScriptInterface(gameModel);//new TPTScriptInterface();
- //commandInterface->AttachGameModel(gameModel);
+ ((LuaScriptInterface*)commandInterface)->SetWindow(gameView);
//sim = new Simulation();
Client::Ref().AddListener(this);
@@ -658,6 +659,11 @@ bool GameController::KeyRelease(int key, Uint16 character, bool shift, bool ctrl
void GameController::Tick()
{
+ if(firstTick)
+ {
+ ((LuaScriptInterface*)commandInterface)->Init();
+ firstTick = false;
+ }
commandInterface->OnTick();
}
diff --git a/src/game/GameController.h b/src/game/GameController.h
index ea24bb2..af3f1bf 100644
--- a/src/game/GameController.h
+++ b/src/game/GameController.h
@@ -31,6 +31,7 @@ class GameController: public ClientListener
{
private:
//Simulation * sim;
+ bool firstTick;
int screenshotIndex;
PreviewController * activePreview;
GameView * gameView;