Permalink
Browse files

'l' always loads last save from disk (won't load cached deleted save)

  • Loading branch information...
jacob1 committed Dec 15, 2014
1 parent 6410171 commit 35782fdd10934a00595fff69bf9485265f887872
@@ -111,10 +111,9 @@ class GameController::StampsCallback: public ControllerCallback
{
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
{
@@ -155,7 +155,7 @@ class GameController: public ClientListener
void ToggleNewtonianGravity();
void LoadClipboard();
void LoadStamp();
void LoadStamp(GameSave *stamp);
void RemoveNotification(Notification * notification);
@@ -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<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();
}
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);
@@ -38,7 +38,6 @@ class GameModel
vector<Notification*> notifications;
//int clipboardSize;
//unsigned char * clipboardData;
GameSave * stamp;
GameSave * clipboard;
GameSave * placeSave;
deque<string> consoleLog;
@@ -185,14 +184,11 @@ class GameModel
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<string> GetLog();
GameSave * GetClipboard();
GameSave * GetStamp();
GameSave * GetPlaceSave();
std::vector<Notification*> GetNotifications();
@@ -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<std::string> 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;

0 comments on commit 35782fd

Please sign in to comment.