Merge branch 'master' into jgrpp
# Conflicts: # cmake/CompileFlags.cmake # src/crashlog.cpp # src/fileio.cpp # src/fileio_func.h # src/fios_gui.cpp # src/ini_load.cpp # src/ini_type.h # src/lang/english.txt # src/lang/german.txt # src/lang/korean.txt # src/network/network_client.cpp # src/order_base.h # src/order_cmd.cpp # src/os/windows/win32.cpp # src/road_cmd.cpp # src/saveload/saveload.cpp # src/saveload/saveload.h # src/settings.cpp # src/station_cmd.cpp # src/stdafx.h # src/table/settings.ini # src/tree_cmd.cpp # src/tree_gui.cpp # src/vehicle_base.h # src/video/cocoa/cocoa_v.mm # src/video/cocoa/event.mm # src/video/cocoa/wnd_quartz.mm # src/viewport.cpp # src/widgets/tree_widget.h
This commit is contained in:
@@ -355,17 +355,13 @@ static void SlNullPointers()
|
||||
_sl_version = SAVEGAME_VERSION;
|
||||
SlXvSetCurrentState();
|
||||
|
||||
DEBUG(sl, 1, "Nulling pointers");
|
||||
|
||||
FOR_ALL_CHUNK_HANDLERS(ch) {
|
||||
if (ch->ptrs_proc != nullptr) {
|
||||
DEBUG(sl, 2, "Nulling pointers for %c%c%c%c", ch->id >> 24, ch->id >> 16, ch->id >> 8, ch->id);
|
||||
DEBUG(sl, 3, "Nulling pointers for %c%c%c%c", ch->id >> 24, ch->id >> 16, ch->id >> 8, ch->id);
|
||||
ch->ptrs_proc();
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG(sl, 1, "All pointers nulled");
|
||||
|
||||
assert(_sl.action == SLA_NULL);
|
||||
}
|
||||
|
||||
@@ -1270,7 +1266,7 @@ static size_t ReferenceToInt(const void *obj, SLRefType rt)
|
||||
*/
|
||||
static void *IntToReference(size_t index, SLRefType rt)
|
||||
{
|
||||
assert_compile(sizeof(size_t) <= sizeof(void *));
|
||||
static_assert(sizeof(size_t) <= sizeof(void *));
|
||||
|
||||
assert(_sl.action == SLA_PTRS);
|
||||
|
||||
@@ -2307,17 +2303,13 @@ static void SlFixPointers()
|
||||
{
|
||||
_sl.action = SLA_PTRS;
|
||||
|
||||
DEBUG(sl, 1, "Fixing pointers");
|
||||
|
||||
FOR_ALL_CHUNK_HANDLERS(ch) {
|
||||
if (ch->ptrs_proc != nullptr) {
|
||||
DEBUG(sl, 2, "Fixing pointers for %c%c%c%c", ch->id >> 24, ch->id >> 16, ch->id >> 8, ch->id);
|
||||
DEBUG(sl, 3, "Fixing pointers for %c%c%c%c", ch->id >> 24, ch->id >> 16, ch->id >> 8, ch->id);
|
||||
ch->ptrs_proc();
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG(sl, 1, "All pointers fixed");
|
||||
|
||||
assert(_sl.action == SLA_PTRS);
|
||||
}
|
||||
|
||||
@@ -2874,7 +2866,7 @@ static const SaveLoadFormat *GetSavegameFormat(char *s, byte *compression_level)
|
||||
/* actual loader/saver function */
|
||||
void InitializeGame(uint size_x, uint size_y, bool reset_date, bool reset_settings);
|
||||
extern bool AfterLoadGame();
|
||||
extern bool LoadOldSaveGame(const char *file);
|
||||
extern bool LoadOldSaveGame(const std::string &file);
|
||||
|
||||
/**
|
||||
* Clear temporary data that is passed between various saveload phases.
|
||||
@@ -3368,7 +3360,7 @@ SaveOrLoadResult LoadWithFilter(LoadFilter *reader)
|
||||
* @param threaded True when threaded saving is allowed
|
||||
* @return Return the result of the action. #SL_OK, #SL_ERROR, or #SL_REINIT ("unload" the game)
|
||||
*/
|
||||
SaveOrLoadResult SaveOrLoad(const char *filename, SaveLoadOperation fop, DetailedFileType dft, Subdirectory sb, bool threaded)
|
||||
SaveOrLoadResult SaveOrLoad(const std::string &filename, SaveLoadOperation fop, DetailedFileType dft, Subdirectory sb, bool threaded)
|
||||
{
|
||||
/* An instance of saving is already active, so don't go saving again */
|
||||
if (_sl.saveinprogress && fop == SLO_SAVE && dft == DFT_GAME_FILE && threaded) {
|
||||
@@ -3435,7 +3427,7 @@ SaveOrLoadResult SaveOrLoad(const char *filename, SaveLoadOperation fop, Detaile
|
||||
}
|
||||
|
||||
if (fop == SLO_SAVE) { // SAVE game
|
||||
DEBUG(desync, 1, "save: date{%08x; %02x; %02x}; %s", _date, _date_fract, _tick_skip_counter, filename);
|
||||
DEBUG(desync, 1, "save: date{%08x; %02x; %02x}; %s", _date, _date_fract, _tick_skip_counter, filename.c_str());
|
||||
if (_network_server || !_settings_client.gui.threaded_saves) threaded = false;
|
||||
|
||||
return DoSave(new FileWriter(fh), threaded);
|
||||
@@ -3443,7 +3435,7 @@ SaveOrLoadResult SaveOrLoad(const char *filename, SaveLoadOperation fop, Detaile
|
||||
|
||||
/* LOAD game */
|
||||
assert(fop == SLO_LOAD || fop == SLO_CHECK);
|
||||
DEBUG(desync, 1, "load: %s", filename);
|
||||
DEBUG(desync, 1, "load: %s", filename.c_str());
|
||||
return DoLoad(new FileReader(fh), fop == SLO_CHECK);
|
||||
} catch (...) {
|
||||
/* This code may be executed both for old and new save games. */
|
||||
@@ -3532,7 +3524,7 @@ void FileToSaveLoad::SetMode(SaveLoadOperation fop, AbstractFileType aft, Detail
|
||||
*/
|
||||
void FileToSaveLoad::SetName(const char *name)
|
||||
{
|
||||
strecpy(this->name, name, lastof(this->name));
|
||||
this->name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user