diff --git a/.gitignore b/.gitignore index 8d1e74adf..215526297 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ stderr.txt build*/* stamps/* Saves/* +scripts/* generated/* includes/* generate diff --git a/src/client/Client.cpp b/src/client/Client.cpp index b313dc511..afa7f39c0 100644 --- a/src/client/Client.cpp +++ b/src/client/Client.cpp @@ -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) diff --git a/src/client/Client.h b/src/client/Client.h index bf5b3920f..35cb548e9 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -73,7 +73,6 @@ private: int activeThumbRequestTimes[IMGCONNS]; int activeThumbRequestCompleteTimes[IMGCONNS]; std::string activeThumbRequestIDs[IMGCONNS]; - void updateStamps(); static std::vector 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); diff --git a/src/gui/interface/SaveButton.cpp b/src/gui/interface/SaveButton.cpp index 6406d353c..a73e86372 100644 --- a/src/gui/interface/SaveButton.cpp +++ b/src/gui/interface/SaveButton.cpp @@ -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); } diff --git a/src/gui/localbrowser/LocalBrowserController.cpp b/src/gui/localbrowser/LocalBrowserController.cpp index b09017d61..7be9d9ae3 100644 --- a/src/gui/localbrowser/LocalBrowserController.cpp +++ b/src/gui/localbrowser/LocalBrowserController.cpp @@ -76,6 +76,7 @@ void LocalBrowserController::removeSelectedC() } virtual void after() { + Client::Ref().updateStamps(); c->RefreshSavesList(); } }; diff --git a/src/gui/localbrowser/LocalBrowserView.cpp b/src/gui/localbrowser/LocalBrowserView.cpp index e30ada8c4..782aff11c 100644 --- a/src/gui/localbrowser/LocalBrowserView.cpp +++ b/src/gui/localbrowser/LocalBrowserView.cpp @@ -233,12 +233,12 @@ void LocalBrowserView::NotifySavesListChanged(LocalBrowserModel * sender) void LocalBrowserView::NotifySelectedChanged(LocalBrowserModel * sender) { vector 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); } }