'l' always loads last save from disk (won't load cached deleted save)
This commit is contained in:
parent
6410171bd5
commit
35782fdd10
@ -111,10 +111,9 @@ public:
|
|||||||
{
|
{
|
||||||
if(cc->localBrowser->GetSave())
|
if(cc->localBrowser->GetSave())
|
||||||
{
|
{
|
||||||
cc->gameModel->SetStamp(cc->localBrowser->GetSave()->GetGameSave());
|
|
||||||
if (cc->localBrowser->GetMoveToFront())
|
if (cc->localBrowser->GetMoveToFront())
|
||||||
Client::Ref().MoveStampToFront(cc->localBrowser->GetSave()->GetName());
|
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();
|
gameModel->GetPlaceSave()->Expand();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameController::LoadStamp()
|
void GameController::LoadStamp(GameSave *stamp)
|
||||||
{
|
{
|
||||||
gameModel->SetPlaceSave(gameModel->GetStamp());
|
gameModel->SetPlaceSave(stamp);
|
||||||
if(gameModel->GetPlaceSave() && gameModel->GetPlaceSave()->Collapsed())
|
if(gameModel->GetPlaceSave() && gameModel->GetPlaceSave()->Collapsed())
|
||||||
gameModel->GetPlaceSave()->Expand();
|
gameModel->GetPlaceSave()->Expand();
|
||||||
}
|
}
|
||||||
@ -526,7 +525,7 @@ std::string GameController::StampRegion(ui::Point point1, ui::Point point2)
|
|||||||
if(newSave)
|
if(newSave)
|
||||||
{
|
{
|
||||||
newSave->paused = gameModel->GetPaused();
|
newSave->paused = gameModel->GetPaused();
|
||||||
return gameModel->AddStamp(newSave);
|
return Client::Ref().AddStamp(newSave);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -155,7 +155,7 @@ public:
|
|||||||
void ToggleNewtonianGravity();
|
void ToggleNewtonianGravity();
|
||||||
|
|
||||||
void LoadClipboard();
|
void LoadClipboard();
|
||||||
void LoadStamp();
|
void LoadStamp(GameSave *stamp);
|
||||||
|
|
||||||
void RemoveNotification(Notification * notification);
|
void RemoveNotification(Notification * notification);
|
||||||
|
|
||||||
|
@ -27,7 +27,6 @@ GameModel::GameModel():
|
|||||||
currentFile(NULL),
|
currentFile(NULL),
|
||||||
colourSelector(false),
|
colourSelector(false),
|
||||||
clipboard(NULL),
|
clipboard(NULL),
|
||||||
stamp(NULL),
|
|
||||||
placeSave(NULL),
|
placeSave(NULL),
|
||||||
colour(255, 0, 0, 255),
|
colour(255, 0, 0, 255),
|
||||||
toolStrength(1.0f),
|
toolStrength(1.0f),
|
||||||
@ -96,15 +95,6 @@ GameModel::GameModel():
|
|||||||
currentUser = Client::Ref().GetAuthUser();
|
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();
|
BuildMenus();
|
||||||
|
|
||||||
//Set default brush palette
|
//Set default brush palette
|
||||||
@ -192,8 +182,6 @@ GameModel::~GameModel()
|
|||||||
delete placeSave;
|
delete placeSave;
|
||||||
if(clipboard)
|
if(clipboard)
|
||||||
delete clipboard;
|
delete clipboard;
|
||||||
if(stamp)
|
|
||||||
delete stamp;
|
|
||||||
if(currentSave)
|
if(currentSave)
|
||||||
delete currentSave;
|
delete currentSave;
|
||||||
if(currentFile)
|
if(currentFile)
|
||||||
@ -903,19 +891,6 @@ void GameModel::ClearSimulation()
|
|||||||
UpdateQuickOptions();
|
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)
|
void GameModel::SetPlaceSave(GameSave * save)
|
||||||
{
|
{
|
||||||
if(save != placeSave)
|
if(save != placeSave)
|
||||||
@ -930,14 +905,6 @@ void GameModel::SetPlaceSave(GameSave * save)
|
|||||||
notifyPlaceSaveChanged();
|
notifyPlaceSaveChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GameModel::AddStamp(GameSave * save)
|
|
||||||
{
|
|
||||||
if(stamp)
|
|
||||||
delete stamp;
|
|
||||||
stamp = save;
|
|
||||||
return Client::Ref().AddStamp(save);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GameModel::SetClipboard(GameSave * save)
|
void GameModel::SetClipboard(GameSave * save)
|
||||||
{
|
{
|
||||||
if(clipboard)
|
if(clipboard)
|
||||||
@ -955,11 +922,6 @@ GameSave * GameModel::GetPlaceSave()
|
|||||||
return placeSave;
|
return placeSave;
|
||||||
}
|
}
|
||||||
|
|
||||||
GameSave * GameModel::GetStamp()
|
|
||||||
{
|
|
||||||
return stamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GameModel::Log(string message)
|
void GameModel::Log(string message)
|
||||||
{
|
{
|
||||||
consoleLog.push_front(message);
|
consoleLog.push_front(message);
|
||||||
|
@ -38,7 +38,6 @@ private:
|
|||||||
vector<Notification*> notifications;
|
vector<Notification*> notifications;
|
||||||
//int clipboardSize;
|
//int clipboardSize;
|
||||||
//unsigned char * clipboardData;
|
//unsigned char * clipboardData;
|
||||||
GameSave * stamp;
|
|
||||||
GameSave * clipboard;
|
GameSave * clipboard;
|
||||||
GameSave * placeSave;
|
GameSave * placeSave;
|
||||||
deque<string> consoleLog;
|
deque<string> consoleLog;
|
||||||
@ -185,14 +184,11 @@ public:
|
|||||||
ui::Point AdjustZoomCoords(ui::Point position);
|
ui::Point AdjustZoomCoords(ui::Point position);
|
||||||
void SetZoomWindowPosition(ui::Point position);
|
void SetZoomWindowPosition(ui::Point position);
|
||||||
ui::Point GetZoomWindowPosition();
|
ui::Point GetZoomWindowPosition();
|
||||||
void SetStamp(GameSave * newStamp);
|
|
||||||
std::string AddStamp(GameSave * save);
|
|
||||||
void SetClipboard(GameSave * save);
|
void SetClipboard(GameSave * save);
|
||||||
void SetPlaceSave(GameSave * save);
|
void SetPlaceSave(GameSave * save);
|
||||||
void Log(string message);
|
void Log(string message);
|
||||||
deque<string> GetLog();
|
deque<string> GetLog();
|
||||||
GameSave * GetClipboard();
|
GameSave * GetClipboard();
|
||||||
GameSave * GetStamp();
|
|
||||||
GameSave * GetPlaceSave();
|
GameSave * GetPlaceSave();
|
||||||
|
|
||||||
std::vector<Notification*> GetNotifications();
|
std::vector<Notification*> GetNotifications();
|
||||||
|
@ -1479,12 +1479,18 @@ void GameView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, bool
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
c->LoadStamp();
|
{
|
||||||
|
std::vector<std::string> stampList = Client::Ref().GetStamps(0, 1);
|
||||||
|
if (stampList.size())
|
||||||
|
{
|
||||||
|
c->LoadStamp(Client::Ref().GetStamp(stampList[0])->GetGameSave());
|
||||||
selectPoint2 = mousePosition;
|
selectPoint2 = mousePosition;
|
||||||
selectPoint1 = selectPoint2;
|
selectPoint1 = selectPoint2;
|
||||||
isMouseDown = false;
|
isMouseDown = false;
|
||||||
drawMode = DrawPoints;
|
drawMode = DrawPoints;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
case 'k':
|
case 'k':
|
||||||
selectPoint2 = ui::Point(-1, -1);
|
selectPoint2 = ui::Point(-1, -1);
|
||||||
selectPoint1 = selectPoint2;
|
selectPoint1 = selectPoint2;
|
||||||
|
Loading…
Reference in New Issue
Block a user