Changeset - r17052:a8680493622e
[Not reviewed]
master
0 1 0
smatz - 14 years ago 2011-01-15 00:10:16
smatz@openttd.org
(svn r21799) -Fix: further variables need to be reset when we loaded a TTDPatch savegame in the past
1 file changed with 15 insertions and 11 deletions:
0 comments (0 inline, 0 general)
src/saveload/oldloader_sl.cpp
Show inline comments
 
@@ -34,7 +34,9 @@
 
#include "../table/engines.h"
 
#include "../table/townname.h"
 

	
 
static bool _read_ttdpatch_flags;
 
static bool _read_ttdpatch_flags;    ///< Have we (tried to) read TTDPatch extra flags?
 
static uint16 _old_extra_chunk_nums; ///< Number of extra TTDPatch chunks
 
static byte _old_vehicle_multiplier; ///< TTDPatch vehicle multiplier
 

	
 
static uint8 *_old_map3;
 

	
 
@@ -483,24 +485,24 @@ extern TileIndex *_animated_tile_list;
 
extern uint _animated_tile_count;
 
extern char *_old_name_array;
 

	
 
static byte   _old_vehicle_multiplier;
 
static uint32 _old_town_index;
 
static uint16 _old_string_id;
 
static uint16 _old_string_id_2;
 
static uint16 _old_extra_chunk_nums;
 

	
 
static void ReadTTDPatchFlags()
 
{
 
	if (_savegame_type == SGT_TTO) {
 
		_old_vehicle_multiplier = 1;
 
		_bump_assert_value = 0;
 
		return;
 
	}
 

	
 
	if (_read_ttdpatch_flags) return;
 

	
 
	_read_ttdpatch_flags = true;
 

	
 
	/* Set default values */
 
	_old_vehicle_multiplier = 1;
 
	_ttdp_version = 0;
 
	_old_extra_chunk_nums = 0;
 
	_bump_assert_value = 0;
 

	
 
	if (_savegame_type == SGT_TTO) return;
 

	
 
	/* TTDPatch misuses _old_map3 for flags.. read them! */
 
	_old_vehicle_multiplier = _old_map3[0];
 
	/* Somehow.... there was an error in some savegames, so 0 becomes 1
 
@@ -1729,10 +1731,10 @@ static const OldChunks main_chunk[] = {
 

	
 
bool LoadTTDMain(LoadgameState *ls)
 
{
 
	DEBUG(oldloader, 3, "Reading main chunk...");
 

	
 
	_read_ttdpatch_flags = false;
 
	_ttdp_version = 0;
 

	
 
	DEBUG(oldloader, 3, "Reading main chunk...");
 
	/* Load the biggest chunk */
 
	SmallStackSafeStackAlloc<byte, OLD_MAP_SIZE * 2> map3;
 
	_old_map3 = map3.data;
 
@@ -1775,6 +1777,8 @@ bool LoadTTOMain(LoadgameState *ls)
 
{
 
	DEBUG(oldloader, 3, "Reading main chunk...");
 

	
 
	_read_ttdpatch_flags = false;
 

	
 
	SmallStackSafeStackAlloc<byte, 103 * sizeof(Engine)> engines; // we don't want to call Engine constructor here
 
	_old_engines = (Engine *)engines.data;
 
	SmallStackSafeStackAlloc<StringID, 800> vehnames;
0 comments (0 inline, 0 general)