Fix a bug where save file hashes with trailing spaces were not read properly, locking players out of the character. Release Build 8647.
This commit is contained in:
parent
35c269bd8b
commit
3f13c574c0
@ -490,6 +490,9 @@ std::vector<std::weak_ptr<Item>>Inventory::GetItem(IT it){
|
||||
uint32_t Inventory::GetItemCount(IT it){
|
||||
if(!_inventory.count(it)){
|
||||
return 0;
|
||||
}else
|
||||
if(ITEM_DATA.at(it).IsAccessory()){
|
||||
return 1; //We always only have 1 of any given accessory.
|
||||
}else{
|
||||
auto inventory=_inventory.equal_range(it);
|
||||
return std::accumulate(inventory.first,inventory.second,0,[](int val,std::pair<IT,std::shared_ptr<Item>>it){return val+(*it.second).Amt();});
|
||||
|
@ -304,10 +304,18 @@ void SaveFile::LoadFile(){
|
||||
std::string expectedFileHash=loadFile["Hash"].GetString();
|
||||
loadFile["Hash"].SetString("");
|
||||
utils::datafile::Write(loadFile,"save_file_path"_S+std::format("save.{:04}",saveFileID));
|
||||
|
||||
auto trim = [](std::string& s)
|
||||
{
|
||||
s.erase(0, s.find_first_not_of(" \t\n\r\f\v"));
|
||||
s.erase(s.find_last_not_of(" \t\n\r\f\v") + 1);
|
||||
};
|
||||
|
||||
std::string fileHash=util::GetHash("save_file_path"_S+std::format("save.{:04}",saveFileID));
|
||||
trim(fileHash); //It's possible the expected file hash has a space at the end/beginning that gets stripped out. We want to trim and match that string.
|
||||
|
||||
if(expectedFileHash!=fileHash){
|
||||
LOG(std::format("WARNING! Filehash for file {} was not identified as proper! Will not load this file!","save_file_path"_S+std::format("save.{:04}",saveFileID)));
|
||||
ERR(std::format("WARNING! Filehash for file {} was not identified as proper! Will not load this file!","save_file_path"_S+std::format("save.{:04}",saveFileID)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
||||
#define VERSION_MAJOR 1
|
||||
#define VERSION_MINOR 0
|
||||
#define VERSION_PATCH 0
|
||||
#define VERSION_BUILD 8630
|
||||
#define VERSION_BUILD 8647
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user