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))
{
SaveFile * file = new SaveFile(stampID);
try
{
GameSave * tempSave = new GameSave(ReadFile(stampFile));
@ -1003,13 +1003,9 @@ SaveFile * Client::GetStamp(std::string stampID)
{
std::cerr << "Client: Invalid stamp file, " << stampID << " " << std::string(e.what()) << std::endl;
}
}
return file;
}
else
{
return NULL;
}
}
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,7 +255,7 @@ 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)
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);

View File

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