Permalink
Browse files

update stamps.def when deleting stamps, missing stamps show up as "er…

…ror loading save" and can be deleted
  • Loading branch information...
jacob1 committed Nov 12, 2014
1 parent cd9fa0c commit 1289465a2ce785e5df52a0e6c7294167a970be7a
@@ -15,6 +15,7 @@ stderr.txt
build*/*
stamps/*
Saves/*
scripts/*
generated/*
includes/*
generate
@@ -989,11 +989,11 @@ void Client::MoveStampToFront(std::string stampID)
SaveFile * Client::GetStamp(std::string stampID)
{
std::string stampFile = std::string(STAMPS_DIR PATH_SEP + stampID + ".stm");
SaveFile * file = new SaveFile(stampID);
if (!FileExists(stampFile))
stampFile = stampID;
if(FileExists(stampFile))
if (FileExists(stampFile))
{
SaveFile * file = new SaveFile(stampID);
try
{
GameSave * tempSave = new GameSave(ReadFile(stampFile));
@@ -1003,12 +1003,8 @@ SaveFile * Client::GetStamp(std::string stampID)
{
std::cerr << "Client: Invalid stamp file, " << stampID << " " << std::string(e.what()) << std::endl;
}
return file;
}
else
{
return NULL;
}
return file;
}
void Client::DeleteStamp(std::string stampID)
@@ -73,7 +73,6 @@ class Client: public Singleton<Client> {
int activeThumbRequestTimes[IMGCONNS];
int activeThumbRequestCompleteTimes[IMGCONNS];
std::string activeThumbRequestIDs[IMGCONNS];
void updateStamps();
static std::vector<std::string> explodePropertyString(std::string property);
void notifyUpdateAvailable();
void notifyAuthUserChanged();
@@ -129,6 +128,7 @@ class Client: public Singleton<Client> {
int GetStampsCount();
SaveFile * GetFirstStamp();
void MoveStampToFront(std::string stampID);
void updateStamps();
RequestStatus AddComment(int saveID, std::string comment);
@@ -190,6 +190,8 @@ void SaveButton::Draw(const Point& screenPos)
else
g->draw_image(thumbnail, screenPos.X+(Size.X-thumbBoxSize.X)/2, screenPos.Y+(Size.Y-21-thumbBoxSize.Y)/2, 255);
}
else if (file && !file->GetGameSave())
g->drawtext(screenPos.X+(Size.X-Graphics::textwidth("Error loading save"))/2, screenPos.Y+(Size.Y-28)/2, "Error loading save", 180, 180, 180, 255);
if(save)
{
if(save->id)
@@ -253,14 +255,14 @@ void SaveButton::Draw(const Point& screenPos)
g->drawtext(screenPos.X, screenPos.Y-2, "\xCE", 212, 151, 81, 255);
}
}
if(file)
else if (file)
{
if(isMouseInside)
if (isMouseInside)
g->drawrect(screenPos.X+(Size.X-thumbBoxSize.X)/2, screenPos.Y+(Size.Y-21-thumbBoxSize.Y)/2, thumbBoxSize.X, thumbBoxSize.Y, 210, 230, 255, 255);
else
g->drawrect(screenPos.X+(Size.X-thumbBoxSize.X)/2, screenPos.Y+(Size.Y-21-thumbBoxSize.Y)/2, thumbBoxSize.X, thumbBoxSize.Y, 180, 180, 180, 255);
if(isMouseInside)
if (isMouseInside)
{
g->drawtext(screenPos.X+(Size.X-Graphics::textwidth((char *)name.c_str()))/2, screenPos.Y+Size.Y - 21, name, 255, 255, 255, 255);
}
@@ -76,6 +76,7 @@ void LocalBrowserController::removeSelectedC()
}
virtual void after()
{
Client::Ref().updateStamps();
c->RefreshSavesList();
}
};
@@ -233,12 +233,12 @@ void LocalBrowserView::NotifySavesListChanged(LocalBrowserModel * sender)
void LocalBrowserView::NotifySelectedChanged(LocalBrowserModel * sender)
{
vector<std::string> selected = sender->GetSelected();
for(int j = 0; j < stampButtons.size(); j++)
for (int j = 0; j < stampButtons.size(); j++)
{
stampButtons[j]->SetSelected(false);
for(int i = 0; i < selected.size(); i++)
for (int i = 0; i < selected.size(); i++)
{
if(stampButtons[j]->GetSaveFile()->GetName()==selected[i])
if (stampButtons[j]->GetSaveFile()->GetName()==selected[i])
stampButtons[j]->SetSelected(true);
}
}

0 comments on commit 1289465

Please sign in to comment.