mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-17 21:25:40 +00:00
(svn r2587) - Fix: Don't close the save-thread if it wasn't started because of some error or a network-server
This commit is contained in:
parent
c2409a2861
commit
f043088ec1
@ -1280,7 +1280,7 @@ static bool SaveFileToDisk(void *ptr)
|
||||
fclose(_sl.fh);
|
||||
|
||||
SaveFileDone();
|
||||
CloseOTTDThread();
|
||||
if (*(bool*)ptr) CloseOTTDThread();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1352,6 +1352,7 @@ int SaveOrLoad(const char *filename, int mode)
|
||||
/* General tactic is to first save the game to memory, then use an available writer
|
||||
* to write it to file, either in threaded mode if possible, or single-threaded */
|
||||
if (mode == SL_SAVE) { /* SAVE game */
|
||||
bool threaded = true;
|
||||
fmt = GetSavegameFormat("memory"); // write to memory
|
||||
|
||||
_sl.write_bytes = fmt->writer;
|
||||
@ -1368,9 +1369,10 @@ int SaveOrLoad(const char *filename, int mode)
|
||||
SlWriteFill(); // flush the save buffer
|
||||
|
||||
/* Write to file */
|
||||
if (_network_server || !CreateOTTDThread(&SaveFileToDisk, NULL)) {
|
||||
if (_network_server || !CreateOTTDThread(&SaveFileToDisk, &threaded)) {
|
||||
DEBUG(misc, 1) ("cannot create savegame thread, reverting to single-threaded mode...");
|
||||
SaveFileToDisk(NULL);
|
||||
threaded = false;
|
||||
SaveFileToDisk(&threaded);
|
||||
}
|
||||
|
||||
} else { /* LOAD game */
|
||||
|
Loading…
Reference in New Issue
Block a user