update stamps.def when deleting stamps, missing stamps show up as "error loading save" and can be deleted

This commit is contained in:
jacob1 2014-11-11 23:48:36 -05:00
parent cd9fa0c85a
commit 1289465a2c
6 changed files with 14 additions and 14 deletions

1
.gitignore vendored
View File

@ -15,6 +15,7 @@ stderr.txt
build*/*
stamps/*
Saves/*
scripts/*
generated/*
includes/*
generate

View File

@ -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)

View File

@ -73,7 +73,6 @@ private:
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 @@ public:
int GetStampsCount();
SaveFile * GetFirstStamp();
void MoveStampToFront(std::string stampID);
void updateStamps();
RequestStatus AddComment(int saveID, std::string comment);

View File

@ -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);
}

View File

@ -76,6 +76,7 @@ void LocalBrowserController::removeSelectedC()
}
virtual void after()
{
Client::Ref().updateStamps();
c->RefreshSavesList();
}
};

View File

@ -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);
}
}