diff options
author | rubidium <rubidium@openttd.org> | 2009-09-14 15:53:19 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-09-14 15:53:19 +0000 |
commit | 14ea4e7672889df8810d487ed892c41c8f7bc8ef (patch) | |
tree | bacbc6aec93db46147289749f2282411c5bf4e67 /src/saveload | |
parent | 64bafcbe182ef539a31ffed9bd1f19ca0f7ae62a (diff) | |
download | openttd-14ea4e7672889df8810d487ed892c41c8f7bc8ef.tar.xz |
(svn r17535) -Fix: compiling without networking failed; also unhackify the crash logger a bit.
Diffstat (limited to 'src/saveload')
-rw-r--r-- | src/saveload/saveload.cpp | 9 | ||||
-rw-r--r-- | src/saveload/saveload.h | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index 39e6afa0e..5ec0a734e 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -1780,9 +1780,10 @@ void WaitTillSaved() * handled. It opens the savegame, selects format and checks versions * @param filename The name of the savegame being created/loaded * @param mode Save or load. Load can also be a TTD(Patch) game. Use SL_LOAD, SL_OLD_LOAD or SL_SAVE + * @param threaded True when threaded saving is allowed * @return Return the results of the action. SL_OK, SL_ERROR or SL_REINIT ("unload" the game) */ -SaveOrLoadResult SaveOrLoad(const char *filename, int mode, Subdirectory sb) +SaveOrLoadResult SaveOrLoad(const char *filename, int mode, Subdirectory sb, bool threaded) { uint32 hdr[2]; const SaveLoadFormat *fmt; @@ -1851,9 +1852,9 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode, Subdirectory sb) SlWriteFill(); // flush the save buffer SaveFileStart(); - if (_network_server || - !ThreadObject::New(&SaveFileToDiskThread, NULL, &_save_thread)) { - if (!_network_server) DEBUG(sl, 1, "Cannot create savegame thread, reverting to single-threaded mode..."); + if (_network_server) threaded = false; + if (!threaded || !ThreadObject::New(&SaveFileToDiskThread, NULL, &_save_thread)) { + if (threaded) DEBUG(sl, 1, "Cannot create savegame thread, reverting to single-threaded mode..."); SaveOrLoadResult result = SaveFileToDisk(false); SaveFileDone(); diff --git a/src/saveload/saveload.h b/src/saveload/saveload.h index 765f99b0c..5d33c099f 100644 --- a/src/saveload/saveload.h +++ b/src/saveload/saveload.h @@ -47,7 +47,7 @@ enum SavegameType { void GenerateDefaultSaveName(char *buf, const char *last); void SetSaveLoadError(uint16 str); const char *GetSaveLoadErrorString(); -SaveOrLoadResult SaveOrLoad(const char *filename, int mode, Subdirectory sb); +SaveOrLoadResult SaveOrLoad(const char *filename, int mode, Subdirectory sb, bool threaded = true); void WaitTillSaved(); void DoExitSave(); |