diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-06-10 18:52:24 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-06-10 18:52:24 (GMT) |
| commit | fd572e9da68385d13a147164cd07d50160f2fc69 (patch) | |
| tree | 2cd99a57db8f11f4d41defe4ca4253553cd0b562 /src/game | |
| parent | cdc4b4df86d61abf8fe08fe120afcb2393755660 (diff) | |
| download | powder-fd572e9da68385d13a147164cd07d50160f2fc69.zip powder-fd572e9da68385d13a147164cd07d50160f2fc69.tar.gz | |
Change stamp storage to a list, insert new stamps at the begining, 'l' loads the first stamp or the previously used stamp, 'k' shows the stamp browser
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/GameController.cpp | 2 | ||||
| -rw-r--r-- | src/game/GameModel.cpp | 14 | ||||
| -rw-r--r-- | src/game/GameView.cpp | 5 |
3 files changed, 18 insertions, 3 deletions
diff --git a/src/game/GameController.cpp b/src/game/GameController.cpp index 7c70797..9cdac6e 100644 --- a/src/game/GameController.cpp +++ b/src/game/GameController.cpp @@ -109,8 +109,6 @@ public: cc->gameModel->SetStamp(cc->localBrowser->GetSave()->GetGameSave()); cc->LoadStamp(); } - else - cc->gameModel->SetStamp(NULL); } }; diff --git a/src/game/GameModel.cpp b/src/game/GameModel.cpp index 36aef35..99a2cc5 100644 --- a/src/game/GameModel.cpp +++ b/src/game/GameModel.cpp @@ -130,6 +130,15 @@ GameModel::GameModel(): { currentUser = Client::Ref().GetAuthUser(); } + + //Set stamp to first stamp in list + vector<string> stamps = Client::Ref().GetStamps(0, 1); + if(stamps.size()>0) + { + SaveFile * stampFile = Client::Ref().GetStamp(stamps[0]); + if(stampFile && stampFile->GetGameSave()) + stamp = stampFile->GetGameSave(); + } } GameModel::~GameModel() @@ -430,7 +439,10 @@ void GameModel::SetStamp(GameSave * save) { if(stamp) delete stamp; - stamp = new GameSave(*save); + if(save) + stamp = new GameSave(*save); + else + stamp = NULL; } void GameModel::SetPlaceSave(GameSave * save) diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp index dbc2294..26a4311 100644 --- a/src/game/GameView.cpp +++ b/src/game/GameView.cpp @@ -741,6 +741,11 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool } break; case 'l': + c->LoadStamp(); + selectPoint2 = ui::Point(-1, -1); + selectPoint1 = selectPoint2; + break; + case 'k': selectPoint2 = ui::Point(-1, -1); selectPoint1 = selectPoint2; c->OpenStamps(); |
