1
0
Fork 0

(svn r17535) -Fix: compiling without networking failed; also unhackify the crash logger a bit.

release/1.0
rubidium 2009-09-14 15:53:19 +00:00
parent 64bafcbe18
commit 14ea4e7672
3 changed files with 8 additions and 9 deletions

View File

@ -16,7 +16,6 @@
#include "rev.h" #include "rev.h"
#include "string_func.h" #include "string_func.h"
#include "strings_func.h" #include "strings_func.h"
#include "network/network.h"
#include "blitter/factory.hpp" #include "blitter/factory.hpp"
#include "base_media_base.h" #include "base_media_base.h"
#include "music/music_driver.hpp" #include "music/music_driver.hpp"
@ -218,9 +217,8 @@ bool CrashLog::WriteSavegame(char *filename, const char *filename_last) const
seprintf(filename, filename_last, "%scrash.sav", _personal_dir); seprintf(filename, filename_last, "%scrash.sav", _personal_dir);
/* Fake ourselves to be a network server so we don't get threaded saving */ /* Don't do a threaded saveload. */
_network_server = true; return SaveOrLoad(filename, SL_SAVE, NO_DIRECTORY, false) == SL_OK;
return SaveOrLoad(filename, SL_SAVE, NO_DIRECTORY) == SL_OK;
} catch (...) { } catch (...) {
return false; return false;
} }

View File

@ -1780,9 +1780,10 @@ void WaitTillSaved()
* handled. It opens the savegame, selects format and checks versions * handled. It opens the savegame, selects format and checks versions
* @param filename The name of the savegame being created/loaded * @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 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) * @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]; uint32 hdr[2];
const SaveLoadFormat *fmt; const SaveLoadFormat *fmt;
@ -1851,9 +1852,9 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode, Subdirectory sb)
SlWriteFill(); // flush the save buffer SlWriteFill(); // flush the save buffer
SaveFileStart(); SaveFileStart();
if (_network_server || if (_network_server) threaded = false;
!ThreadObject::New(&SaveFileToDiskThread, NULL, &_save_thread)) { if (!threaded || !ThreadObject::New(&SaveFileToDiskThread, NULL, &_save_thread)) {
if (!_network_server) DEBUG(sl, 1, "Cannot create savegame thread, reverting to single-threaded mode..."); if (threaded) DEBUG(sl, 1, "Cannot create savegame thread, reverting to single-threaded mode...");
SaveOrLoadResult result = SaveFileToDisk(false); SaveOrLoadResult result = SaveFileToDisk(false);
SaveFileDone(); SaveFileDone();

View File

@ -47,7 +47,7 @@ enum SavegameType {
void GenerateDefaultSaveName(char *buf, const char *last); void GenerateDefaultSaveName(char *buf, const char *last);
void SetSaveLoadError(uint16 str); void SetSaveLoadError(uint16 str);
const char *GetSaveLoadErrorString(); 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 WaitTillSaved();
void DoExitSave(); void DoExitSave();