Skip to content

Commit

Permalink
update stamps.def when deleting stamps, missing stamps show up as "er…
Browse files Browse the repository at this point in the history
…ror loading save" and can be deleted
  • Loading branch information
jacob1 committed Nov 12, 2014
1 parent cd9fa0c commit 1289465
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -15,6 +15,7 @@ stderr.txt
build*/*
stamps/*
Saves/*
scripts/*
generated/*
includes/*
generate
Expand Down
10 changes: 3 additions & 7 deletions src/client/Client.cpp
Expand Up @@ -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));
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/client/Client.h
Expand Up @@ -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();
Expand Down Expand Up @@ -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);

Expand Down
8 changes: 5 additions & 3 deletions src/gui/interface/SaveButton.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}
Expand Down
1 change: 1 addition & 0 deletions src/gui/localbrowser/LocalBrowserController.cpp
Expand Up @@ -76,6 +76,7 @@ void LocalBrowserController::removeSelectedC()
}
virtual void after()
{
Client::Ref().updateStamps();
c->RefreshSavesList();
}
};
Expand Down
6 changes: 3 additions & 3 deletions src/gui/localbrowser/LocalBrowserView.cpp
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit 1289465

Please sign in to comment.