Fix stamps not saving properly to stamps.def. Make "Rescan Stamps" sort stamps by time created

This commit is contained in:
jacob1 2019-07-26 23:09:27 -04:00
parent c696a11793
commit a73d1f97f6
2 changed files with 4 additions and 1 deletions

View File

@ -1028,6 +1028,8 @@ SaveFile * Client::GetStamp(ByteString stampID)
SaveFile *saveFile = LoadSaveFile(stampFile); SaveFile *saveFile = LoadSaveFile(stampFile);
if (!saveFile) if (!saveFile)
saveFile = LoadSaveFile(stampID); saveFile = LoadSaveFile(stampID);
else
saveFile->SetDisplayName(stampID.FromUtf8());
return saveFile; return saveFile;
} }
@ -1123,6 +1125,7 @@ void Client::RescanStamps()
stampIDs.push_front(name.Substr(0, 10)); stampIDs.push_front(name.Substr(0, 10));
} }
closedir(directory); closedir(directory);
stampIDs.sort(std::greater<ByteString>());
updateStamps(); updateStamps();
} }
} }

View File

@ -160,7 +160,7 @@ public:
if (file->GetError().length()) if (file->GetError().length())
new ErrorMessage("Error loading stamp", file->GetError()); new ErrorMessage("Error loading stamp", file->GetError());
else if (cc->localBrowser->GetMoveToFront()) else if (cc->localBrowser->GetMoveToFront())
Client::Ref().MoveStampToFront(file->GetName()); Client::Ref().MoveStampToFront(file->GetDisplayName().ToUtf8());
cc->LoadStamp(file->GetGameSave()); cc->LoadStamp(file->GetGameSave());
} }
} }