Loading a file should call LoadFile instead of recursively calling LoadGame.

pull/35/head
sigonasr2 10 months ago
parent e036302b58
commit 7961e3d8aa
  1. 11
      Adventures in Lestoria/SaveFile.cpp
  2. 1
      Adventures in Lestoria/SaveFile.h

@ -180,9 +180,7 @@ const void SaveFile::SaveGame(){
#endif
}
const void SaveFile::LoadGame(){
std::filesystem::create_directories("save_file_path"_S);
auto LoadFile=[&](){
void SaveFile::LoadFile(){
utils::datafile loadFile;
std::string loadFilename="save_file_path"_S+std::format("save.{:04}",saveFileID);
@ -237,7 +235,10 @@ const void SaveFile::LoadGame(){
}else{
std::cout<<std::format("WARNING! File {} does not exist for loading!","save_file_path"_S+std::format("save.{:04}",saveFileID))<<std::endl;
}
};
};
const void SaveFile::LoadGame(){
std::filesystem::create_directories("save_file_path"_S);
#ifdef __EMSCRIPTEN__
if(onlineMode){
@ -261,7 +262,7 @@ const void SaveFile::LoadGame(){
file<<rawMetadata[i];
}
file.close();
LoadGame();
LoadFile();
},[](void*arg){
std::cout<<"Failed to load Save File "<<saveFileID<<"!"<<std::endl;
});

@ -63,6 +63,7 @@ public:
static const void SetUserID(std::string_view userID);
static const void SaveGame();
static const void LoadGame();
static void LoadFile();
static const void SetSaveFileID(size_t saveFileID);
//Called whenever the save game data is updated.
static const void UpdateSaveGameData();

Loading…
Cancel
Save