diff --git a/src/gui/game/GameController.cpp b/src/gui/game/GameController.cpp index 15610ba46..3b2e6d44e 100644 --- a/src/gui/game/GameController.cpp +++ b/src/gui/game/GameController.cpp @@ -111,10 +111,9 @@ public: { if(cc->localBrowser->GetSave()) { - cc->gameModel->SetStamp(cc->localBrowser->GetSave()->GetGameSave()); if (cc->localBrowser->GetMoveToFront()) Client::Ref().MoveStampToFront(cc->localBrowser->GetSave()->GetName()); - cc->LoadStamp(); + cc->LoadStamp(cc->localBrowser->GetSave()->GetGameSave()); } } }; @@ -487,9 +486,9 @@ void GameController::LoadClipboard() gameModel->GetPlaceSave()->Expand(); } -void GameController::LoadStamp() +void GameController::LoadStamp(GameSave *stamp) { - gameModel->SetPlaceSave(gameModel->GetStamp()); + gameModel->SetPlaceSave(stamp); if(gameModel->GetPlaceSave() && gameModel->GetPlaceSave()->Collapsed()) gameModel->GetPlaceSave()->Expand(); } @@ -526,7 +525,7 @@ std::string GameController::StampRegion(ui::Point point1, ui::Point point2) if(newSave) { newSave->paused = gameModel->GetPaused(); - return gameModel->AddStamp(newSave); + return Client::Ref().AddStamp(newSave); } else { diff --git a/src/gui/game/GameController.h b/src/gui/game/GameController.h index 5baf0b0e2..c62a4836d 100644 --- a/src/gui/game/GameController.h +++ b/src/gui/game/GameController.h @@ -155,7 +155,7 @@ public: void ToggleNewtonianGravity(); void LoadClipboard(); - void LoadStamp(); + void LoadStamp(GameSave *stamp); void RemoveNotification(Notification * notification); diff --git a/src/gui/game/GameModel.cpp b/src/gui/game/GameModel.cpp index 1bd9748a6..87c7e26d8 100644 --- a/src/gui/game/GameModel.cpp +++ b/src/gui/game/GameModel.cpp @@ -27,7 +27,6 @@ GameModel::GameModel(): currentFile(NULL), colourSelector(false), clipboard(NULL), - stamp(NULL), placeSave(NULL), colour(255, 0, 0, 255), toolStrength(1.0f), @@ -96,15 +95,6 @@ GameModel::GameModel(): currentUser = Client::Ref().GetAuthUser(); } - //Set stamp to first stamp in list - vector stamps = Client::Ref().GetStamps(0, 1); - if(stamps.size()>0) - { - SaveFile * stampFile = Client::Ref().GetStamp(stamps[0]); - if(stampFile && stampFile->GetGameSave()) - stamp = stampFile->GetGameSave(); - } - BuildMenus(); //Set default brush palette @@ -192,8 +182,6 @@ GameModel::~GameModel() delete placeSave; if(clipboard) delete clipboard; - if(stamp) - delete stamp; if(currentSave) delete currentSave; if(currentFile) @@ -903,19 +891,6 @@ void GameModel::ClearSimulation() UpdateQuickOptions(); } -void GameModel::SetStamp(GameSave * save) -{ - if(stamp != save) - { - if(stamp) - delete stamp; - if(save) - stamp = new GameSave(*save); - else - stamp = NULL; - } -} - void GameModel::SetPlaceSave(GameSave * save) { if(save != placeSave) @@ -930,14 +905,6 @@ void GameModel::SetPlaceSave(GameSave * save) notifyPlaceSaveChanged(); } -std::string GameModel::AddStamp(GameSave * save) -{ - if(stamp) - delete stamp; - stamp = save; - return Client::Ref().AddStamp(save); -} - void GameModel::SetClipboard(GameSave * save) { if(clipboard) @@ -955,11 +922,6 @@ GameSave * GameModel::GetPlaceSave() return placeSave; } -GameSave * GameModel::GetStamp() -{ - return stamp; -} - void GameModel::Log(string message) { consoleLog.push_front(message); diff --git a/src/gui/game/GameModel.h b/src/gui/game/GameModel.h index 8bdf1d1f9..c4c8de811 100644 --- a/src/gui/game/GameModel.h +++ b/src/gui/game/GameModel.h @@ -38,7 +38,6 @@ private: vector notifications; //int clipboardSize; //unsigned char * clipboardData; - GameSave * stamp; GameSave * clipboard; GameSave * placeSave; deque consoleLog; @@ -185,14 +184,11 @@ public: ui::Point AdjustZoomCoords(ui::Point position); void SetZoomWindowPosition(ui::Point position); ui::Point GetZoomWindowPosition(); - void SetStamp(GameSave * newStamp); - std::string AddStamp(GameSave * save); void SetClipboard(GameSave * save); void SetPlaceSave(GameSave * save); void Log(string message); deque GetLog(); GameSave * GetClipboard(); - GameSave * GetStamp(); GameSave * GetPlaceSave(); std::vector GetNotifications(); diff --git a/src/gui/game/GameView.cpp b/src/gui/game/GameView.cpp index 6e12e7d8a..71cd44902 100644 --- a/src/gui/game/GameView.cpp +++ b/src/gui/game/GameView.cpp @@ -1479,12 +1479,18 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool } break; case 'l': - c->LoadStamp(); - selectPoint2 = mousePosition; - selectPoint1 = selectPoint2; - isMouseDown = false; - drawMode = DrawPoints; - break; + { + std::vector stampList = Client::Ref().GetStamps(0, 1); + if (stampList.size()) + { + c->LoadStamp(Client::Ref().GetStamp(stampList[0])->GetGameSave()); + selectPoint2 = mousePosition; + selectPoint1 = selectPoint2; + isMouseDown = false; + drawMode = DrawPoints; + break; + } + } case 'k': selectPoint2 = ui::Point(-1, -1); selectPoint1 = selectPoint2;