diff options
| author | Bryan Hoyle <starfoxprime@gmail.com> | 2012-06-20 18:41:17 (GMT) |
|---|---|---|
| committer | Bryan Hoyle <starfoxprime@gmail.com> | 2012-06-20 18:41:17 (GMT) |
| commit | 9953f4518ec2d98dbe950e13a94a5e845f725f6c (patch) | |
| tree | 67d9b56b7a4772c817f753bef8cdc81ba7833b7b /src/game | |
| parent | b35255b722a5259f34cfc9b7569f58d11658c3b9 (diff) | |
| parent | ad76b293d8fc257a7efe0cbcf6f7fb9380616030 (diff) | |
| download | powder-9953f4518ec2d98dbe950e13a94a5e845f725f6c.zip powder-9953f4518ec2d98dbe950e13a94a5e845f725f6c.tar.gz | |
Merge branch 'master' of github.com:FacialTurd/PowderToypp
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/GameController.cpp | 31 | ||||
| -rw-r--r-- | src/game/GameController.h | 3 |
2 files changed, 32 insertions, 2 deletions
diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp index 6ed6e0f..71e485d 100644 --- a/src/game/GameController.cpp +++ b/src/game/GameController.cpp @@ -10,6 +10,7 @@ #include "login/LoginController.h" #include "interface/Point.h" #include "dialogues/ErrorMessage.h" +#include "dialogues/ConfirmPrompt.h" #include "GameModelException.h" #include "simulation/Air.h" #include "Notification.h" @@ -121,7 +122,8 @@ GameController::GameController(): ssave(NULL), console(NULL), tagsWindow(NULL), - options(NULL) + options(NULL), + HasDone(false) { gameView = new GameView(); gameModel = new GameModel(); @@ -391,6 +393,13 @@ void GameController::Tick() commandInterface->OnTick(); } +void GameController::Exit() +{ + if(ui::Engine::Ref().GetWindow() == gameView) + ui::Engine::Ref().CloseWindow(); + HasDone = true; +} + void GameController::Update() { ui::Point pos = gameView->GetMousePosition(); @@ -629,6 +638,19 @@ std::string GameController::ElementResolve(int type) void GameController::NotifyUpdateAvailable(Client * sender) { + class UpdateConfirmation: public ConfirmDialogueCallback { + public: + GameController * c; + UpdateConfirmation(GameController * c_) { c = c_; } + virtual void ConfirmCallback(ConfirmPrompt::DialogueResult result) { + if (result == ConfirmPrompt::ResultOkay) + { + c->RunUpdater(); + } + } + virtual ~UpdateConfirmation() { } + }; + class UpdateNotification : public Notification { GameController * c; @@ -638,7 +660,7 @@ void GameController::NotifyUpdateAvailable(Client * sender) virtual void Action() { - c->RemoveNotification(this); + new ConfirmPrompt("Run Updater", "Are you sure you want to run the updater, please save any changes before updating", new UpdateConfirmation(c)); } }; @@ -650,3 +672,8 @@ void GameController::RemoveNotification(Notification * notification) gameModel->RemoveNotification(notification); } +void GameController::RunUpdater() +{ + Exit(); +} + diff --git a/src/game/GameController.h b/src/game/GameController.h index 269cdf5..c424656 100644 --- a/src/game/GameController.h +++ b/src/game/GameController.h @@ -42,6 +42,7 @@ private: OptionsController * options; CommandInterface * commandInterface; public: + bool HasDone; class LoginCallback; class SearchCallback; class RenderCallback; @@ -60,6 +61,7 @@ public: bool KeyPress(int key, Uint16 character, bool shift, bool ctrl, bool alt); bool KeyRelease(int key, Uint16 character, bool shift, bool ctrl, bool alt); void Tick(); + void Exit(); void SetZoomEnabled(bool zoomEnable); void SetZoomPosition(ui::Point position); @@ -107,6 +109,7 @@ public: void RemoveNotification(Notification * notification); virtual void NotifyUpdateAvailable(Client * sender); + void RunUpdater(); }; #endif // GAMECONTROLLER_H |
