Skip to content

Commit d33b92c

Browse files
committed
Allow loading a game while a save is happening, as long as they're touching different files
1 parent 2abaff3 commit d33b92c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Source/Managers/ActivityMan.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,16 +232,21 @@ bool ActivityMan::SaveCurrentGame(const std::string& fileName) {
232232
}
233233

234234
bool ActivityMan::LoadAndLaunchGame(const std::string& fileName) {
235-
m_SaveGameTask.wait();
236-
237235
std::string filePath = g_PresetMan.GetFullModulePath(c_UserScriptedSavesModuleName) + "/" + fileName;
238236

239237
// load zip sav file
240238
std::string saveFilePath = filePath + ".ccsave";
241239
unzFile zippedSaveFile = unzOpen(saveFilePath.c_str());
242240
if (!zippedSaveFile) {
243-
RTEError::ShowMessageBox("Game loading failed! Make sure you have a saved game called \"" + fileName + "\"");
244-
return false;
241+
// Might be trying to open one we're already saving too, wait until we finish saving and try again
242+
m_SaveGameTask.wait();
243+
zippedSaveFile = unzOpen(saveFilePath.c_str());
244+
245+
if (!zippedSaveFile) {
246+
// Some other process is stopping us from loading, oh well
247+
RTEError::ShowMessageBox("Game loading failed! Make sure you have a saved game called \"" + fileName + "\"");
248+
return false;
249+
}
245250
}
246251

247252
unz_file_info info;

0 commit comments

Comments
 (0)