Changeset - r9413:fcf267325763
[Not reviewed]
master
! ! !
rubidium - 16 years ago 2008-05-29 15:13:28
rubidium@openttd.org
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
69 files changed:
Changeset was too big and was cut off... Show full diff anyway
0 comments (0 inline, 0 general)
src/ai/ai.cpp
Show inline comments
 
@@ -154,7 +154,7 @@ static void AI_RunTick(PlayerID player)
 
	Player *p = GetPlayer(player);
 
	_current_player = player;
 

	
 
	if (_settings.ai.ainew_active) {
 
	if (_settings_game.ai.ainew_active) {
 
		AiNewDoGameLoop(p);
 
	} else {
 
		/* Enable all kind of cheats the old AI needs in order to operate correctly... */
 
@@ -178,14 +178,14 @@ void AI_RunGameLoop()
 
	if (!_ai.enabled) return;
 

	
 
	/* Don't do anything if we are a network-client, or the AI has been disabled */
 
	if (_networking && (!_network_server || !_settings.ai.ai_in_multiplayer)) return;
 
	if (_networking && (!_network_server || !_settings_game.ai.ai_in_multiplayer)) return;
 

	
 
	/* New tick */
 
	_ai.tick++;
 

	
 
	/* Make sure the AI follows the difficulty rule.. */
 
	assert(_settings.difficulty.competitor_speed <= 4);
 
	if ((_ai.tick & ((1 << (4 - _settings.difficulty.competitor_speed)) - 1)) != 0) return;
 
	assert(_settings_game.difficulty.competitor_speed <= 4);
 
	if ((_ai.tick & ((1 << (4 - _settings_game.difficulty.competitor_speed)) - 1)) != 0) return;
 

	
 
	/* Check for AI-client (so joining a network with an AI) */
 
	if (!_networking || _network_server) {
src/ai/ai.h
Show inline comments
 
@@ -67,14 +67,14 @@ static inline bool AI_AllowNewAI()
 
	/* If in network, and server, possible AI */
 
	if (_networking && _network_server) {
 
		/* Do we want AIs in multiplayer? */
 
		if (!_settings.ai.ai_in_multiplayer)
 
		if (!_settings_game.ai.ai_in_multiplayer)
 
			return false;
 

	
 
		/* Only the NewAI is allowed... sadly enough the old AI just doesn't support this
 
		 *  system, because all commands are delayed by at least 1 tick, which causes
 
		 *  a big problem, because it uses variables that are only set AFTER the command
 
		 *  is really executed... */
 
		if (!_settings.ai.ainew_active)
 
		if (!_settings_game.ai.ainew_active)
 
			return false;
 
	}
 

	
src/ai/default/default.cpp
Show inline comments
 
@@ -1570,21 +1570,21 @@ static void AiStateWantNewRoute(Player *
 
	for (;;) {
 
		r = (uint16)Random();
 

	
 
		if (_settings.ai.ai_disable_veh_train &&
 
				_settings.ai.ai_disable_veh_roadveh &&
 
				_settings.ai.ai_disable_veh_aircraft &&
 
				_settings.ai.ai_disable_veh_ship) {
 
		if (_settings_game.ai.ai_disable_veh_train &&
 
				_settings_game.ai.ai_disable_veh_roadveh &&
 
				_settings_game.ai.ai_disable_veh_aircraft &&
 
				_settings_game.ai.ai_disable_veh_ship) {
 
			return;
 
		}
 

	
 
		if (r < 0x7626) {
 
			if (_settings.ai.ai_disable_veh_train) continue;
 
			if (_settings_game.ai.ai_disable_veh_train) continue;
 
			AiWantTrainRoute(p);
 
		} else if (r < 0xC4EA) {
 
			if (_settings.ai.ai_disable_veh_roadveh) continue;
 
			if (_settings_game.ai.ai_disable_veh_roadveh) continue;
 
			AiWantRoadRoute(p);
 
		} else if (r < 0xD89B) {
 
			if (_settings.ai.ai_disable_veh_aircraft) continue;
 
			if (_settings_game.ai.ai_disable_veh_aircraft) continue;
 
			AiWantAircraftRoute(p);
 
		} else {
 
			/* Ships are not implemented in this (broken) AI */
 
@@ -1603,7 +1603,7 @@ static void AiStateWantNewRoute(Player *
 

	
 
static bool AiCheckTrackResources(TileIndex tile, const AiDefaultBlockData *p, byte cargo)
 
{
 
	uint rad = (_settings.station.modified_catchment) ? CA_TRAIN : CA_UNMODIFIED;
 
	uint rad = (_settings_game.station.modified_catchment) ? CA_TRAIN : CA_UNMODIFIED;
 

	
 
	for (; p->mode != 4; p++) {
 
		AcceptedCargo values;
 
@@ -2550,7 +2550,7 @@ handle_nocash:
 
		bool is_pass = (
 
			_players_ai[p->index].cargo_type == CT_PASSENGERS ||
 
			_players_ai[p->index].cargo_type == CT_MAIL ||
 
			(_settings.game_creation.landscape == LT_TEMPERATE && _players_ai[p->index].cargo_type == CT_VALUABLES)
 
			(_settings_game.game_creation.landscape == LT_TEMPERATE && _players_ai[p->index].cargo_type == CT_VALUABLES)
 
		);
 
		Order order;
 

	
 
@@ -2599,7 +2599,7 @@ static bool AiCheckRoadResources(TileInd
 
	uint values[NUM_CARGO];
 
	int rad;
 

	
 
	if (_settings.station.modified_catchment) {
 
	if (_settings_game.station.modified_catchment) {
 
		rad = CA_TRUCK; // Same as CA_BUS at the moment?
 
	} else { // change that at some point?
 
		rad = 4;
 
@@ -3285,7 +3285,7 @@ static void AiStateBuildRoadVehicles(Pla
 
		bool is_pass = (
 
			_players_ai[p->index].cargo_type == CT_PASSENGERS ||
 
			_players_ai[p->index].cargo_type == CT_MAIL ||
 
			(_settings.game_creation.landscape == LT_TEMPERATE && _players_ai[p->index].cargo_type == CT_VALUABLES)
 
			(_settings_game.game_creation.landscape == LT_TEMPERATE && _players_ai[p->index].cargo_type == CT_VALUABLES)
 
		);
 
		Order order;
 

	
 
@@ -3423,7 +3423,7 @@ static bool AiCheckAirportResources(Tile
 
		const AirportFTAClass* airport = GetAirport(p->attr);
 
		uint w = airport->size_x;
 
		uint h = airport->size_y;
 
		uint rad = _settings.station.modified_catchment ? airport->catchment : (uint)CA_UNMODIFIED;
 
		uint rad = _settings_game.station.modified_catchment ? airport->catchment : (uint)CA_UNMODIFIED;
 

	
 
		if (cargo & 0x80) {
 
			GetProductionAroundTiles(values, tile2, w, h, rad);
 
@@ -3975,7 +3975,7 @@ void AiDoGameLoop(Player *p)
 
	//  to the patch-setting
 
	// Also, it takes into account the setting if the service-interval is in days
 
	//  or in %
 
	_ai_service_interval = _settings.vehicle.servint_ispercent ? 80 : 180;
 
	_ai_service_interval = _settings_game.vehicle.servint_ispercent ? 80 : 180;
 

	
 
	if (IsHumanPlayer(_current_player)) return;
 

	
src/ai/trolly/trolly.cpp
Show inline comments
 
@@ -130,9 +130,9 @@ static void AiNew_State_WakeUp(Player *p
 
			// Check all vehicles once in a while
 
			_players_ainew[p->index].action = AI_ACTION_CHECK_ALL_VEHICLES;
 
			_players_ainew[p->index].last_vehiclecheck_date = _date;
 
		} else if (c < 100 && !_settings.ai.ai_disable_veh_roadveh) {
 
		} else if (c < 100 && !_settings_game.ai.ai_disable_veh_roadveh) {
 
			// Do we have any spots for road-vehicles left open?
 
			if (GetFreeUnitNumber(VEH_ROAD) <= _settings.vehicle.max_roadveh) {
 
			if (GetFreeUnitNumber(VEH_ROAD) <= _settings_game.vehicle.max_roadveh) {
 
				if (c < 85) {
 
					_players_ainew[p->index].action = AI_ACTION_TRUCK_ROUTE;
 
				} else {
 
@@ -140,8 +140,8 @@ static void AiNew_State_WakeUp(Player *p
 
				}
 
			}
 
#if 0
 
		} else if (c < 200 && !_settings.ai.ai_disable_veh_train) {
 
			if (GetFreeUnitNumber(VEH_TRAIN) <= _settings.vehicle.max_trains) {
 
		} else if (c < 200 && !_settings_game.ai.ai_disable_veh_train) {
 
			if (GetFreeUnitNumber(VEH_TRAIN) <= _settings_game.vehicle.max_trains) {
 
				_players_ainew[p->index].action = AI_ACTION_TRAIN_ROUTE;
 
			}
 
#endif
 
@@ -155,7 +155,7 @@ static void AiNew_State_WakeUp(Player *p
 
		return;
 
	}
 

	
 
	if (_settings.ai.ai_disable_veh_roadveh && (
 
	if (_settings_game.ai.ai_disable_veh_roadveh && (
 
				_players_ainew[p->index].action == AI_ACTION_BUS_ROUTE ||
 
				_players_ainew[p->index].action == AI_ACTION_TRUCK_ROUTE
 
			)) {
 
@@ -179,7 +179,7 @@ static void AiNew_State_WakeUp(Player *p
 
	//  to build the route anyway..
 
	if (_players_ainew[p->index].action == AI_ACTION_BUS_ROUTE &&
 
			money > AI_MINIMUM_BUS_ROUTE_MONEY) {
 
		if (GetFreeUnitNumber(VEH_ROAD) > _settings.vehicle.max_roadveh) {
 
		if (GetFreeUnitNumber(VEH_ROAD) > _settings_game.vehicle.max_roadveh) {
 
			_players_ainew[p->index].action = AI_ACTION_NONE;
 
			return;
 
		}
 
@@ -190,7 +190,7 @@ static void AiNew_State_WakeUp(Player *p
 
	}
 
	if (_players_ainew[p->index].action == AI_ACTION_TRUCK_ROUTE &&
 
			money > AI_MINIMUM_TRUCK_ROUTE_MONEY) {
 
		if (GetFreeUnitNumber(VEH_ROAD) > _settings.vehicle.max_roadveh) {
 
		if (GetFreeUnitNumber(VEH_ROAD) > _settings_game.vehicle.max_roadveh) {
 
			_players_ainew[p->index].action = AI_ACTION_NONE;
 
			return;
 
		}
 
@@ -1017,7 +1017,7 @@ static void AiNew_State_BuildPath(Player
 
	if (_players_ainew[p->index].temp == -1) {
 
		DEBUG(ai, 1, "Starting to build new path");
 
		// Init the counter
 
		_players_ainew[p->index].counter = (4 - _settings.difficulty.competitor_speed) * AI_BUILDPATH_PAUSE + 1;
 
		_players_ainew[p->index].counter = (4 - _settings_game.difficulty.competitor_speed) * AI_BUILDPATH_PAUSE + 1;
 
		// Set the position to the startingplace (-1 because in a minute we do ++)
 
		_players_ainew[p->index].path_info.position = -1;
 
		// And don't do this again
 
@@ -1026,7 +1026,7 @@ static void AiNew_State_BuildPath(Player
 
	// Building goes very fast on normal rate, so we are going to slow it down..
 
	//  By let the counter count from AI_BUILDPATH_PAUSE to 0, we have a nice way :)
 
	if (--_players_ainew[p->index].counter != 0) return;
 
	_players_ainew[p->index].counter = (4 - _settings.difficulty.competitor_speed) * AI_BUILDPATH_PAUSE + 1;
 
	_players_ainew[p->index].counter = (4 - _settings_game.difficulty.competitor_speed) * AI_BUILDPATH_PAUSE + 1;
 

	
 
	// Increase the building position
 
	_players_ainew[p->index].path_info.position++;
 
@@ -1035,7 +1035,7 @@ static void AiNew_State_BuildPath(Player
 
	if (_players_ainew[p->index].path_info.position == -2) {
 
		// This means we are done building!
 

	
 
		if (_players_ainew[p->index].tbt == AI_TRUCK && !_settings.pf.roadveh_queue) {
 
		if (_players_ainew[p->index].tbt == AI_TRUCK && !_settings_game.pf.roadveh_queue) {
 
			// If they not queue, they have to go up and down to try again at a station...
 
			// We don't want that, so try building some road left or right of the station
 
			DiagDirection dir1, dir2, dir3;
 
@@ -1186,7 +1186,7 @@ static void AiNew_State_GiveOrders(Playe
 
	}
 

	
 
	// Very handy for AI, goto depot.. but yeah, it needs to be activated ;)
 
	if (_settings.order.gotodepot) {
 
	if (_settings_game.order.gotodepot) {
 
		idx = 0;
 
		order.MakeGoToDepot(GetDepotByTile(_players_ainew[p->index].depot_tile)->index, ODTFB_PART_OF_ORDERS);
 
		AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), order.Pack(), DC_EXEC, CMD_INSERT_ORDER);
src/aircraft_cmd.cpp
Show inline comments
 
@@ -287,7 +287,7 @@ CommandCost CmdBuildAircraft(TileIndex t
 
	}
 

	
 
	UnitID unit_num = HasBit(p2, 0) ? 0 : GetFreeUnitNumber(VEH_AIRCRAFT);
 
	if (unit_num > _settings.vehicle.max_aircraft)
 
	if (unit_num > _settings_game.vehicle.max_aircraft)
 
		return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
 

	
 
	if (flags & DC_EXEC) {
 
@@ -404,7 +404,7 @@ CommandCost CmdBuildAircraft(TileIndex t
 
		v->u.air.targetairport = GetStationIndex(tile);
 
		v->SetNext(u);
 

	
 
		v->service_interval = _settings.vehicle.servint_aircraft;
 
		v->service_interval = _settings_game.vehicle.servint_aircraft;
 

	
 
		v->date_of_last_service = _date;
 
		v->build_year = u->build_year = _cur_year;
 
@@ -664,7 +664,7 @@ CommandCost CmdRefitAircraft(TileIndex t
 

	
 
static void CheckIfAircraftNeedsService(Vehicle *v)
 
{
 
	if (_settings.vehicle.servint_aircraft == 0 || !v->NeedsAutomaticServicing()) return;
 
	if (_settings_game.vehicle.servint_aircraft == 0 || !v->NeedsAutomaticServicing()) return;
 
	if (v->IsInDepot()) {
 
		VehicleServiceInDepot(v);
 
		return;
 
@@ -884,7 +884,7 @@ static int UpdateAircraftSpeed(Vehicle *
 

	
 
	/* Adjust speed limits by plane speed factor to prevent taxiing
 
	 * and take-off speeds being too low. */
 
	speed_limit *= _settings.vehicle.plane_speed;
 
	speed_limit *= _settings_game.vehicle.plane_speed;
 

	
 
	if (v->u.air.cached_max_speed < speed_limit) {
 
		if (v->cur_speed < speed_limit) hard_limit = false;
 
@@ -902,7 +902,7 @@ static int UpdateAircraftSpeed(Vehicle *
 
	 * speeds to that aircraft do not get to taxi speed straight after
 
	 * touchdown. */
 
	if (!hard_limit && v->cur_speed > speed_limit) {
 
		speed_limit = v->cur_speed - max(1, ((v->cur_speed * v->cur_speed) / 16384) / _settings.vehicle.plane_speed);
 
		speed_limit = v->cur_speed - max(1, ((v->cur_speed * v->cur_speed) / 16384) / _settings_game.vehicle.plane_speed);
 
	}
 

	
 
	spd = min(v->cur_speed + (spd >> 8) + (v->subspeed < t), speed_limit);
 
@@ -913,12 +913,12 @@ static int UpdateAircraftSpeed(Vehicle *
 
	/* updates statusbar only if speed have changed to save CPU time */
 
	if (spd != v->cur_speed) {
 
		v->cur_speed = spd;
 
		if (_settings.gui.vehicle_speed)
 
		if (_settings_client.gui.vehicle_speed)
 
			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 
	}
 

	
 
	/* Adjust distance moved by plane speed setting */
 
	if (_settings.vehicle.plane_speed > 1) spd /= _settings.vehicle.plane_speed;
 
	if (_settings_game.vehicle.plane_speed > 1) spd /= _settings_game.vehicle.plane_speed;
 

	
 
	if (!(v->direction & 1)) spd = spd * 3 / 4;
 

	
 
@@ -1599,7 +1599,7 @@ static void AircraftEventHandler_AtTermi
 
		AircraftEventHandler_EnterTerminal(v, apc);
 
		/* on an airport with helipads, a helicopter will always land there
 
		 * and get serviced at the same time - patch setting */
 
		if (_settings.order.serviceathelipad) {
 
		if (_settings_game.order.serviceathelipad) {
 
			if (v->subtype == AIR_HELICOPTER && apc->helipads != NULL) {
 
				/* an exerpt of ServiceAircraft, without the invisibility stuff */
 
				v->date_of_last_service = _date;
src/airport.cpp
Show inline comments
 
@@ -477,7 +477,7 @@ uint32 GetValidAirports()
 
{
 
	uint32 mask = 0;
 

	
 
	if (_cur_year <  1960 || _settings.station.always_small_airport) SetBit(mask, 0);  // small airport
 
	if (_cur_year <  1960 || _settings_game.station.always_small_airport) SetBit(mask, 0);  // small airport
 
	if (_cur_year >= 1955) SetBit(mask, 1); // city airport
 
	if (_cur_year >= 1963) SetBit(mask, 2); // heliport
 
	if (_cur_year >= 1980) SetBit(mask, 3); // metropolitan airport
src/airport_gui.cpp
Show inline comments
 
@@ -70,12 +70,12 @@ struct BuildAirToolbarWindow : Window {
 
	BuildAirToolbarWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
 
	{
 
		this->FindWindowPlacementAndResize(desc);
 
		if (_settings.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
 
		if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
 
	}
 

	
 
	~BuildAirToolbarWindow()
 
	{
 
		if (_settings.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
 
		if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
 
	}
 

	
 
	virtual void OnPaint()
 
@@ -178,7 +178,7 @@ public:
 
		this->SetWidgetLoweredState(BAW_BTN_DOHILIGHT, _station_show_coverage);
 
		this->LowerWidget(_selected_airport_type + BAW_SMALL_AIRPORT);
 

	
 
		if (_settings.economy.station_noise_level) {
 
		if (_settings_game.economy.station_noise_level) {
 
			ResizeWindowForWidget(this, BAW_BOTTOMPANEL, 0, 10);
 
		}
 

	
 
@@ -211,14 +211,14 @@ public:
 
		airport = GetAirport(_selected_airport_type);
 
		SetTileSelectSize(airport->size_x, airport->size_y);
 

	
 
		int rad = _settings.station.modified_catchment ? airport->catchment : (uint)CA_UNMODIFIED;
 
		int rad = _settings_game.station.modified_catchment ? airport->catchment : (uint)CA_UNMODIFIED;
 

	
 
		if (_station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
 

	
 
		this->DrawWidgets();
 

	
 
		/* only show the station (airport) noise, if the noise option is activated */
 
		if (_settings.economy.station_noise_level) {
 
		if (_settings_game.economy.station_noise_level) {
 
			/* show the noise of the selected airport */
 
			SetDParam(0, airport->noise_level);
 
			DrawString(2, 206, STR_STATION_NOISE, 0);
src/autoslope.h
Show inline comments
 
@@ -38,7 +38,7 @@ static inline bool AutoslopeCheckForEntr
 
 */
 
static inline bool AutoslopeEnabled()
 
{
 
	return (_settings.construction.autoslope &&
 
	return (_settings_game.construction.autoslope &&
 
	        ((IsValidPlayer(_current_player) && !_is_old_ai_player) ||
 
	         (_current_player == OWNER_NONE && _game_mode == GM_EDITOR)));
 
}
src/build_vehicle_gui.cpp
Show inline comments
 
@@ -507,7 +507,7 @@ static int DrawRailWagonPurchaseInfo(int
 
	y += 10;
 

	
 
	/* Wagon speed limit, displayed if above zero */
 
	if (_settings.vehicle.wagon_speed_limits) {
 
	if (_settings_game.vehicle.wagon_speed_limits) {
 
		uint max_speed = GetEngineProperty(engine_number, 0x09, rvi->max_speed);
 
		if (max_speed > 0) {
 
			SetDParam(0, max_speed * 10 / 16);
 
@@ -545,7 +545,7 @@ static int DrawRailEnginePurchaseInfo(in
 
	y += 10;
 

	
 
	/* Max tractive effort - not applicable if old acceleration or maglev */
 
	if (_settings.vehicle.realistic_acceleration && rvi->railtype != RAILTYPE_MAGLEV) {
 
	if (_settings_game.vehicle.realistic_acceleration && rvi->railtype != RAILTYPE_MAGLEV) {
 
		SetDParam(0, ((weight << multihead) * 10 * GetEngineProperty(engine_number, 0x1F, rvi->tractive_effort)) / 256);
 
		DrawString(x, y, STR_PURCHASE_INFO_MAX_TE, TC_FROMSTRING);
 
		y += 10;
src/cheat_gui.cpp
Show inline comments
 
@@ -64,9 +64,9 @@ static int32 ClickChangeClimateCheat(int
 
{
 
	if (p1 == -1) p1 = 3;
 
	if (p1 ==  4) p1 = 0;
 
	_settings.game_creation.landscape = p1;
 
	_settings_game.game_creation.landscape = p1;
 
	ReloadNewGRFData();
 
	return _settings.game_creation.landscape;
 
	return _settings_game.game_creation.landscape;
 
}
 

	
 
extern void EnginesMonthlyLoop();
 
@@ -107,7 +107,7 @@ static const CheatEntry _cheats_ui[] = {
 
	{SLE_BOOL,  STR_CHEAT_BUILD_IN_PAUSE,  &_cheats.build_in_pause.value,      &_cheats.build_in_pause.been_used,   NULL                    },
 
	{SLE_BOOL,  STR_CHEAT_NO_JETCRASH,     &_cheats.no_jetcrash.value,         &_cheats.no_jetcrash.been_used,      NULL                    },
 
	{SLE_BOOL,  STR_CHEAT_SETUP_PROD,      &_cheats.setup_prod.value,          &_cheats.setup_prod.been_used,       NULL                    },
 
	{SLE_UINT8, STR_CHEAT_SWITCH_CLIMATE,  &_settings.game_creation.landscape, &_cheats.switch_climate.been_used,   &ClickChangeClimateCheat},
 
	{SLE_UINT8, STR_CHEAT_SWITCH_CLIMATE,  &_settings_game.game_creation.landscape, &_cheats.switch_climate.been_used,   &ClickChangeClimateCheat},
 
	{SLE_INT32, STR_CHEAT_CHANGE_DATE,     &_cur_year,                         &_cheats.change_date.been_used,      &ClickChangeDateCheat   },
 
};
 

	
src/clear_cmd.cpp
Show inline comments
 
@@ -218,7 +218,7 @@ static void TileLoop_Clear(TileIndex til
 
{
 
	TileLoopClearHelper(tile);
 

	
 
	switch (_settings.game_creation.landscape) {
 
	switch (_settings_game.game_creation.landscape) {
 
		case LT_TROPIC: TileLoopClearDesert(tile); break;
 
		case LT_ARCTIC: TileLoopClearAlps(tile);   break;
 
	}
 
@@ -346,7 +346,7 @@ static void ChangeTileOwner_Clear(TileIn
 

	
 
void InitializeClearLand()
 
{
 
	_settings.game_creation.snow_line = _settings.game_creation.snow_line_height * TILE_HEIGHT;
 
	_settings_game.game_creation.snow_line = _settings_game.game_creation.snow_line_height * TILE_HEIGHT;
 
}
 

	
 
static CommandCost TerraformTile_Clear(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
src/console_cmds.cpp
Show inline comments
 
@@ -926,8 +926,8 @@ DEF_CONSOLE_CMD(ConRestart)
 
	}
 

	
 
	/* Don't copy the _newgame pointers to the real pointers, so call SwitchMode directly */
 
	_settings.game_creation.map_x = MapLogX();
 
	_settings.game_creation.map_y = FindFirstBit(MapSizeY());
 
	_settings_game.game_creation.map_x = MapLogX();
 
	_settings_game.game_creation.map_y = FindFirstBit(MapSizeY());
 
	SwitchMode(SM_NEWGAME);
 
	return true;
 
}
 
@@ -940,7 +940,7 @@ DEF_CONSOLE_CMD(ConGetSeed)
 
		return true;
 
	}
 

	
 
	IConsolePrintF(CC_DEFAULT, "Generation Seed: %u", _settings.game_creation.generation_seed);
 
	IConsolePrintF(CC_DEFAULT, "Generation Seed: %u", _settings_game.game_creation.generation_seed);
 
	return true;
 
}
 

	
 
@@ -1083,7 +1083,7 @@ DEF_CONSOLE_CMD(ConExit)
 
		return true;
 
	}
 

	
 
	if (_game_mode == GM_NORMAL && _settings.gui.autosave_on_exit) DoExitSave();
 
	if (_game_mode == GM_NORMAL && _settings_client.gui.autosave_on_exit) DoExitSave();
 

	
 
	_exit_game = true;
 
	return true;
src/currency.cpp
Show inline comments
 
@@ -150,10 +150,10 @@ uint GetMaskOfAllowedCurrencies()
 
 **/
 
void CheckSwitchToEuro()
 
{
 
	if (_currency_specs[_settings.gui.currency].to_euro != CF_NOEURO &&
 
			_currency_specs[_settings.gui.currency].to_euro != CF_ISEURO &&
 
			_cur_year >= _currency_specs[_settings.gui.currency].to_euro) {
 
		_settings.gui.currency = 2; // this is the index of euro above.
 
	if (_currency_specs[_settings_client.gui.currency].to_euro != CF_NOEURO &&
 
			_currency_specs[_settings_client.gui.currency].to_euro != CF_ISEURO &&
 
			_cur_year >= _currency_specs[_settings_client.gui.currency].to_euro) {
 
		_settings_client.gui.currency = 2; // this is the index of euro above.
 
		AddNewsItem(STR_EURO_INTRODUCE, NS_ECONOMY, 0, 0);
 
	}
 
}
src/currency.h
Show inline comments
 
@@ -39,7 +39,7 @@ extern CurrencySpec _currency_specs[NUM_
 

	
 
// XXX small hack, but makes the rest of the code a bit nicer to read
 
#define _custom_currency (_currency_specs[CUSTOM_CURRENCY_ID])
 
#define _currency ((const CurrencySpec*)&_currency_specs[(_game_mode == GM_MENU) ? _settings_newgame.gui.currency : _settings.gui.currency])
 
#define _currency ((const CurrencySpec*)&_currency_specs[_settings_client.gui.currency])
 

	
 
uint GetMaskOfAllowedCurrencies();
 
void CheckSwitchToEuro();
src/date.cpp
Show inline comments
 
@@ -257,7 +257,7 @@ void IncreaseDate()
 
		SaveOrLoad(name, SL_SAVE, AUTOSAVE_DIR);
 
		DebugDumpCommands("ddc:save:%s\n", name);
 
#endif /* DUMP_COMMANDS */
 
		if (_settings.gui.autosave != 0 && (_cur_month % _autosave_months[_settings.gui.autosave]) == 0) {
 
		if (_settings_client.gui.autosave != 0 && (_cur_month % _autosave_months[_settings_client.gui.autosave]) == 0) {
 
			_do_autosave = true;
 
			RedrawAutosave();
 
		}
 
@@ -283,10 +283,10 @@ void IncreaseDate()
 
	ShipsYearlyLoop();
 
	if (_network_server) NetworkServerYearlyLoop();
 

	
 
	if (_cur_year == _settings.gui.semaphore_build_before) ResetSignalVariant();
 
	if (_cur_year == _settings_client.gui.semaphore_build_before) ResetSignalVariant();
 

	
 
	/* check if we reached end of the game */
 
	if (_cur_year == _settings.gui.ending_year) {
 
	if (_cur_year == _settings_client.gui.ending_year) {
 
			ShowEndGameChart();
 
	/* check if we reached the maximum year, decrement dates by a year */
 
	} else if (_cur_year == MAX_YEAR + 1) {
 
@@ -303,5 +303,5 @@ void IncreaseDate()
 
		InitChatMessage();
 
	}
 

	
 
	if (_settings.gui.auto_euro) CheckSwitchToEuro();
 
	if (_settings_client.gui.auto_euro) CheckSwitchToEuro();
 
}
src/disaster_cmd.cpp
Show inline comments
 
@@ -1050,7 +1050,7 @@ void DisasterDailyLoop()
 

	
 
	ResetDisasterDelay();
 

	
 
	if (_settings.difficulty.disasters != 0) DoDisaster();
 
	if (_settings_game.difficulty.disasters != 0) DoDisaster();
 
}
 

	
 
void StartupDisasters()
src/dock_gui.cpp
Show inline comments
 
@@ -136,12 +136,12 @@ struct BuildDocksToolbarWindow : Window 
 
	BuildDocksToolbarWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
 
	{
 
		this->FindWindowPlacementAndResize(desc);
 
		if (_settings.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
 
		if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
 
	}
 

	
 
	~BuildDocksToolbarWindow()
 
	{
 
		if (_settings.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
 
		if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
 
	}
 

	
 
	virtual void OnPaint()
 
@@ -263,7 +263,7 @@ public:
 

	
 
	virtual void OnPaint()
 
	{
 
		int rad = (_settings.station.modified_catchment) ? CA_DOCK : CA_UNMODIFIED;
 
		int rad = (_settings_game.station.modified_catchment) ? CA_DOCK : CA_UNMODIFIED;
 

	
 
		this->DrawWidgets();
 

	
src/economy.cpp
Show inline comments
 
@@ -654,7 +654,7 @@ static void AddInflation()
 
	 * inflation doesn't add anything after that either; it even makes playing
 
	 * it impossible due to the diverging cost and income rates.
 
	 */
 
	if ((_cur_year - _settings.game_creation.starting_year) >= (ORIGINAL_MAX_YEAR - ORIGINAL_BASE_YEAR)) return;
 
	if ((_cur_year - _settings_game.game_creation.starting_year) >= (ORIGINAL_MAX_YEAR - ORIGINAL_BASE_YEAR)) return;
 

	
 
	/* Approximation for (100 + infl_amount)% ** (1 / 12) - 100%
 
	 * scaled by 65536
 
@@ -704,7 +704,7 @@ static void PlayersPayInterest()
 

	
 
static void HandleEconomyFluctuations()
 
{
 
	if (_settings.difficulty.economy == 0) return;
 
	if (_settings_game.difficulty.economy == 0) return;
 

	
 
	if (--_economy.fluct == 0) {
 
		_economy.fluct = -(int)GB(Random(), 0, 2);
 
@@ -813,7 +813,7 @@ void StartupEconomy()
 
	for (i = 0; i != NUM_PRICES; i++) {
 
		Money price = _price_base[i];
 
		if (_price_category[i] != 0) {
 
			uint mod = _price_category[i] == 1 ? _settings.difficulty.vehicle_costs : _settings.difficulty.construction_cost;
 
			uint mod = _price_category[i] == 1 ? _settings_game.difficulty.vehicle_costs : _settings_game.difficulty.construction_cost;
 
			if (mod < 1) {
 
				price = price * 3 >> 2;
 
			} else if (mod > 1) {
 
@@ -829,10 +829,10 @@ void StartupEconomy()
 
		_price_frac[i] = 0;
 
	}
 

	
 
	_economy.interest_rate = _settings.difficulty.initial_interest;
 
	_economy.infl_amount = _settings.difficulty.initial_interest;
 
	_economy.infl_amount_pr = max(0, _settings.difficulty.initial_interest - 1);
 
	_economy.max_loan_unround = _economy.max_loan = _settings.difficulty.max_loan;
 
	_economy.interest_rate = _settings_game.difficulty.initial_interest;
 
	_economy.infl_amount = _settings_game.difficulty.initial_interest;
 
	_economy.infl_amount_pr = max(0, _settings_game.difficulty.initial_interest - 1);
 
	_economy.max_loan_unround = _economy.max_loan = _settings_game.difficulty.max_loan;
 
	_economy.fluct = GB(Random(), 0, 8) + 168;
 
}
 

	
 
@@ -1162,7 +1162,7 @@ Money GetTransportedGoodsIncome(uint num
 
	}
 

	
 
	/* zero the distance (thus income) if it's the bank and very short transport. */
 
	if (_settings.game_creation.landscape == LT_TEMPERATE && cs->label == 'VALU' && dist < 10) return 0;
 
	if (_settings_game.game_creation.landscape == LT_TEMPERATE && cs->label == 'VALU' && dist < 10) return 0;
 

	
 

	
 
	static const int MIN_TIME_FACTOR = 31;
 
@@ -1208,7 +1208,7 @@ static void DeliverGoodsToIndustry(TileI
 
	 * XXX - Think of something better to
 
	 *       1) Only deliver to industries which are withing the catchment radius
 
	 *       2) Distribute between industries if more then one is present */
 
	best_dist = (_settings.station.station_spread + 8) * 2;
 
	best_dist = (_settings_game.station.station_spread + 8) * 2;
 
	FOR_ALL_INDUSTRIES(ind) {
 
		indspec = GetIndustrySpec(ind->type);
 
		uint i;
 
@@ -1313,7 +1313,7 @@ static bool CheckSubsidised(Station *fro
 

	
 
			SetDParam(0, _current_player);
 
			AddNewsItem(
 
				STR_2031_SERVICE_SUBSIDY_AWARDED + _settings.difficulty.subsidy_multiplier,
 
				STR_2031_SERVICE_SUBSIDY_AWARDED + _settings_game.difficulty.subsidy_multiplier,
 
				NS_SUBSIDIES,
 
				pair.a, pair.b
 
			);
 
@@ -1360,7 +1360,7 @@ static Money DeliverGoods(int num_pieces
 

	
 
	/* Modify profit if a subsidy is in effect */
 
	if (subsidised) {
 
		switch (_settings.difficulty.subsidy_multiplier) {
 
		switch (_settings_game.difficulty.subsidy_multiplier) {
 
			case 0:  profit += profit >> 1; break;
 
			case 1:  profit *= 2; break;
 
			case 2:  profit *= 3; break;
 
@@ -1481,7 +1481,7 @@ static void LoadUnloadVehicle(Vehicle *v
 

	
 
	/* We have not waited enough time till the next round of loading/unloading */
 
	if (--v->load_unload_time_rem != 0) {
 
		if (_settings.order.improved_load && (v->current_order.GetLoadType() & OLFB_FULL_LOAD)) {
 
		if (_settings_game.order.improved_load && (v->current_order.GetLoadType() & OLFB_FULL_LOAD)) {
 
			/* 'Reserve' this cargo for this vehicle, because we were first. */
 
			for (; v != NULL; v = v->Next()) {
 
				if (v->cargo_cap != 0) cargo_left[v->cargo_type] -= v->cargo_cap - v->cargo.Count();
 
@@ -1517,7 +1517,7 @@ static void LoadUnloadVehicle(Vehicle *v
 
		if (v->cargo_cap == 0) continue;
 

	
 
		byte load_amount = EngInfo(v->engine_type)->load_amount;
 
		if (_settings.order.gradual_loading && HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_LOAD_AMOUNT)) {
 
		if (_settings_game.order.gradual_loading && HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_LOAD_AMOUNT)) {
 
			uint16 cb_load_amount = GetVehicleCallback(CBID_VEHICLE_LOAD_AMOUNT, 0, 0, v->engine_type, v);
 
			if (cb_load_amount != CALLBACK_FAILED && GB(cb_load_amount, 0, 8) != 0) load_amount = GB(cb_load_amount, 0, 8);
 
		}
 
@@ -1526,7 +1526,7 @@ static void LoadUnloadVehicle(Vehicle *v
 

	
 
		if (HasBit(v->vehicle_flags, VF_CARGO_UNLOADING) && (u->current_order.GetUnloadType() & OUFB_NO_UNLOAD) == 0) {
 
			uint cargo_count = v->cargo.Count();
 
			uint amount_unloaded = _settings.order.gradual_loading ? min(cargo_count, load_amount) : cargo_count;
 
			uint amount_unloaded = _settings_game.order.gradual_loading ? min(cargo_count, load_amount) : cargo_count;
 
			bool remaining; // Are there cargo entities in this vehicle that can still be unloaded here?
 

	
 
			if (HasBit(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE) && !(u->current_order.GetUnloadType() & OUFB_TRANSFER)) {
 
@@ -1552,7 +1552,7 @@ static void LoadUnloadVehicle(Vehicle *v
 
			unloading_time += amount_unloaded;
 

	
 
			anything_unloaded = true;
 
			if (_settings.order.gradual_loading && remaining) {
 
			if (_settings_game.order.gradual_loading && remaining) {
 
				completely_emptied = false;
 
			} else {
 
				/* We have finished unloading (cargo count == 0) */
 
@@ -1586,14 +1586,14 @@ static void LoadUnloadVehicle(Vehicle *v
 

	
 
			/* Skip loading this vehicle if another train/vehicle is already handling
 
			 * the same cargo type at this station */
 
			if (_settings.order.improved_load && cargo_left[v->cargo_type] <= 0) {
 
			if (_settings_game.order.improved_load && cargo_left[v->cargo_type] <= 0) {
 
				SetBit(cargo_not_full, v->cargo_type);
 
				continue;
 
			}
 

	
 
			if (cap > count) cap = count;
 
			if (_settings.order.gradual_loading) cap = min(cap, load_amount);
 
			if (_settings.order.improved_load) {
 
			if (_settings_game.order.gradual_loading) cap = min(cap, load_amount);
 
			if (_settings_game.order.improved_load) {
 
				/* Don't load stuff that is already 'reserved' for other vehicles */
 
				cap = min((uint)cargo_left[v->cargo_type], cap);
 
				cargo_left[v->cargo_type] -= cap;
 
@@ -1637,7 +1637,7 @@ static void LoadUnloadVehicle(Vehicle *v
 
	 * all wagons at the same time instead of using the same 'improved'
 
	 * loading algorithm for the wagons (only fill wagon when there is
 
	 * enough to fill the previous wagons) */
 
	if (_settings.order.improved_load && (u->current_order.GetLoadType() & OLFB_FULL_LOAD)) {
 
	if (_settings_game.order.improved_load && (u->current_order.GetLoadType() & OLFB_FULL_LOAD)) {
 
		/* Update left cargo */
 
		for (v = u; v != NULL; v = v->Next()) {
 
			if (v->cargo_cap != 0) cargo_left[v->cargo_type] -= v->cargo_cap - v->cargo.Count();
 
@@ -1647,7 +1647,7 @@ static void LoadUnloadVehicle(Vehicle *v
 
	v = u;
 

	
 
	if (anything_loaded || anything_unloaded) {
 
		if (_settings.order.gradual_loading) {
 
		if (_settings_game.order.gradual_loading) {
 
			/* The time it takes to load one 'slice' of cargo or passengers depends
 
			* on the vehicle type - the values here are those found in TTDPatch */
 
			const uint gradual_loading_wait_time[] = { 40, 20, 10, 20 };
 
@@ -1684,11 +1684,11 @@ static void LoadUnloadVehicle(Vehicle *v
 

	
 
	/* Calculate the loading indicator fill percent and display
 
	 * In the Game Menu do not display indicators
 
	 * If _settings.gui.loading_indicators == 2, show indicators (bool can be promoted to int as 0 or 1 - results in 2 > 0,1 )
 
	 * if _settings.gui.loading_indicators == 1, _local_player must be the owner or must be a spectator to show ind., so 1 > 0
 
	 * if _settings.gui.loading_indicators == 0, do not display indicators ... 0 is never greater than anything
 
	 * If _settings_client.gui.loading_indicators == 2, show indicators (bool can be promoted to int as 0 or 1 - results in 2 > 0,1 )
 
	 * if _settings_client.gui.loading_indicators == 1, _local_player must be the owner or must be a spectator to show ind., so 1 > 0
 
	 * if _settings_client.gui.loading_indicators == 0, do not display indicators ... 0 is never greater than anything
 
	 */
 
	if (_game_mode != GM_MENU && (_settings.gui.loading_indicators > (uint)(v->owner != _local_player && _local_player != PLAYER_SPECTATOR))) {
 
	if (_game_mode != GM_MENU && (_settings_client.gui.loading_indicators > (uint)(v->owner != _local_player && _local_player != PLAYER_SPECTATOR))) {
 
		StringID percent_up_down = STR_NULL;
 
		int percent = CalcPercentVehicleFilled(v, &percent_up_down);
 
		if (v->fill_percent_te_id == INVALID_TE_ID) {
 
@@ -1736,7 +1736,7 @@ void LoadUnloadStation(Station *st)
 
void PlayersMonthlyLoop()
 
{
 
	PlayersGenStatistics();
 
	if (_settings.economy.inflation && _cur_year < MAX_YEAR)
 
	if (_settings_game.economy.inflation && _cur_year < MAX_YEAR)
 
		AddInflation();
 
	PlayersPayInterest();
 
	/* Reset the _current_player flag */
 
@@ -1802,7 +1802,7 @@ CommandCost CmdBuyShareInCompany(TileInd
 

	
 
	/* Check if buying shares is allowed (protection against modified clients) */
 
	/* Cannot buy own shares */
 
	if (!IsValidPlayer((PlayerID)p1) || !_settings.economy.allow_shares || _current_player == (PlayerID)p1) return CMD_ERROR;
 
	if (!IsValidPlayer((PlayerID)p1) || !_settings_game.economy.allow_shares || _current_player == (PlayerID)p1) return CMD_ERROR;
 

	
 
	p = GetPlayer((PlayerID)p1);
 

	
 
@@ -1851,7 +1851,7 @@ CommandCost CmdSellShareInCompany(TileIn
 

	
 
	/* Check if selling shares is allowed (protection against modified clients) */
 
	/* Cannot sell own shares */
 
	if (!IsValidPlayer((PlayerID)p1) || !_settings.economy.allow_shares || _current_player == (PlayerID)p1) return CMD_ERROR;
 
	if (!IsValidPlayer((PlayerID)p1) || !_settings_game.economy.allow_shares || _current_player == (PlayerID)p1) return CMD_ERROR;
 

	
 
	p = GetPlayer((PlayerID)p1);
 

	
src/elrail_func.h
Show inline comments
 
@@ -25,7 +25,7 @@ static inline bool HasCatenary(RailType 
 
 */
 
static inline bool HasCatenaryDrawn(RailType rt)
 
{
 
	return HasCatenary(rt) && !IsInvisibilitySet(TO_CATENARY) && !_settings.vehicle.disable_elrails;
 
	return HasCatenary(rt) && !IsInvisibilitySet(TO_CATENARY) && !_settings_game.vehicle.disable_elrails;
 
}
 

	
 
/**
 
@@ -37,6 +37,6 @@ void DrawCatenary(const TileInfo *ti);
 
void DrawCatenaryOnTunnel(const TileInfo *ti);
 
void DrawCatenaryOnBridge(const TileInfo *ti);
 

	
 
int32 SettingsDisableElrail(int32 p1); ///< _settings.disable_elrail callback
 
int32 SettingsDisableElrail(int32 p1); ///< _settings_game.disable_elrail callback
 

	
 
#endif /* ELRAIL_FUNC_H */
src/engine.cpp
Show inline comments
 
@@ -189,7 +189,7 @@ static void CalcEngineReliability(Engine
 
	uint age = e->age;
 

	
 
	/* Check for early retirement */
 
	if (e->player_avail != 0 && !_settings.vehicle.never_expire_vehicles) {
 
	if (e->player_avail != 0 && !_settings_game.vehicle.never_expire_vehicles) {
 
		int retire_early = e->info.retire_early;
 
		uint retire_early_max_age = max(0, e->duration_phase_1 + e->duration_phase_2 - retire_early * 12);
 
		if (retire_early != 0 && age >= retire_early_max_age) {
 
@@ -202,7 +202,7 @@ static void CalcEngineReliability(Engine
 
	if (age < e->duration_phase_1) {
 
		uint start = e->reliability_start;
 
		e->reliability = age * (e->reliability_max - start) / e->duration_phase_1 + start;
 
	} else if ((age -= e->duration_phase_1) < e->duration_phase_2 || _settings.vehicle.never_expire_vehicles) {
 
	} else if ((age -= e->duration_phase_1) < e->duration_phase_2 || _settings_game.vehicle.never_expire_vehicles) {
 
		/* We are at the peak of this engines life. It will have max reliability.
 
		 * This is also true if the engines never expire. They will not go bad over time */
 
		e->reliability = e->reliability_max;
 
@@ -265,10 +265,10 @@ void StartupEngines()
 
			CalcEngineReliability(e);
 
		}
 

	
 
		e->lifelength = ei->lifelength + _settings.vehicle.extend_vehicle_life;
 
		e->lifelength = ei->lifelength + _settings_game.vehicle.extend_vehicle_life;
 

	
 
		/* prevent certain engines from ever appearing. */
 
		if (!HasBit(ei->climates, _settings.game_creation.landscape)) {
 
		if (!HasBit(ei->climates, _settings_game.game_creation.landscape)) {
 
			e->flags |= ENGINE_AVAILABLE;
 
			e->player_avail = 0;
 
		}
src/genworld.cpp
Show inline comments
 
@@ -91,8 +91,8 @@ static void * CDECL _GenerateWorld(void 
 
		_generating_world = true;
 
		if (_network_dedicated) DEBUG(net, 0, "Generating map, please wait...");
 
		/* Set the Random() seed to generation_seed so we produce the same map with the same seed */
 
		if (_settings.game_creation.generation_seed == GENERATE_NEW_SEED) _settings.game_creation.generation_seed = _settings_newgame.game_creation.generation_seed = InteractiveRandom();
 
		_random.SetSeed(_settings.game_creation.generation_seed);
 
		if (_settings_game.game_creation.generation_seed == GENERATE_NEW_SEED) _settings_game.game_creation.generation_seed = _settings_newgame.game_creation.generation_seed = InteractiveRandom();
 
		_random.SetSeed(_settings_game.game_creation.generation_seed);
 
		SetGeneratingWorldProgress(GWP_MAP_INIT, 2);
 
		SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, VHM_NONE, WC_MAIN_WINDOW, 0);
 

	
 
@@ -105,7 +105,7 @@ static void * CDECL _GenerateWorld(void 
 
			SetGeneratingWorldProgress(GWP_UNMOVABLE, 1);
 

	
 
			/* Make the map the height of the patch setting */
 
			if (_game_mode != GM_MENU) FlatEmptyWorld(_settings.game_creation.se_flat_world_height);
 
			if (_game_mode != GM_MENU) FlatEmptyWorld(_settings_game.game_creation.se_flat_world_height);
 

	
 
			ConvertGroundTilesIntoWaterTiles();
 
			IncreaseGeneratingWorldProgress(GWP_UNMOVABLE);
 
@@ -165,7 +165,7 @@ static void * CDECL _GenerateWorld(void 
 

	
 
		if (_network_dedicated) DEBUG(net, 0, "Map generated, starting game");
 

	
 
		if (_settings.gui.pause_on_newgame && _game_mode == GM_NORMAL) DoCommandP(0, 1, 0, NULL, CMD_PAUSE);
 
		if (_settings_client.gui.pause_on_newgame && _game_mode == GM_NORMAL) DoCommandP(0, 1, 0, NULL, CMD_PAUSE);
 
	} catch (...) {
 
		_generating_world = false;
 
		throw;
 
@@ -273,7 +273,7 @@ void GenerateWorld(GenerateWorldMode mod
 
	_current_player = OWNER_NONE;
 

	
 
	/* Set the date before loading sprites as some newgrfs check it */
 
	SetDate(ConvertYMDToDate(_settings.game_creation.starting_year, 0, 1));
 
	SetDate(ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1));
 

	
 
	/* Load the right landscape stuff */
 
	GfxLoadSprites();
src/genworld_gui.cpp
Show inline comments
 
@@ -205,7 +205,7 @@ void StartGeneratingLandscape(glwp_modes
 
	DeleteAllNonVitalWindows();
 

	
 
	/* Copy all XXX_newgame to XXX when coming from outside the editor */
 
	_settings = _settings_newgame;
 
	_settings_game = _settings_newgame;
 
	ResetGRFConfig(true);
 

	
 
	SndPlayFx(SND_15_BEEP);
 
@@ -377,9 +377,9 @@ struct GenerateLandscapeWindow : public 
 
				break;
 

	
 
			case GLAND_GENERATE_BUTTON: // Generate
 
				_settings = _settings_newgame;
 
				_settings_game = _settings_newgame;
 

	
 
				if (_settings.economy.town_layout == TL_NO_ROADS) {
 
				if (_settings_game.economy.town_layout == TL_NO_ROADS) {
 
					ShowQuery(
 
						STR_TOWN_LAYOUT_WARNING_CAPTION,
 
						STR_TOWN_LAYOUT_WARNING_MESSAGE,
src/gfx.cpp
Show inline comments
 
@@ -807,7 +807,7 @@ void DoPaletteAnimations()
 
	memcpy(old_val, d, c * sizeof(*old_val));
 

	
 
	/* Dark blue water */
 
	s = (_settings.game_creation.landscape == LT_TOYLAND) ? ev->ac : ev->a;
 
	s = (_settings_game.game_creation.landscape == LT_TOYLAND) ? ev->ac : ev->a;
 
	j = EXTR(320, 5);
 
	for (i = 0; i != 5; i++) {
 
		*d++ = s[j];
 
@@ -816,7 +816,7 @@ void DoPaletteAnimations()
 
	}
 

	
 
	/* Glittery water */
 
	s = (_settings.game_creation.landscape == LT_TOYLAND) ? ev->bc : ev->b;
 
	s = (_settings_game.game_creation.landscape == LT_TOYLAND) ? ev->bc : ev->b;
 
	j = EXTR(128, 15);
 
	for (i = 0; i != 5; i++) {
 
		*d++ = s[j];
 
@@ -876,7 +876,7 @@ void DoPaletteAnimations()
 
	/* Animate water for old DOS graphics */
 
	if (_use_dos_palette) {
 
		/* Dark blue water DOS */
 
		s = (_settings.game_creation.landscape == LT_TOYLAND) ? ev->ac : ev->a;
 
		s = (_settings_game.game_creation.landscape == LT_TOYLAND) ? ev->ac : ev->a;
 
		j = EXTR(320, 5);
 
		for (i = 0; i != 5; i++) {
 
			*d++ = s[j];
 
@@ -885,7 +885,7 @@ void DoPaletteAnimations()
 
		}
 

	
 
		/* Glittery water DOS */
 
		s = (_settings.game_creation.landscape == LT_TOYLAND) ? ev->bc : ev->b;
 
		s = (_settings_game.game_creation.landscape == LT_TOYLAND) ? ev->bc : ev->b;
 
		j = EXTR(128, 15);
 
		for (i = 0; i != 5; i++) {
 
			*d++ = s[j];
src/gfxinit.cpp
Show inline comments
 
@@ -214,10 +214,10 @@ static void LoadSpriteTables()
 
	 * This overwrites some of the temperate sprites, such as foundations
 
	 * and the ground sprites.
 
	 */
 
	if (_settings.game_creation.landscape != LT_TEMPERATE) {
 
	if (_settings_game.game_creation.landscape != LT_TEMPERATE) {
 
		LoadGrfIndexed(
 
			files->landscape[_settings.game_creation.landscape - 1].filename,
 
			_landscape_spriteindexes[_settings.game_creation.landscape - 1],
 
			files->landscape[_settings_game.game_creation.landscape - 1].filename,
 
			_landscape_spriteindexes[_settings_game.game_creation.landscape - 1],
 
			i++
 
		);
 
	}
 
@@ -248,7 +248,7 @@ static void LoadSpriteTables()
 

	
 
void GfxLoadSprites()
 
{
 
	DEBUG(sprite, 2, "Loading sprite set %d", _settings.game_creation.landscape);
 
	DEBUG(sprite, 2, "Loading sprite set %d", _settings_game.game_creation.landscape);
 

	
 
	GfxInitSpriteMem();
 
	LoadSpriteTables();
src/heightmap.cpp
Show inline comments
 
@@ -297,7 +297,7 @@ static void GrayscaleToMapHeights(uint i
 
	TileIndex tile;
 

	
 
	/* Get map size and calculate scale and padding values */
 
	switch (_settings.game_creation.heightmap_rotation) {
 
	switch (_settings_game.game_creation.heightmap_rotation) {
 
		default: NOT_REACHED();
 
		case HM_COUNTER_CLOCKWISE:
 
			width   = MapSizeX();
 
@@ -322,7 +322,7 @@ static void GrayscaleToMapHeights(uint i
 
	/* Form the landscape */
 
	for (row = 0; row < height - 1; row++) {
 
		for (col = 0; col < width - 1; col++) {
 
			switch (_settings.game_creation.heightmap_rotation) {
 
			switch (_settings_game.game_creation.heightmap_rotation) {
 
				default: NOT_REACHED();
 
				case HM_COUNTER_CLOCKWISE: tile = TileXY(col, row); break;
 
				case HM_CLOCKWISE:         tile = TileXY(row, col); break;
 
@@ -337,7 +337,7 @@ static void GrayscaleToMapHeights(uint i
 
				/* Use nearest neighbor resizing to scale map data.
 
				 *  We rotate the map 45 degrees (counter)clockwise */
 
				img_row = (((row - row_pad) * num_div) / img_scale);
 
				switch (_settings.game_creation.heightmap_rotation) {
 
				switch (_settings_game.game_creation.heightmap_rotation) {
 
					default: NOT_REACHED();
 
					case HM_COUNTER_CLOCKWISE:
 
						img_col = (((width - 1 - col - col_pad) * num_div) / img_scale);
src/industry_cmd.cpp
Show inline comments
 
@@ -70,7 +70,7 @@ void ResetIndustries()
 
	/* once performed, enable only the current climate industries */
 
	for (IndustryType i = 0; i < NUM_INDUSTRYTYPES; i++) {
 
		_industry_specs[i].enabled = i < NEW_INDUSTRYOFFSET &&
 
				HasBit(_origin_industry_specs[i].climate_availability, _settings.game_creation.landscape);
 
				HasBit(_origin_industry_specs[i].climate_availability, _settings_game.game_creation.landscape);
 
	}
 

	
 
	memset(&_industry_tile_specs, 0, sizeof(_industry_tile_specs));
 
@@ -84,7 +84,7 @@ void ResetIndustries()
 
void ResetIndustryCreationProbility(IndustryType type)
 
{
 
	assert(type < INVALID_INDUSTRYTYPE);
 
	_industry_specs[type].appear_creation[_settings.game_creation.landscape] = 0;
 
	_industry_specs[type].appear_creation[_settings_game.game_creation.landscape] = 0;
 
}
 

	
 
DEFINE_OLD_POOL_GENERIC(Industry, Industry)
 
@@ -888,14 +888,14 @@ static void PlantFarmField(TileIndex til
 
	uint field_type;
 
	int type;
 

	
 
	if (_settings.game_creation.landscape == LT_ARCTIC) {
 
	if (_settings_game.game_creation.landscape == LT_ARCTIC) {
 
		if (GetTileZ(tile) + TILE_HEIGHT * 2 >= GetSnowLine())
 
			return;
 
	}
 

	
 
	/* determine field size */
 
	r = (Random() & 0x303) + 0x404;
 
	if (_settings.game_creation.landscape == LT_ARCTIC) r += 0x404;
 
	if (_settings_game.game_creation.landscape == LT_ARCTIC) r += 0x404;
 
	size_x = GB(r, 0, 8);
 
	size_y = GB(r, 8, 8);
 

	
 
@@ -926,7 +926,7 @@ static void PlantFarmField(TileIndex til
 
	END_TILE_LOOP(cur_tile, size_x, size_y, tile)
 

	
 
	type = 3;
 
	if (_settings.game_creation.landscape != LT_ARCTIC && _settings.game_creation.landscape != LT_TROPIC) {
 
	if (_settings_game.game_creation.landscape != LT_ARCTIC && _settings_game.game_creation.landscape != LT_TROPIC) {
 
		type = _plantfarmfield_type[Random() & 0xF];
 
	}
 

	
 
@@ -1063,7 +1063,7 @@ static bool CheckNewIndustry_NULL(TileIn
 

	
 
static bool CheckNewIndustry_Forest(TileIndex tile)
 
{
 
	if (_settings.game_creation.landscape == LT_ARCTIC) {
 
	if (_settings_game.game_creation.landscape == LT_ARCTIC) {
 
		if (GetTileZ(tile) < HighestSnowLine() + TILE_HEIGHT * 2U) {
 
			_error_message = STR_4831_FOREST_CAN_ONLY_BE_PLANTED;
 
			return false;
 
@@ -1075,7 +1075,7 @@ static bool CheckNewIndustry_Forest(Tile
 
static bool CheckNewIndustry_OilRefinery(TileIndex tile)
 
{
 
	if (_game_mode == GM_EDITOR) return true;
 
	if (DistanceFromEdge(TILE_ADDXY(tile, 1, 1)) < _settings.game_creation.oil_refinery_limit) return true;
 
	if (DistanceFromEdge(TILE_ADDXY(tile, 1, 1)) < _settings_game.game_creation.oil_refinery_limit) return true;
 

	
 
	_error_message = STR_483B_CAN_ONLY_BE_POSITIONED;
 
	return false;
 
@@ -1087,7 +1087,7 @@ static bool CheckNewIndustry_OilRig(Tile
 
{
 
	if (_game_mode == GM_EDITOR && _ignore_restrictions) return true;
 
	if (TileHeight(tile) == 0 &&
 
			DistanceFromEdge(TILE_ADDXY(tile, 1, 1)) < _settings.game_creation.oil_refinery_limit) return true;
 
			DistanceFromEdge(TILE_ADDXY(tile, 1, 1)) < _settings_game.game_creation.oil_refinery_limit) return true;
 

	
 
	_error_message = STR_483B_CAN_ONLY_BE_POSITIONED;
 
	return false;
 
@@ -1095,7 +1095,7 @@ static bool CheckNewIndustry_OilRig(Tile
 

	
 
static bool CheckNewIndustry_Farm(TileIndex tile)
 
{
 
	if (_settings.game_creation.landscape == LT_ARCTIC) {
 
	if (_settings_game.game_creation.landscape == LT_ARCTIC) {
 
		if (GetTileZ(tile) + TILE_HEIGHT * 2 >= HighestSnowLine()) {
 
			_error_message = STR_0239_SITE_UNSUITABLE;
 
			return false;
 
@@ -1171,7 +1171,7 @@ static const Town *CheckMultipleIndustry
 

	
 
	t = ClosestTownFromTile(tile, (uint)-1);
 

	
 
	if (_settings.economy.multiple_industry_per_town) return t;
 
	if (_settings_game.economy.multiple_industry_per_town) return t;
 

	
 
	FOR_ALL_INDUSTRIES(i) {
 
		if (i->type == (byte)type &&
 
@@ -1257,7 +1257,7 @@ static bool CheckIfIndustryTilesAreFree(
 
	/* It is almost impossible to have a fully flat land in TG, so what we
 
	 *  do is that we check if we can make the land flat later on. See
 
	 *  CheckIfCanLevelIndustryPlatform(). */
 
	return !refused_slope || (_settings.game_creation.land_generator == LG_TERRAGENESIS && _generating_world && !custom_shape && !_ignore_restrictions);
 
	return !refused_slope || (_settings_game.game_creation.land_generator == LG_TERRAGENESIS && _generating_world && !custom_shape && !_ignore_restrictions);
 
}
 

	
 
static bool CheckIfIndustryIsAllowed(TileIndex tile, int type, const Town *t)
 
@@ -1387,7 +1387,7 @@ static bool CheckIfFarEnoughFromIndustry
 
	const IndustrySpec *indspec = GetIndustrySpec(type);
 
	const Industry *i;
 

	
 
	if (_settings.economy.same_industry_close && indspec->IsRawIndustry())
 
	if (_settings_game.economy.same_industry_close && indspec->IsRawIndustry())
 
		/* Allow primary industries to be placed close to any other industry */
 
		return true;
 

	
 
@@ -1401,8 +1401,8 @@ static bool CheckIfFarEnoughFromIndustry
 
				indspec->accepts_cargo[0] == i->accepts_cargo[0] && (
 
				/* at least one of those options must be true */
 
				_game_mode != GM_EDITOR || // editor must not be stopped
 
				!_settings.economy.same_industry_close ||
 
				!_settings.economy.multiple_industry_per_town)) {
 
				!_settings_game.economy.same_industry_close ||
 
				!_settings_game.economy.multiple_industry_per_town)) {
 
			_error_message = STR_INDUSTRY_TOO_CLOSE;
 
			return false;
 
		}
 
@@ -1449,7 +1449,7 @@ static void DoCreateNewIndustry(Industry
 
	i->production_rate[1] = indspec->production_rate[1];
 

	
 
	/* don't use smooth economy for industries using production related callbacks */
 
	if (_settings.economy.smooth_economy &&
 
	if (_settings_game.economy.smooth_economy &&
 
	    !(HasBit(indspec->callback_flags, CBM_IND_PRODUCTION_256_TICKS) || HasBit(indspec->callback_flags, CBM_IND_PRODUCTION_CARGO_ARRIVAL)) && // production callbacks
 
	    !(HasBit(indspec->callback_flags, CBM_IND_MONTHLYPROD_CHANGE) || HasBit(indspec->callback_flags, CBM_IND_PRODUCTION_CHANGE))             // production change callbacks
 
	) {
 
@@ -1577,7 +1577,7 @@ static Industry *CreateNewIndustryHelper
 
		if (!_check_new_industry_procs[indspec->check_proc](tile)) return NULL;
 
	}
 

	
 
	if (!custom_shape_check && _settings.game_creation.land_generator == LG_TERRAGENESIS && _generating_world && !_ignore_restrictions && !CheckIfCanLevelIndustryPlatform(tile, 0, it, type)) return NULL;
 
	if (!custom_shape_check && _settings_game.game_creation.land_generator == LG_TERRAGENESIS && _generating_world && !_ignore_restrictions && !CheckIfCanLevelIndustryPlatform(tile, 0, it, type)) return NULL;
 
	if (!CheckIfFarEnoughFromIndustry(tile, type)) return NULL;
 

	
 
	const Town *t = CheckMultipleIndustryInTown(tile, type);
 
@@ -1621,11 +1621,11 @@ CommandCost CmdBuildIndustry(TileIndex t
 

	
 
	/* If the patch for raw-material industries is not on, you cannot build raw-material industries.
 
	 * Raw material industries are industries that do not accept cargo (at least for now) */
 
	if (_game_mode != GM_EDITOR && _settings.construction.raw_industry_construction == 0 && indspec->IsRawIndustry()) {
 
	if (_game_mode != GM_EDITOR && _settings_game.construction.raw_industry_construction == 0 && indspec->IsRawIndustry()) {
 
		return CMD_ERROR;
 
	}
 

	
 
	if (_game_mode != GM_EDITOR && _settings.construction.raw_industry_construction == 2 && indspec->IsRawIndustry()) {
 
	if (_game_mode != GM_EDITOR && _settings_game.construction.raw_industry_construction == 2 && indspec->IsRawIndustry()) {
 
		if (flags & DC_EXEC) {
 
			/* Prospecting has a chance to fail, however we cannot guarantee that something can
 
			 * be built on the map, so the chance gets lower when the map is fuller, but there
 
@@ -1700,13 +1700,13 @@ static void PlaceInitialIndustry(Industr
 
{
 
	/* We need to bypass the amount given in parameter if it exceeds the maximum dimension of the
 
	 * _numof_industry_table.  newgrf can specify a big amount */
 
	int num = (amount > NB_NUMOFINDUSTRY) ? amount : _numof_industry_table[_settings.difficulty.number_industries][amount];
 
	int num = (amount > NB_NUMOFINDUSTRY) ? amount : _numof_industry_table[_settings_game.difficulty.number_industries][amount];
 
	const IndustrySpec *ind_spc = GetIndustrySpec(type);
 

	
 
	/* These are always placed next to the coastline, so we scale by the perimeter instead. */
 
	num = (ind_spc->check_proc == CHECK_REFINERY || ind_spc->check_proc == CHECK_OIL_RIG) ? ScaleByMapSize1D(num) : ScaleByMapSize(num);
 

	
 
	if (_settings.difficulty.number_industries != 0) {
 
	if (_settings_game.difficulty.number_industries != 0) {
 
		PlayerID old_player = _current_player;
 
		_current_player = OWNER_NONE;
 
		assert(num > 0);
 
@@ -1735,7 +1735,7 @@ void GenerateIndustries()
 
	const IndustrySpec *ind_spc;
 

	
 
	/* Find the total amount of industries */
 
	if (_settings.difficulty.number_industries > 0) {
 
	if (_settings_game.difficulty.number_industries > 0) {
 
		for (it = 0; it < NUM_INDUSTRYTYPES; it++) {
 

	
 
			ind_spc = GetIndustrySpec(it);
 
@@ -1744,12 +1744,12 @@ void GenerateIndustries()
 
				ResetIndustryCreationProbility(it);
 
			}
 

	
 
			chance = ind_spc->appear_creation[_settings.game_creation.landscape];
 
			chance = ind_spc->appear_creation[_settings_game.game_creation.landscape];
 
			if (ind_spc->enabled && chance > 0) {
 
				/* once the chance of appearance is determind, it have to be scaled by
 
				 * the difficulty level. The "chance" in question is more an index into
 
				 * the _numof_industry_table,in fact */
 
				int num = (chance > NB_NUMOFINDUSTRY) ? chance : _numof_industry_table[_settings.difficulty.number_industries][chance];
 
				int num = (chance > NB_NUMOFINDUSTRY) ? chance : _numof_industry_table[_settings_game.difficulty.number_industries][chance];
 

	
 
				/* These are always placed next to the coastline, so we scale by the perimeter instead. */
 
				num = (ind_spc->check_proc == CHECK_REFINERY || ind_spc->check_proc == CHECK_OIL_RIG) ? ScaleByMapSize1D(num) : ScaleByMapSize(num);
 
@@ -1760,7 +1760,7 @@ void GenerateIndustries()
 

	
 
	SetGeneratingWorldProgress(GWP_INDUSTRY, i);
 

	
 
	if (_settings.difficulty.number_industries > 0) {
 
	if (_settings_game.difficulty.number_industries > 0) {
 
		for (it = 0; it < NUM_INDUSTRYTYPES; it++) {
 
			/* Once the number of industries has been determined, let's really create them.
 
			 * The test for chance allows us to try create industries that are available only
 
@@ -1769,7 +1769,7 @@ void GenerateIndustries()
 
			 *          processed that scaling above? No, don't think so.  Will find a way. */
 
			ind_spc = GetIndustrySpec(it);
 
			if (ind_spc->enabled) {
 
				chance = ind_spc->appear_creation[_settings.game_creation.landscape];
 
				chance = ind_spc->appear_creation[_settings_game.game_creation.landscape];
 
				if (chance > 0) PlaceInitialIndustry(it, chance);
 
			}
 
		}
 
@@ -1823,7 +1823,7 @@ static void MaybeNewIndustry(void)
 
	/* Generate a list of all possible industries that can be built. */
 
	for (j = 0; j < NUM_INDUSTRYTYPES; j++) {
 
		ind_spc = GetIndustrySpec(j);
 
		byte chance = ind_spc->appear_ingame[_settings.game_creation.landscape];
 
		byte chance = ind_spc->appear_ingame[_settings_game.game_creation.landscape];
 

	
 
		if (!ind_spc->enabled || chance == 0) continue;
 

	
 
@@ -1881,7 +1881,7 @@ static bool CheckIndustryCloseDownProtec
 
	const IndustrySpec *indspec = GetIndustrySpec(type);
 

	
 
	/* oil wells (or the industries with that flag set) are always allowed to closedown */
 
	if (indspec->behaviour & INDUSTRYBEH_DONT_INCR_PROD && _settings.game_creation.landscape == LT_TEMPERATE) return false;
 
	if (indspec->behaviour & INDUSTRYBEH_DONT_INCR_PROD && _settings_game.game_creation.landscape == LT_TEMPERATE) return false;
 
	return (indspec->behaviour & INDUSTRYBEH_CANCLOSE_LASTINSTANCE) == 0 && GetIndustryTypeCount(type) <= 1;
 
}
 

	
 
@@ -2031,7 +2031,7 @@ static void ChangeIndustryProduction(Ind
 
	bool standard = true;
 
	bool suppress_message = false;
 
	/* don't use smooth economy for industries using production related callbacks */
 
	bool smooth_economy = _settings.economy.smooth_economy &&
 
	bool smooth_economy = _settings_game.economy.smooth_economy &&
 
	                      !(HasBit(indspec->callback_flags, CBM_IND_PRODUCTION_256_TICKS) || HasBit(indspec->callback_flags, CBM_IND_PRODUCTION_CARGO_ARRIVAL)) && // production callbacks
 
	                      !(HasBit(indspec->callback_flags, CBM_IND_MONTHLYPROD_CHANGE) || HasBit(indspec->callback_flags, CBM_IND_PRODUCTION_CHANGE));            // production change callbacks
 
	byte div = 0;
 
@@ -2072,7 +2072,7 @@ static void ChangeIndustryProduction(Ind
 

	
 
	if (standard && (indspec->life_type & (INDUSTRYLIFE_ORGANIC | INDUSTRYLIFE_EXTRACTIVE)) != 0) {
 
		/* decrease or increase */
 
		bool only_decrease = (indspec->behaviour & INDUSTRYBEH_DONT_INCR_PROD) && _settings.game_creation.landscape == LT_TEMPERATE;
 
		bool only_decrease = (indspec->behaviour & INDUSTRYBEH_DONT_INCR_PROD) && _settings_game.game_creation.landscape == LT_TEMPERATE;
 

	
 
		if (smooth_economy) {
 
			closeit = true;
 
@@ -2257,7 +2257,7 @@ bool IndustrySpec::IsRawIndustry() const
 
Money IndustrySpec::GetConstructionCost() const
 
{
 
	return (_price.build_industry *
 
			(_settings.construction.raw_industry_construction == 1 && this->IsRawIndustry() ?
 
			(_settings_game.construction.raw_industry_construction == 1 && this->IsRawIndustry() ?
 
					this->raw_industry_cost_multiplier :
 
					this->cost_multiplier
 
			)) >> 8;
src/industry_gui.cpp
Show inline comments
 
@@ -132,7 +132,7 @@ class BuildIndustryWindow : public Windo
 
				/* Rule is that editor mode loads all industries.
 
				 * In game mode, all non raw industries are loaded too
 
				 * and raw ones are loaded only when setting allows it */
 
				if (_game_mode != GM_EDITOR && indsp->IsRawIndustry() && _settings.construction.raw_industry_construction == 0) {
 
				if (_game_mode != GM_EDITOR && indsp->IsRawIndustry() && _settings_game.construction.raw_industry_construction == 0) {
 
					/* Unselect if the industry is no longer in the list */
 
					if (this->selected_type == ind) this->selected_index = -1;
 
					continue;
 
@@ -196,10 +196,10 @@ public:
 
		 * In Editor, you just build, while ingame, or you fund or you prospect */
 
		if (_game_mode == GM_EDITOR) {
 
			/* We've chosen many random industries but no industries have been specified */
 
			if (indsp == NULL) this->enabled[this->selected_index] = _settings.difficulty.number_industries != 0;
 
			if (indsp == NULL) this->enabled[this->selected_index] = _settings_game.difficulty.number_industries != 0;
 
			this->widget[DPIW_FUND_WIDGET].data = STR_BUILD_NEW_INDUSTRY;
 
		} else {
 
			this->widget[DPIW_FUND_WIDGET].data = (_settings.construction.raw_industry_construction == 2 && indsp->IsRawIndustry()) ? STR_PROSPECT_NEW_INDUSTRY : STR_FUND_NEW_INDUSTRY;
 
			this->widget[DPIW_FUND_WIDGET].data = (_settings_game.construction.raw_industry_construction == 2 && indsp->IsRawIndustry()) ? STR_PROSPECT_NEW_INDUSTRY : STR_FUND_NEW_INDUSTRY;
 
		}
 
		this->SetWidgetDisabledState(DPIW_FUND_WIDGET, !this->enabled[this->selected_index]);
 

	
 
@@ -305,7 +305,7 @@ public:
 

	
 
					this->SetDirty();
 

	
 
					if ((_game_mode != GM_EDITOR && _settings.construction.raw_industry_construction == 2 && indsp != NULL && indsp->IsRawIndustry()) ||
 
					if ((_game_mode != GM_EDITOR && _settings_game.construction.raw_industry_construction == 2 && indsp != NULL && indsp->IsRawIndustry()) ||
 
							this->selected_type == INVALID_INDUSTRYTYPE) {
 
						/* Reset the button state if going to prospecting or "build many industries" */
 
						this->RaiseButtons();
 
@@ -326,7 +326,7 @@ public:
 
						GenerateIndustries();
 
						_generating_world = false;
 
					}
 
				} else if (_game_mode != GM_EDITOR && _settings.construction.raw_industry_construction == 2 && GetIndustrySpec(this->selected_type)->IsRawIndustry()) {
 
				} else if (_game_mode != GM_EDITOR && _settings_game.construction.raw_industry_construction == 2 && GetIndustrySpec(this->selected_type)->IsRawIndustry()) {
 
					DoCommandP(0, this->selected_type, InteractiveRandom(), NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY));
 
					this->HandleButtonClick(DPIW_FUND_WIDGET);
 
				} else {
src/landscape.cpp
Show inline comments
 
@@ -526,7 +526,7 @@ void SetSnowLine(byte table[SNOW_LINE_MO
 
 */
 
byte GetSnowLine(void)
 
{
 
	if (_snow_line == NULL) return _settings.game_creation.snow_line;
 
	if (_snow_line == NULL) return _settings_game.game_creation.snow_line;
 

	
 
	YearMonthDay ymd;
 
	ConvertDateToYMD(_date, &ymd);
 
@@ -539,7 +539,7 @@ byte GetSnowLine(void)
 
 */
 
byte HighestSnowLine(void)
 
{
 
	return _snow_line == NULL ? _settings.game_creation.snow_line : _snow_line->highest_value;
 
	return _snow_line == NULL ? _settings_game.game_creation.snow_line : _snow_line->highest_value;
 
}
 

	
 
/**
 
@@ -818,14 +818,14 @@ void GenerateLandscape(byte mode)
 
	static const int gwp_desert_amount = 4 + 8;
 

	
 
	if (mode == GW_HEIGHTMAP) {
 
		SetGeneratingWorldProgress(GWP_LANDSCAPE, (_settings.game_creation.landscape == LT_TROPIC) ? 1 + gwp_desert_amount : 1);
 
		SetGeneratingWorldProgress(GWP_LANDSCAPE, (_settings_game.game_creation.landscape == LT_TROPIC) ? 1 + gwp_desert_amount : 1);
 
		LoadHeightmap(_file_to_saveload.name);
 
		IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
 
	} else if (_settings.game_creation.land_generator == LG_TERRAGENESIS) {
 
		SetGeneratingWorldProgress(GWP_LANDSCAPE, (_settings.game_creation.landscape == LT_TROPIC) ? 3 + gwp_desert_amount : 3);
 
	} else if (_settings_game.game_creation.land_generator == LG_TERRAGENESIS) {
 
		SetGeneratingWorldProgress(GWP_LANDSCAPE, (_settings_game.game_creation.landscape == LT_TROPIC) ? 3 + gwp_desert_amount : 3);
 
		GenerateTerrainPerlin();
 
	} else {
 
		switch (_settings.game_creation.landscape) {
 
		switch (_settings_game.game_creation.landscape) {
 
			case LT_ARCTIC: {
 
				SetGeneratingWorldProgress(GWP_LANDSCAPE, 2);
 

	
 
@@ -872,9 +872,9 @@ void GenerateLandscape(byte mode)
 

	
 
				uint32 r = Random();
 

	
 
				uint i = ScaleByMapSize(GB(r, 0, 7) + (3 - _settings.difficulty.quantity_sea_lakes) * 256 + 100);
 
				uint i = ScaleByMapSize(GB(r, 0, 7) + (3 - _settings_game.difficulty.quantity_sea_lakes) * 256 + 100);
 
				for (; i != 0; --i) {
 
					GenerateTerrain(_settings.difficulty.terrain_type, 0);
 
					GenerateTerrain(_settings_game.difficulty.terrain_type, 0);
 
				}
 
				IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
 
			} break;
 
@@ -883,7 +883,7 @@ void GenerateLandscape(byte mode)
 

	
 
	ConvertGroundTilesIntoWaterTiles();
 

	
 
	if (_settings.game_creation.landscape == LT_TROPIC) CreateDesertOrRainForest();
 
	if (_settings_game.game_creation.landscape == LT_TROPIC) CreateDesertOrRainForest();
 
}
 

	
 
void OnTick_Town();
src/main_gui.cpp
Show inline comments
 
@@ -48,7 +48,7 @@ static int _rename_what = -1;
 
void CcGiveMoney(bool success, TileIndex tile, uint32 p1, uint32 p2)
 
{
 
#ifdef ENABLE_NETWORK
 
	if (!success || !_settings.economy.give_money) return;
 
	if (!success || !_settings_game.economy.give_money) return;
 

	
 
	char msg[20];
 
	/* Inform the player of this action */
 
@@ -344,7 +344,7 @@ struct MainWindow : Window
 
					if (cio == NULL) break;
 

	
 
					/* Only players actually playing can speak to team. Eg spectators cannot */
 
					if (_settings.gui.prefer_teamchat && IsValidPlayer(cio->client_playas)) {
 
					if (_settings_client.gui.prefer_teamchat && IsValidPlayer(cio->client_playas)) {
 
						const NetworkClientInfo *ci;
 
						FOR_ALL_ACTIVE_CLIENT_INFOS(ci) {
 
							if (ci->client_playas == cio->client_playas && ci != cio) {
src/misc.cpp
Show inline comments
 
@@ -67,10 +67,10 @@ void InitializeGame(uint size_x, uint si
 
	_realtime_tick = 0;
 
	_date_fract = 0;
 
	_cur_tileloop_tile = 0;
 
	_settings = _settings_newgame;
 
	_settings_game = _settings_newgame;
 

	
 
	if (reset_date) {
 
		SetDate(ConvertYMDToDate(_settings.game_creation.starting_year, 0, 1));
 
		SetDate(ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1));
 
		InitializeOldNames();
 
	}
 

	
src/misc_cmd.cpp
Show inline comments
 
@@ -145,7 +145,7 @@ CommandCost CmdIncreaseLoan(TileIndex ti
 
	switch (p2) {
 
		default: return CMD_ERROR; // Invalid method
 
		case 0: // Take some extra loan
 
			loan = (IsHumanPlayer(_current_player) || _settings.ai.ainew_active) ? LOAN_INTERVAL : LOAN_INTERVAL_OLD_AI;
 
			loan = (IsHumanPlayer(_current_player) || _settings_game.ai.ainew_active) ? LOAN_INTERVAL : LOAN_INTERVAL_OLD_AI;
 
			break;
 
		case 1: // Take a loan as big as possible
 
			loan = _economy.max_loan - p->current_loan;
 
@@ -181,7 +181,7 @@ CommandCost CmdDecreaseLoan(TileIndex ti
 
	switch (p2) {
 
		default: return CMD_ERROR; // Invalid method
 
		case 0: // Pay back one step
 
			loan = min(p->current_loan, (Money)(IsHumanPlayer(_current_player) || _settings.ai.ainew_active) ? LOAN_INTERVAL : LOAN_INTERVAL_OLD_AI);
 
			loan = min(p->current_loan, (Money)(IsHumanPlayer(_current_player) || _settings_game.ai.ainew_active) ? LOAN_INTERVAL : LOAN_INTERVAL_OLD_AI);
 
			break;
 
		case 1: // Pay back as much as possible
 
			loan = max(min(p->current_loan, p->player_money), (Money)LOAN_INTERVAL);
 
@@ -359,7 +359,7 @@ CommandCost CmdMoneyCheat(TileIndex tile
 
 */
 
CommandCost CmdGiveMoney(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 
{
 
	if (!_settings.economy.give_money) return CMD_ERROR;
 
	if (!_settings_game.economy.give_money) return CMD_ERROR;
 

	
 
	const Player *p = GetPlayer(_current_player);
 
	CommandCost amount(EXPENSES_OTHER, min((Money)p1, (Money)20000000LL));
src/misc_gui.cpp
Show inline comments
 
@@ -102,7 +102,7 @@ public:
 

	
 
	LandInfoWindow(TileIndex tile) : Window(&_land_info_desc) {
 
		Player *p = GetPlayer(IsValidPlayer(_local_player) ? _local_player : PLAYER_FIRST);
 
		Town *t = ClosestTownFromTile(tile, _settings.economy.dist_local_authority);
 
		Town *t = ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority);
 

	
 
		Money old_money = p->player_money;
 
		p->player_money = INT64_MAX;
 
@@ -396,7 +396,7 @@ public:
 
			Window(pt.x, pt.y, width, height, WC_ERRMSG, widget),
 
			show_player_face(show_player_face)
 
	{
 
		this->duration = _settings.gui.errmsg_duration;
 
		this->duration = _settings_client.gui.errmsg_duration;
 
		CopyOutDParam(this->decode_params, 0, lengthof(this->decode_params));
 
		this->message_1 = msg1;
 
		this->message_2 = msg2;
 
@@ -465,7 +465,7 @@ void ShowErrorMessage(StringID msg_1, St
 
{
 
	DeleteWindowById(WC_ERRMSG, 0);
 

	
 
	if (!_settings.gui.errmsg_duration) return;
 
	if (!_settings_client.gui.errmsg_duration) return;
 

	
 
	if (msg_2 == STR_NULL) msg_2 = STR_EMPTY;
 

	
 
@@ -620,7 +620,7 @@ void GuiShowTooltipsWithArgs(StringID st
 
	DeleteWindowById(WC_TOOLTIPS, 0);
 

	
 
	/* We only show measurement tooltips with patch setting on */
 
	if (str == STR_NULL || (paramcount != 0 && !_settings.gui.measure_tooltip)) return;
 
	if (str == STR_NULL || (paramcount != 0 && !_settings_client.gui.measure_tooltip)) return;
 

	
 
	for (uint i = 0; i != paramcount; i++) SetDParam(i, params[i]);
 
	char buffer[512];
src/network/network.cpp
Show inline comments
 
@@ -1009,10 +1009,10 @@ static void NetworkInitGameInfo()
 
	_network_game_info.spectators_on = 0;
 

	
 
	_network_game_info.game_date = _date;
 
	_network_game_info.start_date = ConvertYMDToDate(_settings.game_creation.starting_year, 0, 1);
 
	_network_game_info.start_date = ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1);
 
	_network_game_info.map_width = MapSizeX();
 
	_network_game_info.map_height = MapSizeY();
 
	_network_game_info.map_set = _settings.game_creation.landscape;
 
	_network_game_info.map_set = _settings_game.game_creation.landscape;
 

	
 
	_network_game_info.use_password = (_network_server_password[0] != '\0');
 

	
src/network/network_client.cpp
Show inline comments
 
@@ -83,7 +83,7 @@ void HashCurrentCompanyPassword()
 
{
 
	if (StrEmpty(_network_player_info[_local_player].password)) return;
 

	
 
	_password_game_seed = _settings.game_creation.generation_seed;
 
	_password_game_seed = _settings_game.game_creation.generation_seed;
 
	ttd_strlcpy(_password_server_unique_id, _network_unique_id, sizeof(_password_server_unique_id));
 

	
 
	const char *new_pw = GenerateCompanyPasswordHash(_network_player_info[_local_player].password);
src/network/network_gui.cpp
Show inline comments
 
@@ -1334,7 +1334,7 @@ struct NetworkClientListPopupWindow : Wi
 

	
 
		if (_network_own_client_index != ci->client_index) {
 
			/* We are no spectator and the player we want to give money to is no spectator and money gifts are allowed */
 
			if (IsValidPlayer(_network_playas) && IsValidPlayer(ci->client_playas) && _settings.economy.give_money) {
 
			if (IsValidPlayer(_network_playas) && IsValidPlayer(ci->client_playas) && _settings_game.economy.give_money) {
 
				GetString(this->action[i], STR_NETWORK_CLIENTLIST_GIVE_MONEY, lastof(this->action[i]));
 
				this->proc[i++] = &ClientList_GiveMoney;
 
			}
src/network/network_server.cpp
Show inline comments
 
@@ -229,7 +229,7 @@ DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SER
 

	
 
	Packet *p = NetworkSend_Init(PACKET_SERVER_NEED_PASSWORD);
 
	p->Send_uint8(type);
 
	p->Send_uint32(_settings.game_creation.generation_seed);
 
	p->Send_uint32(_settings_game.game_creation.generation_seed);
 
	p->Send_string(_network_unique_id);
 
	cs->Send_Packet(p);
 
}
 
@@ -254,7 +254,7 @@ DEF_SERVER_SEND_COMMAND(PACKET_SERVER_WE
 

	
 
	p = NetworkSend_Init(PACKET_SERVER_WELCOME);
 
	p->Send_uint16(cs->index);
 
	p->Send_uint32(_settings.game_creation.generation_seed);
 
	p->Send_uint32(_settings_game.game_creation.generation_seed);
 
	p->Send_string(_network_unique_id);
 
	cs->Send_Packet(p);
 

	
src/network/network_udp.cpp
Show inline comments
 
@@ -77,7 +77,7 @@ DEF_UDP_RECEIVE_COMMAND(Server, PACKET_U
 
	_network_game_info.game_date     = _date;
 
	_network_game_info.map_width     = MapSizeX();
 
	_network_game_info.map_height    = MapSizeY();
 
	_network_game_info.map_set       = _settings.game_creation.landscape;
 
	_network_game_info.map_set       = _settings_game.game_creation.landscape;
 
	_network_game_info.companies_on  = ActivePlayerCount();
 
	_network_game_info.spectators_on = NetworkSpectatorCount();
 
	_network_game_info.grfconfig     = _grfconfig;
src/newgrf.cpp
Show inline comments
 
@@ -326,7 +326,7 @@ static Engine *GetNewEngine(const GRFFil
 
	/* Hack for add-on GRFs that need to modify another GRF's engines. This lets
 
	 * them use the same engine slots. */
 
	const GRFFile *grf_match = NULL;
 
	if (_settings.vehicle.dynamic_engines) {
 
	if (_settings_game.vehicle.dynamic_engines) {
 
		uint32 override = _grf_id_overrides[file->grfid];
 
		if (override != 0) {
 
			grf_match = GetFileByGRFID(override);
 
@@ -341,7 +341,7 @@ static Engine *GetNewEngine(const GRFFil
 
	/* Check if this vehicle is already defined... */
 
	Engine *e = NULL;
 
	FOR_ALL_ENGINES(e) {
 
		if (_settings.vehicle.dynamic_engines && e->grffile != NULL && e->grffile != file && e->grffile != grf_match) continue;
 
		if (_settings_game.vehicle.dynamic_engines && e->grffile != NULL && e->grffile != file && e->grffile != grf_match) continue;
 
		if (e->type != type) continue;
 
		if (e->internal_id != internal_id) continue;
 

	
 
@@ -377,14 +377,14 @@ EngineID GetNewEngineID(const GRFFile *f
 
	extern uint32 GetNewGRFOverride(uint32 grfid);
 

	
 
	const GRFFile *grf_match = NULL;
 
	if (_settings.vehicle.dynamic_engines) {
 
	if (_settings_game.vehicle.dynamic_engines) {
 
		uint32 override = _grf_id_overrides[file->grfid];
 
		if (override != 0) grf_match = GetFileByGRFID(override);
 
	}
 

	
 
	const Engine *e = NULL;
 
	FOR_ALL_ENGINES(e) {
 
		if (_settings.vehicle.dynamic_engines && e->grffile != file && (grf_match == NULL || e->grffile != grf_match)) continue;
 
		if (_settings_game.vehicle.dynamic_engines && e->grffile != file && (grf_match == NULL || e->grffile != grf_match)) continue;
 
		if (e->type != type) continue;
 
		if (e->internal_id != internal_id) continue;
 

	
 
@@ -1437,8 +1437,8 @@ static bool TownHouseChangeInfo(uint hid
 

	
 
				/* If value of goods is negative, it means in fact food or, if in toyland, fizzy_drink acceptance.
 
				 * Else, we have "standard" 3rd cargo type, goods or candy, for toyland once more */
 
				CargoID cid = (goods >= 0) ? ((_settings.game_creation.landscape == LT_TOYLAND) ? CT_CANDY : CT_GOODS) :
 
						((_settings.game_creation.landscape == LT_TOYLAND) ? CT_FIZZY_DRINKS : CT_FOOD);
 
				CargoID cid = (goods >= 0) ? ((_settings_game.game_creation.landscape == LT_TOYLAND) ? CT_CANDY : CT_GOODS) :
 
						((_settings_game.game_creation.landscape == LT_TOYLAND) ? CT_FIZZY_DRINKS : CT_FOOD);
 

	
 
				/* Make sure the cargo type is valid in this climate. */
 
				if (!GetCargo(cid)->IsValid()) goods = 0;
 
@@ -2167,11 +2167,11 @@ static bool IndustriesChangeInfo(uint in
 
				break;
 

	
 
			case 0x17: // Probability in random game
 
				indsp->appear_creation[_settings.game_creation.landscape] = grf_load_byte(&buf);
 
				indsp->appear_creation[_settings_game.game_creation.landscape] = grf_load_byte(&buf);
 
				break;
 

	
 
			case 0x18: // Probability during gameplay
 
				indsp->appear_ingame[_settings.game_creation.landscape] = grf_load_byte(&buf);
 
				indsp->appear_ingame[_settings_game.game_creation.landscape] = grf_load_byte(&buf);
 
				break;
 

	
 
			case 0x19: // Map color
 
@@ -3557,11 +3557,11 @@ bool GetGlobalVariable(byte param, uint3
 
			return true;
 

	
 
		case 0x03: // current climate, 0=temp, 1=arctic, 2=trop, 3=toyland
 
			*value = _settings.game_creation.landscape;
 
			*value = _settings_game.game_creation.landscape;
 
			return true;
 

	
 
		case 0x06: // road traffic side, bit 4 clear=left, set=right
 
			*value = _settings.vehicle.road_side << 4;
 
			*value = _settings_game.vehicle.road_side << 4;
 
			return true;
 

	
 
		case 0x09: // date fraction
 
@@ -3592,7 +3592,7 @@ bool GetGlobalVariable(byte param, uint3
 
		case 0x0F: // Rail track type cost factors
 
			*value = 0;
 
			SB(*value, 0, 8, _railtype_cost_multiplier[0]); // normal rail
 
			if (_settings.vehicle.disable_elrails) {
 
			if (_settings_game.vehicle.disable_elrails) {
 
				/* skip elrail multiplier - disabled */
 
				SB(*value, 8, 8, _railtype_cost_multiplier[2]); // monorail
 
			} else {
 
@@ -3635,7 +3635,7 @@ bool GetGlobalVariable(byte param, uint3
 
		/* case 0x1F: // locale dependent settings not implemented */
 

	
 
		case 0x20: // snow line height
 
			*value = _settings.game_creation.landscape == LT_ARCTIC ? GetSnowLine() : 0xFF;
 
			*value = _settings_game.game_creation.landscape == LT_ARCTIC ? GetSnowLine() : 0xFF;
 
			return true;
 

	
 
		case 0x21: // OpenTTD version
 
@@ -3643,7 +3643,7 @@ bool GetGlobalVariable(byte param, uint3
 
			return true;
 

	
 
		case 0x22: // difficulty level
 
			*value = _settings.difficulty.diff_level;
 
			*value = _settings_game.difficulty.diff_level;
 
			return true;
 

	
 
		default: return false;
 
@@ -4188,10 +4188,10 @@ static uint32 GetPatchVariable(uint8 par
 
{
 
	switch (param) {
 
		/* start year - 1920 */
 
		case 0x0B: return max(_settings.game_creation.starting_year, ORIGINAL_BASE_YEAR) - ORIGINAL_BASE_YEAR;
 
		case 0x0B: return max(_settings_game.game_creation.starting_year, ORIGINAL_BASE_YEAR) - ORIGINAL_BASE_YEAR;
 

	
 
		/* freight trains weight factor */
 
		case 0x0E: return _settings.vehicle.freight_trains;
 
		case 0x0E: return _settings_game.vehicle.freight_trains;
 

	
 
		/* empty wagon speed increase */
 
		case 0x0F: return 0;
 
@@ -4200,7 +4200,7 @@ static uint32 GetPatchVariable(uint8 par
 
		 * the following is good for 1x, 2x and 4x (most common?) and...
 
		 * well not really for 3x. */
 
		case 0x10:
 
			switch (_settings.vehicle.plane_speed) {
 
			switch (_settings_game.vehicle.plane_speed) {
 
				default:
 
				case 4: return 1;
 
				case 3: return 2;
 
@@ -4382,7 +4382,7 @@ static void ParamSet(byte *buf, size_t l
 
						case 0x01: // Road Vehicles
 
						case 0x02: // Ships
 
						case 0x03: // Aircraft
 
							if (!_settings.vehicle.dynamic_engines) {
 
							if (!_settings_game.vehicle.dynamic_engines) {
 
								src1 = PerformGRM(&_grm_engines[_engine_offsets[feature]], _engine_counts[feature], count, op, target, "vehicles");
 
								if (_skip_sprites == -1) return;
 
							} else {
 
@@ -4544,7 +4544,7 @@ static void ParamSet(byte *buf, size_t l
 

	
 
		case 0x8F: // Rail track type cost factors
 
			_railtype_cost_multiplier[0] = GB(res, 0, 8);
 
			if (_settings.vehicle.disable_elrails) {
 
			if (_settings_game.vehicle.disable_elrails) {
 
				_railtype_cost_multiplier[1] = GB(res, 0, 8);
 
				_railtype_cost_multiplier[2] = GB(res, 8, 8);
 
			} else {
 
@@ -5079,23 +5079,23 @@ static void GRFUnsafe(byte *buf, size_t 
 

	
 
static void InitializeGRFSpecial()
 
{
 
	_ttdpatch_flags[0] =  ((_settings.station.always_small_airport ? 1 : 0) << 0x0C)  // keepsmallairport
 
	_ttdpatch_flags[0] =  ((_settings_game.station.always_small_airport ? 1 : 0) << 0x0C)  // keepsmallairport
 
	                   |                                                 (1 << 0x0D)  // newairports
 
	                   |                                                 (1 << 0x0E)  // largestations
 
	                   |      ((_settings.construction.longbridges ? 1 : 0) << 0x0F)  // longbridges
 
	                   |      ((_settings_game.construction.longbridges ? 1 : 0) << 0x0F)  // longbridges
 
	                   |                                                 (0 << 0x10)  // loadtime
 
	                   |                                                 (1 << 0x12)  // presignals
 
	                   |                                                 (1 << 0x13)  // extpresignals
 
	                   | ((_settings.vehicle.never_expire_vehicles ? 1 : 0) << 0x16)  // enginespersist
 
	                   | ((_settings_game.vehicle.never_expire_vehicles ? 1 : 0) << 0x16)  // enginespersist
 
	                   |                                                 (1 << 0x1B)  // multihead
 
	                   |                                                 (1 << 0x1D)  // lowmemory
 
	                   |                                                 (1 << 0x1E); // generalfixes
 

	
 
	_ttdpatch_flags[1] =   ((_settings.economy.station_noise_level ? 1 : 0) << 0x07)  // moreairports - based on units of noise
 
	                   |        ((_settings.vehicle.mammoth_trains ? 1 : 0) << 0x08)  // mammothtrains
 
	_ttdpatch_flags[1] =   ((_settings_game.economy.station_noise_level ? 1 : 0) << 0x07)  // moreairports - based on units of noise
 
	                   |        ((_settings_game.vehicle.mammoth_trains ? 1 : 0) << 0x08)  // mammothtrains
 
	                   |                                                 (1 << 0x09)  // trainrefit
 
	                   |                                                 (0 << 0x0B)  // subsidiaries
 
	                   |         ((_settings.order.gradual_loading ? 1 : 0) << 0x0C)  // gradualloading
 
	                   |         ((_settings_game.order.gradual_loading ? 1 : 0) << 0x0C)  // gradualloading
 
	                   |                                                 (1 << 0x12)  // unifiedmaglevmode - set bit 0 mode. Not revelant to OTTD
 
	                   |                                                 (1 << 0x13)  // unifiedmaglevmode - set bit 1 mode
 
	                   |                                                 (1 << 0x14)  // bridgespeedlimits
 
@@ -5104,14 +5104,14 @@ static void InitializeGRFSpecial()
 
	                   |                                                 (1 << 0x18)  // newrvs
 
	                   |                                                 (1 << 0x19)  // newships
 
	                   |                                                 (1 << 0x1A)  // newplanes
 
	                   |      ((_settings.construction.signal_side ? 1 : 0) << 0x1B)  // signalsontrafficside
 
	                   |       ((_settings.vehicle.disable_elrails ? 0 : 1) << 0x1C); // electrifiedrailway
 
	                   |      ((_settings_game.construction.signal_side ? 1 : 0) << 0x1B)  // signalsontrafficside
 
	                   |       ((_settings_game.vehicle.disable_elrails ? 0 : 1) << 0x1C); // electrifiedrailway
 

	
 
	_ttdpatch_flags[2] =                                                 (1 << 0x01)  // loadallgraphics - obsolote
 
	                   |                                                 (1 << 0x03)  // semaphores
 
	                   |                                                 (0 << 0x0B)  // enhancedgui
 
	                   |                                                 (0 << 0x0C)  // newagerating
 
	                   |  ((_settings.construction.build_on_slopes ? 1 : 0) << 0x0D)  // buildonslopes
 
	                   |  ((_settings_game.construction.build_on_slopes ? 1 : 0) << 0x0D)  // buildonslopes
 
	                   |                                                 (1 << 0x0E)  // fullloadany
 
	                   |                                                 (1 << 0x0F)  // planespeed
 
	                   |                                                 (0 << 0x10)  // moreindustriesperclimate - obsolete
 
@@ -5119,15 +5119,15 @@ static void InitializeGRFSpecial()
 
	                   |                                                 (1 << 0x12)  // newstations
 
	                   |                                                 (1 << 0x13)  // tracktypecostdiff
 
	                   |                                                 (1 << 0x14)  // manualconvert
 
	                   |  ((_settings.construction.build_on_slopes ? 1 : 0) << 0x15)  // buildoncoasts
 
	                   |  ((_settings_game.construction.build_on_slopes ? 1 : 0) << 0x15)  // buildoncoasts
 
	                   |                                                 (1 << 0x16)  // canals
 
	                   |                                                 (1 << 0x17)  // newstartyear
 
	                   |    ((_settings.vehicle.freight_trains > 1 ? 1 : 0) << 0x18)  // freighttrains
 
	                   |    ((_settings_game.vehicle.freight_trains > 1 ? 1 : 0) << 0x18)  // freighttrains
 
	                   |                                                 (1 << 0x19)  // newhouses
 
	                   |                                                 (1 << 0x1A)  // newbridges
 
	                   |                                                 (1 << 0x1B)  // newtownnames
 
	                   |                                                 (1 << 0x1C)  // moreanimation
 
	                   |    ((_settings.vehicle.wagon_speed_limits ? 1 : 0) << 0x1D)  // wagonspeedlimits
 
	                   |    ((_settings_game.vehicle.wagon_speed_limits ? 1 : 0) << 0x1D)  // wagonspeedlimits
 
	                   |                                                 (1 << 0x1E)  // newshistory
 
	                   |                                                 (0 << 0x1F); // custombridgeheads
 

	
 
@@ -5139,13 +5139,13 @@ static void InitializeGRFSpecial()
 
	                   |                                                 (1 << 0x05)  // resolutionwidth
 
	                   |                                                 (1 << 0x06)  // resolutionheight
 
	                   |                                                 (1 << 0x07)  // newindustries
 
	                   |           ((_settings.order.improved_load ? 1 : 0) << 0x08)  // fifoloading
 
	                   |           ((_settings_game.order.improved_load ? 1 : 0) << 0x08)  // fifoloading
 
	                   |                                                 (0 << 0x09)  // townroadbranchprob
 
	                   |                                                 (0 << 0x0A)  // tempsnowline
 
	                   |                                                 (1 << 0x0B)  // newcargo
 
	                   |                                                 (1 << 0x0C)  // enhancemultiplayer
 
	                   |                                                 (1 << 0x0D)  // onewayroads
 
	                   |   ((_settings.station.nonuniform_stations ? 1 : 0) << 0x0E)  // irregularstations
 
	                   |   ((_settings_game.station.nonuniform_stations ? 1 : 0) << 0x0E)  // irregularstations
 
	                   |                                                 (1 << 0x0F)  // statistics
 
	                   |                                                 (1 << 0x10)  // newsounds
 
	                   |                                                 (1 << 0x11)  // autoreplace
 
@@ -5155,7 +5155,7 @@ static void InitializeGRFSpecial()
 
	                   |                                                 (0 << 0x15)  // enhancetunnels
 
	                   |                                                 (1 << 0x16)  // shortrvs
 
	                   |                                                 (1 << 0x17)  // articulatedrvs
 
	                   |       ((_settings.vehicle.dynamic_engines ? 1 : 0) << 0x18)  // dynamic engines
 
	                   |       ((_settings_game.vehicle.dynamic_engines ? 1 : 0) << 0x18)  // dynamic engines
 
	                   |                                                 (1 << 0x1E); // variablerunningcosts
 
}
 

	
 
@@ -5352,7 +5352,7 @@ static void ResetNewGRFData()
 
	ResetNewGRFErrors();
 

	
 
	/* Set up the default cargo types */
 
	SetupCargoForClimate(_settings.game_creation.landscape);
 
	SetupCargoForClimate(_settings_game.game_creation.landscape);
 

	
 
	/* Reset misc GRF features and train list display variables */
 
	_misc_grf_features = 0;
src/newgrf_commons.cpp
Show inline comments
 
@@ -278,7 +278,7 @@ void IndustryTileOverrideManager::SetEnt
 
 *         Terrain type: 0 normal, 1 desert, 2 rainforest, 4 on or above snowline */
 
uint32 GetTerrainType(TileIndex tile)
 
{
 
	switch (_settings.game_creation.landscape) {
 
	switch (_settings_game.game_creation.landscape) {
 
		case LT_TROPIC: return GetTropicZone(tile);
 
		case LT_ARCTIC: return GetTileZ(tile) > GetSnowLine() ? 4 : 0;
 
		default:        return 0;
src/newgrf_engine.cpp
Show inline comments
 
@@ -1123,7 +1123,7 @@ void CommitRailVehListOrderChanges()
 
		/* Populate map with current list positions */
 
		Engine *e;
 
		FOR_ALL_ENGINES_OF_TYPE(e, VEH_TRAIN) {
 
			if (!_settings.vehicle.dynamic_engines || e->grffile == source_e->grffile) {
 
			if (!_settings_game.vehicle.dynamic_engines || e->grffile == source_e->grffile) {
 
				if (e->internal_id == target) target_e = e;
 
				lptr_map[e->list_position] = e;
 
			}
src/newgrf_town.cpp
Show inline comments
 
@@ -21,7 +21,7 @@ uint32 TownGetVariable(byte variable, by
 
	switch (variable) {
 
		/* Larger towns */
 
		case 0x40:
 
			if (_settings.economy.larger_towns == 0) return 2;
 
			if (_settings_game.economy.larger_towns == 0) return 2;
 
			if (t->larger_town) return 1;
 
			return 0;
 

	
src/news_gui.cpp
Show inline comments
 
@@ -500,7 +500,7 @@ void AddNewsItem(StringID string, NewsSu
 
	ni->flags = _news_subtype_data[subtype].flags;
 

	
 
	/* show this news message in color? */
 
	if (_cur_year >= _settings.gui.colored_news_year) ni->flags |= NF_INCOLOR;
 
	if (_cur_year >= _settings_client.gui.colored_news_year) ni->flags |= NF_INCOLOR;
 

	
 
	ni->data_a = data_a;
 
	ni->data_b = data_b;
 
@@ -582,7 +582,7 @@ void RemoveOldNewsItems()
 
	NewsItem *next;
 
	for (NewsItem *cur = _oldest_news; _total_news > MIN_NEWS_AMOUNT && cur != NULL; cur = next) {
 
		next = cur->next;
 
		if (_date - _news_type_data[_news_subtype_data[cur->subtype].type].age * _settings.gui.news_message_timeout > cur->date) DeleteNewsItem(cur);
 
		if (_date - _news_type_data[_news_subtype_data[cur->subtype].type].age * _settings_client.gui.news_message_timeout > cur->date) DeleteNewsItem(cur);
 
	}
 
}
 

	
src/npf.cpp
Show inline comments
 
@@ -213,7 +213,7 @@ static uint NPFSlopeCost(AyStarNode* cur
 

	
 
	if (z2 - z1 > 1) {
 
		/* Slope up */
 
		return _settings.pf.npf.npf_rail_slope_penalty;
 
		return _settings_game.pf.npf.npf_rail_slope_penalty;
 
	}
 
	return 0;
 
	/* Should we give a bonus for slope down? Probably not, we
 
@@ -260,10 +260,10 @@ static int32 NPFWaterPathCost(AyStar* as
 
	cost = _trackdir_length[trackdir]; // Should be different for diagonal tracks
 

	
 
	if (IsBuoyTile(current->tile) && IsDiagonalTrackdir(trackdir))
 
		cost += _settings.pf.npf.npf_buoy_penalty; // A small penalty for going over buoys
 
		cost += _settings_game.pf.npf.npf_buoy_penalty; // A small penalty for going over buoys
 

	
 
	if (current->direction != NextTrackdir((Trackdir)parent->path.node.direction))
 
		cost += _settings.pf.npf.npf_water_curve_penalty;
 
		cost += _settings_game.pf.npf.npf_water_curve_penalty;
 

	
 
	/* @todo More penalties? */
 

	
 
@@ -285,13 +285,13 @@ static int32 NPFRoadPathCost(AyStar* as,
 
		case MP_ROAD:
 
			cost = NPF_TILE_LENGTH;
 
			/* Increase the cost for level crossings */
 
			if (IsLevelCrossing(tile)) cost += _settings.pf.npf.npf_crossing_penalty;
 
			if (IsLevelCrossing(tile)) cost += _settings_game.pf.npf.npf_crossing_penalty;
 
			break;
 

	
 
		case MP_STATION:
 
			cost = NPF_TILE_LENGTH;
 
			/* Increase the cost for drive-through road stops */
 
			if (IsDriveThroughStopTile(tile)) cost += _settings.pf.npf.npf_road_drive_through_penalty;
 
			if (IsDriveThroughStopTile(tile)) cost += _settings_game.pf.npf.npf_road_drive_through_penalty;
 
			break;
 

	
 
		default:
 
@@ -306,7 +306,7 @@ static int32 NPFRoadPathCost(AyStar* as,
 
	/* Check for turns. Road vehicles only really drive diagonal, turns are
 
	 * represented by non-diagonal tracks */
 
	if (!IsDiagonalTrackdir((Trackdir)current->direction))
 
		cost += _settings.pf.npf.npf_road_curve_penalty;
 
		cost += _settings_game.pf.npf.npf_road_curve_penalty;
 

	
 
	NPFMarkTile(tile);
 
	DEBUG(npf, 4, "Calculating G for: (%d, %d). Result: %d", TileX(current->tile), TileY(current->tile), cost);
 
@@ -344,7 +344,7 @@ static int32 NPFRailPathCost(AyStar* as,
 
			 * give any station tile a penalty, because every possible route will get
 
			 * this penalty exactly once, on its end tile (if it's a station) and it
 
			 * will therefore not make a difference. */
 
			cost = NPF_TILE_LENGTH + _settings.pf.npf.npf_rail_station_penalty;
 
			cost = NPF_TILE_LENGTH + _settings_game.pf.npf.npf_rail_station_penalty;
 
			break;
 

	
 
		default:
 
@@ -366,9 +366,9 @@ static int32 NPFRailPathCost(AyStar* as,
 
				SignalType sigtype = GetSignalType(tile, TrackdirToTrack(trackdir));
 
				if (sigtype == SIGTYPE_EXIT || sigtype == SIGTYPE_COMBO) {
 
					/* Penalise exit and combo signals differently (heavier) */
 
					cost += _settings.pf.npf.npf_rail_firstred_exit_penalty;
 
					cost += _settings_game.pf.npf.npf_rail_firstred_exit_penalty;
 
				} else {
 
					cost += _settings.pf.npf.npf_rail_firstred_penalty;
 
					cost += _settings_game.pf.npf.npf_rail_firstred_penalty;
 
				}
 
			}
 
			/* Record the state of this signal */
 
@@ -386,14 +386,14 @@ static int32 NPFRailPathCost(AyStar* as,
 
	 * of course... */
 
	new_node.path.node = *current;
 
	if (as->EndNodeCheck(as, &new_node) == AYSTAR_FOUND_END_NODE && NPFGetFlag(current, NPF_FLAG_LAST_SIGNAL_RED))
 
		cost += _settings.pf.npf.npf_rail_lastred_penalty;
 
		cost += _settings_game.pf.npf.npf_rail_lastred_penalty;
 

	
 
	/* Check for slope */
 
	cost += NPFSlopeCost(current);
 

	
 
	/* Check for turns */
 
	if (current->direction != NextTrackdir((Trackdir)parent->path.node.direction))
 
		cost += _settings.pf.npf.npf_rail_curve_penalty;
 
		cost += _settings_game.pf.npf.npf_rail_curve_penalty;
 
	/*TODO, with realistic acceleration, also the amount of straight track between
 
	 *      curves should be taken into account, as this affects the speed limit. */
 

	
 
@@ -402,7 +402,7 @@ static int32 NPFRailPathCost(AyStar* as,
 
		/* Penalise any depot tile that is not the last tile in the path. This
 
		 * _should_ penalise every occurence of reversing in a depot (and only
 
		 * that) */
 
		cost += _settings.pf.npf.npf_rail_depot_reverse_penalty;
 
		cost += _settings_game.pf.npf.npf_rail_depot_reverse_penalty;
 
	}
 

	
 
	/* Check for occupied track */
 
@@ -634,7 +634,7 @@ static TrackdirBits GetDriveableTrackdir
 
	trackdirbits &= TrackdirReachesTrackdirs(src_trackdir);
 

	
 
	/* Filter out trackdirs that would make 90 deg turns for trains */
 
	if (_settings.pf.forbid_90_deg && (type == TRANSPORT_RAIL || type == TRANSPORT_WATER)) trackdirbits &= ~TrackdirCrossesTrackdirs(src_trackdir);
 
	if (_settings_game.pf.forbid_90_deg && (type == TRANSPORT_RAIL || type == TRANSPORT_WATER)) trackdirbits &= ~TrackdirCrossesTrackdirs(src_trackdir);
 

	
 
	DEBUG(npf, 6, "After filtering: (%d, %d), possible trackdirs: 0x%X", TileX(dst_tile), TileY(dst_tile), trackdirbits);
 

	
 
@@ -970,7 +970,7 @@ void InitializeNPF()
 
	//_npf_aystar.max_search_nodes = 0;
 
	/* We will limit the number of nodes for now, until we have a better
 
	 * solution to really fix performance */
 
	_npf_aystar.max_search_nodes = _settings.pf.npf.npf_max_search_nodes;
 
	_npf_aystar.max_search_nodes = _settings_game.pf.npf.npf_max_search_nodes;
 
}
 

	
 
void NPFFillWithOrderData(NPFFindStationOrTileData* fstd, Vehicle* v)
src/oldloader.cpp
Show inline comments
 
@@ -319,8 +319,8 @@ static void FixOldTowns()
 
	/* Convert town-names if needed */
 
	FOR_ALL_TOWNS(town) {
 
		if (IsInsideMM(town->townnametype, 0x20C1, 0x20C3)) {
 
			town->townnametype = SPECSTR_TOWNNAME_ENGLISH + _settings.game_creation.town_name;
 
			town->townnameparts = GetOldTownName(town->townnameparts, _settings.game_creation.town_name);
 
			town->townnametype = SPECSTR_TOWNNAME_ENGLISH + _settings_game.game_creation.town_name;
 
			town->townnameparts = GetOldTownName(town->townnameparts, _settings_game.game_creation.town_name);
 
		}
 
	}
 
}
 
@@ -1392,8 +1392,8 @@ static const OldChunks game_difficulty_c
 

	
 
static inline bool LoadOldGameDifficulty(LoadgameState *ls, int num)
 
{
 
	bool ret = LoadChunk(ls, &_settings.difficulty, game_difficulty_chunk);
 
	_settings.difficulty.max_loan *= 1000;
 
	bool ret = LoadChunk(ls, &_settings_game.difficulty, game_difficulty_chunk);
 
	_settings_game.difficulty.max_loan *= 1000;
 
	return ret;
 
}
 

	
 
@@ -1572,8 +1572,8 @@ static const OldChunks main_chunk[] = {
 

	
 
	OCL_VAR ( OC_FILE_U8 | OC_VAR_U16,    1, &_station_tick_ctr ),
 

	
 
	OCL_VAR (  OC_UINT8,    1, &_settings.gui.currency ),
 
	OCL_VAR (  OC_UINT8,    1, &_settings.gui.units ),
 
	OCL_VAR (  OC_UINT8,    1, &_settings_client.gui.currency ),
 
	OCL_VAR (  OC_UINT8,    1, &_settings_client.gui.units ),
 
	OCL_VAR ( OC_FILE_U8 | OC_VAR_U32,    1, &_cur_player_tick_index ),
 

	
 
	OCL_NULL( 2 ),               ///< Date stuff, calculated automatically
 
@@ -1583,19 +1583,19 @@ static const OldChunks main_chunk[] = {
 
	OCL_VAR (  OC_UINT8,    1, &_economy.infl_amount_pr ),
 
	OCL_VAR (  OC_UINT8,    1, &_economy.interest_rate ),
 
	OCL_NULL( 1 ), // available airports
 
	OCL_VAR (  OC_UINT8,    1, &_settings.vehicle.road_side ),
 
	OCL_VAR (  OC_UINT8,    1, &_settings.game_creation.town_name ),
 
	OCL_VAR (  OC_UINT8,    1, &_settings_game.vehicle.road_side ),
 
	OCL_VAR (  OC_UINT8,    1, &_settings_game.game_creation.town_name ),
 

	
 
	OCL_CHUNK( 1, LoadOldGameDifficulty ),
 

	
 
	OCL_ASSERT( 0x77130 ),
 

	
 
	OCL_VAR (  OC_UINT8,    1, &_settings.difficulty.diff_level ),
 
	OCL_VAR (  OC_UINT8,    1, &_settings.game_creation.landscape ),
 
	OCL_VAR (  OC_UINT8,    1, &_settings_game.difficulty.diff_level ),
 
	OCL_VAR (  OC_UINT8,    1, &_settings_game.game_creation.landscape ),
 
	OCL_VAR (  OC_UINT8,    1, &_trees_tick_ctr ),
 

	
 
	OCL_NULL( 1 ),               ///< Custom vehicle types yes/no, no longer used
 
	OCL_VAR (  OC_UINT8,    1, &_settings.game_creation.snow_line ),
 
	OCL_VAR (  OC_UINT8,    1, &_settings_game.game_creation.snow_line ),
 

	
 
	OCL_NULL( 32 ),              ///< new_industry_randtable, no longer used (because of new design)
 
	OCL_NULL( 36 ),              ///< cargo-stuff, calculated in InitializeLandscapeVariables
 
@@ -1630,7 +1630,7 @@ static bool LoadOldMain(LoadgameState *l
 
	DEBUG(oldloader, 3, "Done, converting game data...");
 

	
 
	/* Fix some general stuff */
 
	_settings.game_creation.landscape = _settings.game_creation.landscape & 0xF;
 
	_settings_game.game_creation.landscape = _settings_game.game_creation.landscape & 0xF;
 

	
 
	/* Remap some pointers */
 
	_cur_town_ctr      = REMAP_TOWN_IDX(_old_cur_town_ctr);
 
@@ -1692,7 +1692,7 @@ static bool LoadOldMain(LoadgameState *l
 
	FixOldVehicles();
 

	
 
	/* We have a new difficulty setting */
 
	_settings.difficulty.town_council_tolerance = Clamp(_settings.difficulty.diff_level, 0, 2);
 
	_settings_game.difficulty.town_council_tolerance = Clamp(_settings_game.difficulty.diff_level, 0, 2);
 

	
 
	DEBUG(oldloader, 3, "Finished converting game data");
 
	DEBUG(oldloader, 1, "TTD(Patch) savegame successfully converted");
src/openttd.cpp
Show inline comments
 
@@ -580,7 +580,7 @@ int ttd_main(int argc, char *argv[])
 
	if (_settings_newgame.difficulty.diff_level == 9) SetDifficultyLevel(0, &_settings_newgame.difficulty);
 

	
 
	/* Make sure _settings is filled with _settings_newgame if we switch to a game directly */
 
	if (_switch_mode != SM_NONE) _settings = _settings_newgame;
 
	if (_switch_mode != SM_NONE) _settings_game = _settings_newgame;
 

	
 
	/* initialize the ingame console */
 
	IConsoleInit();
 
@@ -640,7 +640,7 @@ void HandleExitGameRequest()
 
{
 
	if (_game_mode == GM_MENU) { // do not ask to quit on the main screen
 
		_exit_game = true;
 
	} else if (_settings.gui.autosave_on_exit) {
 
	} else if (_settings_client.gui.autosave_on_exit) {
 
		DoExitSave();
 
		_exit_game = true;
 
	} else {
 
@@ -672,9 +672,9 @@ static void MakeNewGameDone()
 

	
 
	SetLocalPlayer(PLAYER_FIRST);
 
	_current_player = _local_player;
 
	DoCommandP(0, (_settings.gui.autorenew << 15 ) | (_settings.gui.autorenew_months << 16) | 4, _settings.gui.autorenew_money, NULL, CMD_SET_AUTOREPLACE);
 
	DoCommandP(0, (_settings_client.gui.autorenew << 15 ) | (_settings_client.gui.autorenew_months << 16) | 4, _settings_client.gui.autorenew_money, NULL, CMD_SET_AUTOREPLACE);
 

	
 
	SettingsDisableElrail(_settings.vehicle.disable_elrails);
 
	SettingsDisableElrail(_settings_game.vehicle.disable_elrails);
 
	InitializeRailGUI();
 

	
 
#ifdef ENABLE_NETWORK
 
@@ -699,7 +699,7 @@ static void MakeNewGame(bool from_height
 
	_industry_mngr.ResetMapping();
 

	
 
	GenerateWorldSetCallback(&MakeNewGameDone);
 
	GenerateWorld(from_heightmap ? GW_HEIGHTMAP : GW_NEWGAME, 1 << _settings.game_creation.map_x, 1 << _settings.game_creation.map_y);
 
	GenerateWorld(from_heightmap ? GW_HEIGHTMAP : GW_NEWGAME, 1 << _settings_game.game_creation.map_x, 1 << _settings_game.game_creation.map_y);
 
}
 

	
 
static void MakeNewEditorWorldDone()
 
@@ -716,7 +716,7 @@ static void MakeNewEditorWorld()
 
	ResetGRFConfig(true);
 

	
 
	GenerateWorldSetCallback(&MakeNewEditorWorldDone);
 
	GenerateWorld(GW_EMPTY, 1 << _settings.game_creation.map_x, 1 << _settings.game_creation.map_y);
 
	GenerateWorld(GW_EMPTY, 1 << _settings_game.game_creation.map_x, 1 << _settings_game.game_creation.map_y);
 
}
 

	
 
void StartupPlayers();
 
@@ -755,7 +755,7 @@ static void StartScenario()
 
		ShowErrorMessage(INVALID_STRING_ID, STR_012D, 0, 0);
 
	}
 

	
 
	_settings.difficulty = _settings_newgame.difficulty;
 
	_settings_game.difficulty = _settings_newgame.difficulty;
 

	
 
	/* Inititalize data */
 
	StartupEconomy();
 
@@ -765,7 +765,7 @@ static void StartScenario()
 

	
 
	SetLocalPlayer(PLAYER_FIRST);
 
	_current_player = _local_player;
 
	DoCommandP(0, (_settings.gui.autorenew << 15 ) | (_settings.gui.autorenew_months << 16) | 4, _settings.gui.autorenew_money, NULL, CMD_SET_AUTOREPLACE);
 
	DoCommandP(0, (_settings_client.gui.autorenew << 15 ) | (_settings_client.gui.autorenew_months << 16) | 4, _settings_client.gui.autorenew_money, NULL, CMD_SET_AUTOREPLACE);
 

	
 
	MarkWholeScreenDirty();
 
}
 
@@ -824,7 +824,7 @@ void SwitchMode(int new_mode)
 
				/* check if we should reload the config */
 
				if (_network_reload_cfg) {
 
					LoadFromConfig();
 
					_settings = _settings_newgame;
 
					_settings_game = _settings_newgame;
 
					ResetGRFConfig(false);
 
				}
 
				NetworkServerStart();
 
@@ -897,7 +897,7 @@ void SwitchMode(int new_mode)
 
		case SM_LOAD_HEIGHTMAP: /* Load heightmap from scenario editor */
 
			SetLocalPlayer(OWNER_NONE);
 

	
 
			GenerateWorld(GW_HEIGHTMAP, 1 << _settings.game_creation.map_x, 1 << _settings.game_creation.map_y);
 
			GenerateWorld(GW_HEIGHTMAP, 1 << _settings_game.game_creation.map_x, 1 << _settings_game.game_creation.map_y);
 
			MarkWholeScreenDirty();
 
			break;
 

	
 
@@ -930,7 +930,7 @@ void SwitchMode(int new_mode)
 

	
 
		case SM_GENRANDLAND: /* Generate random land within scenario editor */
 
			SetLocalPlayer(OWNER_NONE);
 
			GenerateWorld(GW_RANDOM, 1 << _settings.game_creation.map_x, 1 << _settings.game_creation.map_y);
 
			GenerateWorld(GW_RANDOM, 1 << _settings_game.game_creation.map_x, 1 << _settings_game.game_creation.map_y);
 
			/* XXX: set date */
 
			MarkWholeScreenDirty();
 
			break;
 
@@ -1046,16 +1046,16 @@ static void DoAutosave()
 
	if (_networking) return;
 
#endif /* PSP */
 

	
 
	if (_settings.gui.keep_all_autosave && _local_player != PLAYER_SPECTATOR) {
 
	if (_settings_client.gui.keep_all_autosave && _local_player != PLAYER_SPECTATOR) {
 
		SetDParam(0, _local_player);
 
		SetDParam(1, _date);
 
		GetString(buf, STR_4004, lastof(buf));
 
		ttd_strlcat(buf, ".sav", lengthof(buf));
 
	} else {
 
		/* generate a savegame name and number according to _settings.gui.max_num_autosaves */
 
		/* generate a savegame name and number according to _settings_client.gui.max_num_autosaves */
 
		snprintf(buf, sizeof(buf), "autosave%d.sav", _autosave_ctr);
 

	
 
		if (++_autosave_ctr >= _settings.gui.max_num_autosaves) _autosave_ctr = 0;
 
		if (++_autosave_ctr >= _settings_client.gui.max_num_autosaves) _autosave_ctr = 0;
 
	}
 

	
 
	DEBUG(sl, 2, "Autosaving to '%s'", buf);
 
@@ -1178,7 +1178,7 @@ static const byte convert_currency[] = {
 
/* since savegame version 4.2 the currencies are arranged differently */
 
static void UpdateCurrencies()
 
{
 
	_settings.gui.currency = convert_currency[_settings.gui.currency];
 
	_settings_client.gui.currency = convert_currency[_settings_client.gui.currency];
 
}
 

	
 
/* Up to revision 1413 the invisible tiles at the southern border have not been
 
@@ -1301,7 +1301,7 @@ bool AfterLoadGame()
 
		Town *t;
 
		FOR_ALL_TOWNS(t) {
 
			t->name = CopyFromOldName(t->townnametype);
 
			if (t->name != NULL) t->townnametype = SPECSTR_TOWNNAME_START + _settings.game_creation.town_name;
 
			if (t->name != NULL) t->townnametype = SPECSTR_TOWNNAME_START + _settings_game.game_creation.town_name;
 
		}
 

	
 
		Waypoint *wp;
 
@@ -1315,7 +1315,7 @@ bool AfterLoadGame()
 
	ResetOldNames();
 

	
 
	/* convert road side to my format. */
 
	if (_settings.vehicle.road_side) _settings.vehicle.road_side = 1;
 
	if (_settings_game.vehicle.road_side) _settings_game.vehicle.road_side = 1;
 

	
 
	/* Check if all NewGRFs are present, we are very strict in MP mode */
 
	GRFListCompatibility gcf_res = IsGoodGRFConfigList();
 
@@ -1335,7 +1335,7 @@ bool AfterLoadGame()
 
	SetDate(_date);
 

	
 
	/* Force dynamic engines off when loading older savegames */
 
	if (CheckSavegameVersion(95)) _settings.vehicle.dynamic_engines = 0;
 
	if (CheckSavegameVersion(95)) _settings_game.vehicle.dynamic_engines = 0;
 

	
 
	/* Load the sprites */
 
	GfxLoadSprites();
 
@@ -1542,9 +1542,9 @@ bool AfterLoadGame()
 
		 */
 
		if (!_network_dedicated && IsValidPlayer(PLAYER_FIRST)) {
 
			p = GetPlayer(PLAYER_FIRST);
 
			p->engine_renew        = _settings.gui.autorenew;
 
			p->engine_renew_months = _settings.gui.autorenew_months;
 
			p->engine_renew_money  = _settings.gui.autorenew_money;
 
			p->engine_renew        = _settings_client.gui.autorenew;
 
			p->engine_renew_months = _settings_client.gui.autorenew_months;
 
			p->engine_renew_money  = _settings_client.gui.autorenew_money;
 
		}
 
	}
 

	
 
@@ -1927,9 +1927,9 @@ bool AfterLoadGame()
 

	
 
	/* from version 38 we have optional elrails, since we cannot know the
 
	 * preference of a user, let elrails enabled; it can be disabled manually */
 
	if (CheckSavegameVersion(38)) _settings.vehicle.disable_elrails = false;
 
	if (CheckSavegameVersion(38)) _settings_game.vehicle.disable_elrails = false;
 
	/* do the same as when elrails were enabled/disabled manually just now */
 
	SettingsDisableElrail(_settings.vehicle.disable_elrails);
 
	SettingsDisableElrail(_settings_game.vehicle.disable_elrails);
 
	InitializeRailGUI();
 

	
 
	/* From version 53, the map array was changed for house tiles to allow
 
@@ -2094,7 +2094,7 @@ bool AfterLoadGame()
 
		Town *t;
 

	
 
		FOR_ALL_TOWNS(t) {
 
			if (_settings.economy.larger_towns != 0 && (t->index % _settings.economy.larger_towns) == 0) {
 
			if (_settings_game.economy.larger_towns != 0 && (t->index % _settings_game.economy.larger_towns) == 0) {
 
				t->larger_town = true;
 
			}
 
		}
 
@@ -2131,12 +2131,12 @@ bool AfterLoadGame()
 
	if (CheckSavegameVersion(58)) {
 
		/* patch difficulty number_industries other then zero get bumped to +1
 
		 * since a new option (very low at position1) has been added */
 
		if (_settings.difficulty.number_industries > 0) {
 
			_settings.difficulty.number_industries++;
 
		if (_settings_game.difficulty.number_industries > 0) {
 
			_settings_game.difficulty.number_industries++;
 
		}
 

	
 
		/* Same goes for number of towns, although no test is needed, just an increment */
 
		_settings.difficulty.number_towns++;
 
		_settings_game.difficulty.number_towns++;
 
	}
 

	
 
	if (CheckSavegameVersion(64)) {
 
@@ -2369,22 +2369,22 @@ bool AfterLoadGame()
 
		}
 

	
 
		/* Convert old PF settings to new */
 
		if (_settings.pf.yapf.rail_use_yapf || CheckSavegameVersion(28)) {
 
			_settings.pf.pathfinder_for_trains = VPF_YAPF;
 
		if (_settings_game.pf.yapf.rail_use_yapf || CheckSavegameVersion(28)) {
 
			_settings_game.pf.pathfinder_for_trains = VPF_YAPF;
 
		} else {
 
			_settings.pf.pathfinder_for_trains = (_settings.pf.new_pathfinding_all ? VPF_NPF : VPF_NTP);
 
			_settings_game.pf.pathfinder_for_trains = (_settings_game.pf.new_pathfinding_all ? VPF_NPF : VPF_NTP);
 
		}
 

	
 
		if (_settings.pf.yapf.road_use_yapf || CheckSavegameVersion(28)) {
 
			_settings.pf.pathfinder_for_roadvehs = VPF_YAPF;
 
		if (_settings_game.pf.yapf.road_use_yapf || CheckSavegameVersion(28)) {
 
			_settings_game.pf.pathfinder_for_roadvehs = VPF_YAPF;
 
		} else {
 
			_settings.pf.pathfinder_for_roadvehs = (_settings.pf.new_pathfinding_all ? VPF_NPF : VPF_OPF);
 
			_settings_game.pf.pathfinder_for_roadvehs = (_settings_game.pf.new_pathfinding_all ? VPF_NPF : VPF_OPF);
 
		}
 

	
 
		if (_settings.pf.yapf.ship_use_yapf) {
 
			_settings.pf.pathfinder_for_ships = VPF_YAPF;
 
		if (_settings_game.pf.yapf.ship_use_yapf) {
 
			_settings_game.pf.pathfinder_for_ships = VPF_YAPF;
 
		} else {
 
			_settings.pf.pathfinder_for_ships = (_settings.pf.new_pathfinding_all ? VPF_NPF : VPF_OPF);
 
			_settings_game.pf.pathfinder_for_ships = (_settings_game.pf.new_pathfinding_all ? VPF_NPF : VPF_OPF);
 
		}
 
	}
 

	
src/order_cmd.cpp
Show inline comments
 
@@ -156,7 +156,7 @@ void Order::ConvertFromOldSavegame()
 
	this->flags = 0;
 

	
 
	/* First handle non-stop */
 
	if (_settings.gui.sg_new_nonstop) {
 
	if (_settings_client.gui.sg_new_nonstop) {
 
		/* OFB_NON_STOP */
 
		this->SetNonStopType((old_flags & 8) ? ONSF_NO_STOP_AT_ANY_STATION : ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
 
	} else {
 
@@ -176,7 +176,7 @@ void Order::ConvertFromOldSavegame()
 
		} else if ((old_flags & 4) == 0) { // !OFB_FULL_LOAD
 
			this->SetLoadType(OLF_LOAD_IF_POSSIBLE);
 
		} else {
 
			this->SetLoadType(_settings.gui.sg_full_load_any ? OLF_FULL_LOAD_ANY : OLFB_FULL_LOAD);
 
			this->SetLoadType(_settings_client.gui.sg_full_load_any ? OLF_FULL_LOAD_ANY : OLFB_FULL_LOAD);
 
		}
 

	
 
		/* Finally fix the unload flags */
 
@@ -455,7 +455,7 @@ CommandCost CmdInsertOrder(TileIndex til
 

	
 
	if (!HasOrderPoolFree(1)) return_cmd_error(STR_8831_NO_MORE_SPACE_FOR_ORDERS);
 

	
 
	if (v->type == VEH_SHIP && IsHumanPlayer(v->owner) && _settings.pf.pathfinder_for_ships != VPF_NPF) {
 
	if (v->type == VEH_SHIP && IsHumanPlayer(v->owner) && _settings_game.pf.pathfinder_for_ships != VPF_NPF) {
 
		/* Make sure the new destination is not too far away from the previous */
 
		const Order *prev = NULL;
 
		uint n = 0;
 
@@ -1277,7 +1277,7 @@ void RestoreVehicleOrders(const Vehicle 
 
			}
 

	
 
			/* Copy timetable if enabled */
 
			if (_settings.order.timetabling && !DoCommandP(0, v->index | (i << 16) | (1 << 25),
 
			if (_settings_game.order.timetabling && !DoCommandP(0, v->index | (i << 16) | (1 << 25),
 
					bak->order[i].wait_time << 16 | bak->order[i].travel_time, NULL,
 
					CMD_CHANGE_TIMETABLE | CMD_NO_TEST_IF_IN_NETWORK)) {
 
				break;
 
@@ -1390,13 +1390,13 @@ static TileIndex GetStationTileForVehicl
 
void CheckOrders(const Vehicle* v)
 
{
 
	/* Does the user wants us to check things? */
 
	if (_settings.gui.order_review_system == 0) return;
 
	if (_settings_client.gui.order_review_system == 0) return;
 

	
 
	/* Do nothing for crashed vehicles */
 
	if (v->vehstatus & VS_CRASHED) return;
 

	
 
	/* Do nothing for stopped vehicles if setting is '1' */
 
	if (_settings.gui.order_review_system == 1 && v->vehstatus & VS_STOPPED)
 
	if (_settings_client.gui.order_review_system == 1 && v->vehstatus & VS_STOPPED)
 
		return;
 

	
 
	/* do nothing we we're not the first vehicle in a share-chain */
 
@@ -1575,7 +1575,7 @@ void DeleteVehicleOrders(Vehicle *v)
 

	
 
Date GetServiceIntervalClamped(uint index)
 
{
 
	return (_settings.vehicle.servint_ispercent) ? Clamp(index, MIN_SERVINT_PERCENT, MAX_SERVINT_PERCENT) : Clamp(index, MIN_SERVINT_DAYS, MAX_SERVINT_DAYS);
 
	return (_settings_game.vehicle.servint_ispercent) ? Clamp(index, MIN_SERVINT_PERCENT, MAX_SERVINT_PERCENT) : Clamp(index, MIN_SERVINT_DAYS, MAX_SERVINT_DAYS);
 
}
 

	
 
/**
src/order_gui.cpp
Show inline comments
 
@@ -265,13 +265,13 @@ static Order GetOrderCmdFromTile(const V
 
	order.index = 0;
 

	
 
	/* check depot first */
 
	if (_settings.order.gotodepot) {
 
	if (_settings_game.order.gotodepot) {
 
		switch (GetTileType(tile)) {
 
			case MP_RAILWAY:
 
				if (v->type == VEH_TRAIN && IsTileOwner(tile, _local_player)) {
 
					if (IsRailDepot(tile)) {
 
						order.MakeGoToDepot(GetDepotByTile(tile)->index, ODTFB_PART_OF_ORDERS);
 
						if (_settings.gui.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
 
						if (_settings_client.gui.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
 
						return order;
 
					}
 
				}
 
@@ -280,7 +280,7 @@ static Order GetOrderCmdFromTile(const V
 
			case MP_ROAD:
 
				if (IsRoadDepot(tile) && v->type == VEH_ROAD && IsTileOwner(tile, _local_player)) {
 
					order.MakeGoToDepot(GetDepotByTile(tile)->index, ODTFB_PART_OF_ORDERS);
 
					if (_settings.gui.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
 
					if (_settings_client.gui.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
 
					return order;
 
				}
 
				break;
 
@@ -313,7 +313,7 @@ static Order GetOrderCmdFromTile(const V
 
			IsTileOwner(tile, _local_player) &&
 
			IsRailWaypoint(tile)) {
 
		order.MakeGoToWaypoint(GetWaypointByTile(tile)->index);
 
		if (_settings.gui.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
 
		if (_settings_client.gui.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
 
		return order;
 
	}
 

	
 
@@ -330,7 +330,7 @@ static Order GetOrderCmdFromTile(const V
 
			(facil = FACIL_TRUCK_STOP, 1);
 
			if (st->facilities & facil) {
 
				order.MakeGoToStation(st_index);
 
				if (_settings.gui.new_nonstop && (v->type == VEH_TRAIN || v->type == VEH_ROAD)) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
 
				if (_settings_client.gui.new_nonstop && (v->type == VEH_TRAIN || v->type == VEH_ROAD)) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
 
				return order;
 
			}
 
		}
 
@@ -611,7 +611,7 @@ public:
 
		this->resize.step_height = 10;
 
		this->selected_order = -1;
 
		this->vehicle = v;
 
		if (_settings.order.timetabling) {
 
		if (_settings_game.order.timetabling) {
 
			this->widget[ORDER_WIDGET_CAPTION].right -= 61;
 
		} else {
 
			this->HideWidget(ORDER_WIDGET_TIMETABLE_VIEW);
src/pathfind.cpp
Show inline comments
 
@@ -778,7 +778,7 @@ void NewTrainPathfind(TileIndex tile, Ti
 
	tpf->enum_proc = enum_proc;
 
	tpf->tracktype = TRANSPORT_RAIL;
 
	tpf->railtypes = railtypes;
 
	tpf->maxlength = min(_settings.pf.opf.pf_maxlength * 3, 10000);
 
	tpf->maxlength = min(_settings_game.pf.opf.pf_maxlength * 3, 10000);
 
	tpf->nstack = 0;
 
	tpf->new_link = tpf->links;
 
	tpf->num_links_left = lengthof(tpf->links);
src/player_gui.cpp
Show inline comments
 
@@ -1191,7 +1191,7 @@ struct PlayerCompanyWindow : Window
 
		this->SetWidgetHiddenState(PCW_WIDGET_COMPANY_PASSWORD, !local || !_networking);
 

	
 
		if (!local) {
 
			if (_settings.economy.allow_shares) { // Shares are allowed
 
			if (_settings_game.economy.allow_shares) { // Shares are allowed
 
				/* If all shares are owned by someone (none by nobody), disable buy button */
 
				this->SetWidgetDisabledState(PCW_WIDGET_BUY_SHARE, GetAmountOwnedBy(p, PLAYER_SPECTATOR) == 0 ||
 
						/* Only 25% left to buy. If the player is human, disable buying it up.. TODO issues! */
 
@@ -1477,7 +1477,7 @@ struct EndGameWindow : EndGameHighScoreB
 
		} else {
 
			/* in single player _local player is always valid */
 
			const Player *p = GetPlayer(_local_player);
 
			this->window_number = _settings.difficulty.diff_level;
 
			this->window_number = _settings_game.difficulty.diff_level;
 
			this->rank = SaveHighScoreValue(p);
 
		}
 

	
 
@@ -1545,7 +1545,7 @@ struct HighScoreWindow : EndGameHighScor
 

	
 
		this->SetupHighScoreEndWindow(&x, &y);
 

	
 
		SetDParam(0, _settings.gui.ending_year);
 
		SetDParam(0, _settings_client.gui.ending_year);
 
		SetDParam(1, this->window_number + STR_6801_EASY);
 
		DrawStringMultiCenter(x + (640 / 2), y + 62, !_networking ? STR_0211_TOP_COMPANIES_WHO_REACHED : STR_TOP_COMPANIES_NETWORK_GAME, 500);
 

	
src/players.cpp
Show inline comments
 
@@ -65,9 +65,9 @@ void SetLocalPlayer(PlayerID new_player)
 
	/* Do not update the patches if we are in the intro GUI */
 
	if (IsValidPlayer(new_player) && _game_mode != GM_MENU) {
 
		const Player *p = GetPlayer(new_player);
 
		_settings.gui.autorenew        = p->engine_renew;
 
		_settings.gui.autorenew_months = p->engine_renew_months;
 
		_settings.gui.autorenew_money  = p->engine_renew_money;
 
		_settings_client.gui.autorenew        = p->engine_renew;
 
		_settings_client.gui.autorenew_months = p->engine_renew_months;
 
		_settings_client.gui.autorenew_money  = p->engine_renew_money;
 
		InvalidateWindow(WC_GAME_OPTIONS, 0);
 
	}
 
}
 
@@ -541,9 +541,9 @@ Player *DoStartupNewPlayer(bool is_ai)
 
	/* Engine renewal settings */
 
	p->engine_renew_list = NULL;
 
	p->renew_keep_length = false;
 
	p->engine_renew = _settings_newgame.gui.autorenew;
 
	p->engine_renew_months = _settings_newgame.gui.autorenew_months;
 
	p->engine_renew_money = _settings_newgame.gui.autorenew_money;
 
	p->engine_renew = _settings_client.gui.autorenew;
 
	p->engine_renew_months = _settings_client.gui.autorenew_months;
 
	p->engine_renew_money = _settings_client.gui.autorenew_money;
 

	
 
	GeneratePresidentName(p);
 

	
 
@@ -563,7 +563,7 @@ Player *DoStartupNewPlayer(bool is_ai)
 
void StartupPlayers()
 
{
 
	/* The AI starts like in the setting with +2 month max */
 
	_next_competitor_start = _settings.difficulty.competitor_start_time * 90 * DAY_TICKS + RandomRange(60 * DAY_TICKS) + 1;
 
	_next_competitor_start = _settings_game.difficulty.competitor_start_time * 90 * DAY_TICKS + RandomRange(60 * DAY_TICKS) + 1;
 
}
 

	
 
static void MaybeStartNewPlayer()
 
@@ -578,10 +578,10 @@ static void MaybeStartNewPlayer()
 
	}
 

	
 
	/* when there's a lot of computers in game, the probability that a new one starts is lower */
 
	if (n < (uint)_settings.difficulty.max_no_competitors &&
 
	if (n < (uint)_settings_game.difficulty.max_no_competitors &&
 
			n < (_network_server ?
 
				InteractiveRandomRange(_settings.difficulty.max_no_competitors + 2) :
 
				RandomRange(_settings.difficulty.max_no_competitors + 2)
 
				InteractiveRandomRange(_settings_game.difficulty.max_no_competitors + 2) :
 
				RandomRange(_settings_game.difficulty.max_no_competitors + 2)
 
			)) {
 
		/* Send a command to all clients to start up a new AI.
 
		 * Works fine for Multiplayer and Singleplayer */
 
@@ -589,7 +589,7 @@ static void MaybeStartNewPlayer()
 
	}
 

	
 
	/* The next AI starts like the difficulty setting said, with +2 month max */
 
	_next_competitor_start = _settings.difficulty.competitor_start_time * 90 * DAY_TICKS + 1;
 
	_next_competitor_start = _settings_game.difficulty.competitor_start_time * 90 * DAY_TICKS + 1;
 
	_next_competitor_start += _network_server ? InteractiveRandomRange(60 * DAY_TICKS) : RandomRange(60 * DAY_TICKS);
 
}
 

	
 
@@ -630,7 +630,7 @@ void PlayersYearlyLoop()
 
		}
 
	}
 

	
 
	if (_settings.gui.show_finances && _local_player != PLAYER_SPECTATOR) {
 
	if (_settings_client.gui.show_finances && _local_player != PLAYER_SPECTATOR) {
 
		ShowPlayerFinances(_local_player);
 
		p = GetPlayer(_local_player);
 
		if (p->num_valid_stat_ent > 5 && p->old_economy[0].performance_history < p->old_economy[4].performance_history) {
 
@@ -695,7 +695,7 @@ CommandCost CmdSetAutoReplace(TileIndex 
 
			if (flags & DC_EXEC) {
 
				p->engine_renew = HasBit(p2, 0);
 
				if (IsLocalPlayer()) {
 
					_settings.gui.autorenew = p->engine_renew;
 
					_settings_client.gui.autorenew = p->engine_renew;
 
					InvalidateWindow(WC_GAME_OPTIONS, 0);
 
				}
 
			}
 
@@ -708,7 +708,7 @@ CommandCost CmdSetAutoReplace(TileIndex 
 
			if (flags & DC_EXEC) {
 
				p->engine_renew_months = (int16)p2;
 
				if (IsLocalPlayer()) {
 
					_settings.gui.autorenew_months = p->engine_renew_months;
 
					_settings_client.gui.autorenew_months = p->engine_renew_months;
 
					InvalidateWindow(WC_GAME_OPTIONS, 0);
 
				}
 
			}
 
@@ -721,7 +721,7 @@ CommandCost CmdSetAutoReplace(TileIndex 
 
			if (flags & DC_EXEC) {
 
				p->engine_renew_money = p2;
 
				if (IsLocalPlayer()) {
 
					_settings.gui.autorenew_money = p->engine_renew_money;
 
					_settings_client.gui.autorenew_money = p->engine_renew_money;
 
					InvalidateWindow(WC_GAME_OPTIONS, 0);
 
				}
 
			}
 
@@ -771,9 +771,9 @@ CommandCost CmdSetAutoReplace(TileIndex 
 
				p->engine_renew_money = p2;
 

	
 
				if (IsLocalPlayer()) {
 
					_settings.gui.autorenew = p->engine_renew;
 
					_settings.gui.autorenew_months = p->engine_renew_months;
 
					_settings.gui.autorenew_money = p->engine_renew_money;
 
					_settings_client.gui.autorenew = p->engine_renew;
 
					_settings_client.gui.autorenew_months = p->engine_renew_months;
 
					_settings_client.gui.autorenew_money = p->engine_renew_money;
 
					InvalidateWindow(WC_GAME_OPTIONS, 0);
 
				}
 
			}
 
@@ -876,8 +876,8 @@ CommandCost CmdPlayerCtrl(TileIndex tile
 
		/* Now that we have a new player, broadcast its autorenew settings to
 
		 * all clients so everything is in sync */
 
		DoCommand(0,
 
			(_settings.gui.autorenew << 15 ) | (_settings.gui.autorenew_months << 16) | 4,
 
			_settings.gui.autorenew_money,
 
			(_settings_client.gui.autorenew << 15 ) | (_settings_client.gui.autorenew_months << 16) | 4,
 
			_settings_client.gui.autorenew_money,
 
			DC_EXEC,
 
			CMD_SET_AUTOREPLACE
 
		);
 
@@ -994,7 +994,7 @@ StringID EndGameGetPerformanceTitleFromV
 
/** Save the highscore for the player */
 
int8 SaveHighScoreValue(const Player *p)
 
{
 
	HighScore *hs = _highscore_table[_settings.difficulty.diff_level];
 
	HighScore *hs = _highscore_table[_settings_game.difficulty.diff_level];
 
	uint i;
 
	uint16 score = p->old_economy[0].performance_history;
 

	
 
@@ -1122,7 +1122,7 @@ void LoadFromHighScore()
 
	}
 

	
 
	/* Initialize end of game variable (when to show highscore chart) */
 
	_settings.gui.ending_year = 2051;
 
	_settings_client.gui.ending_year = 2051;
 
}
 

	
 
/* Save/load of players */
src/rail.cpp
Show inline comments
 
@@ -207,7 +207,7 @@ RailTypes GetPlayerRailtypes(PlayerID p)
 
	FOR_ALL_ENGINES_OF_TYPE(e, VEH_TRAIN) {
 
		const EngineInfo *ei = &e->info;
 

	
 
		if (HasBit(ei->climates, _settings.game_creation.landscape) &&
 
		if (HasBit(ei->climates, _settings_game.game_creation.landscape) &&
 
				(HasBit(e->player_avail, p) || _date >= e->intro_date + 365)) {
 
			const RailVehicleInfo *rvi = &e->u.rail;
 

	
src/rail_cmd.cpp
Show inline comments
 
@@ -292,7 +292,7 @@ static CommandCost CheckRailSlope(Slope 
 

	
 
	/* check track/slope combination */
 
	if ((f_new == FOUNDATION_INVALID) ||
 
	    ((f_new != FOUNDATION_NONE) && (!_settings.construction.build_on_slopes || _is_old_ai_player))
 
	    ((f_new != FOUNDATION_NONE) && (!_settings_game.construction.build_on_slopes || _is_old_ai_player))
 
	   ) return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
 

	
 
	Foundation f_old = GetRailFoundation(tileh, existing);
 
@@ -756,7 +756,7 @@ CommandCost CmdBuildTrainDepot(TileIndex
 

	
 
	if (tileh != SLOPE_FLAT && (
 
				_is_old_ai_player ||
 
				!_settings.construction.build_on_slopes ||
 
				!_settings_game.construction.build_on_slopes ||
 
				IsSteepSlope(tileh) ||
 
				!CanBuildDepotByTileh(dir, tileh)
 
			)) {
 
@@ -1224,7 +1224,7 @@ CommandCost CmdConvertRail(TileIndex til
 
			RailType type = GetRailType(tile);
 

	
 
			/* Converting to the same type or converting 'hidden' elrail -> rail */
 
			if (type == totype || (_settings.vehicle.disable_elrails && totype == RAILTYPE_RAIL && type == RAILTYPE_ELECTRIC)) continue;
 
			if (type == totype || (_settings_game.vehicle.disable_elrails && totype == RAILTYPE_RAIL && type == RAILTYPE_ELECTRIC)) continue;
 

	
 
			/* Trying to convert other's rail */
 
			if (!CheckTileOwnership(tile)) continue;
 
@@ -1420,7 +1420,7 @@ static uint GetSaveSlopeZ(uint x, uint y
 

	
 
static void DrawSingleSignal(TileIndex tile, Track track, byte condition, uint image, uint pos)
 
{
 
	bool side = (_settings.vehicle.road_side != 0) && _settings.construction.signal_side;
 
	bool side = (_settings_game.vehicle.road_side != 0) && _settings_game.construction.signal_side;
 
	static const Point SignalPositions[2][12] = {
 
		{      /* Signals on the left side */
 
		/*  LEFT      LEFT      RIGHT     RIGHT     UPPER     UPPER */
 
@@ -1789,7 +1789,7 @@ static void DrawTile_Track(TileInfo *ti)
 

	
 
			/* adjust ground tile for desert
 
			 * don't adjust for snow, because snow in depots looks weird */
 
			if (IsSnowRailGround(ti->tile) && _settings.game_creation.landscape == LT_TROPIC) {
 
			if (IsSnowRailGround(ti->tile) && _settings_game.game_creation.landscape == LT_TROPIC) {
 
				if (image != SPR_FLAT_GRASS_TILE) {
 
					image += rti->snow_offset; // tile with tracks
 
				} else {
 
@@ -1953,7 +1953,7 @@ static void TileLoop_Track(TileIndex til
 
		return;
 
	}
 

	
 
	switch (_settings.game_creation.landscape) {
 
	switch (_settings_game.game_creation.landscape) {
 
		case LT_ARCTIC: {
 
			uint z;
 
			Slope slope = GetTileSlope(tile, &z);
 
@@ -2329,7 +2329,7 @@ static VehicleEnterTileStatus VehicleEnt
 
 */
 
static CommandCost TestAutoslopeOnRailTile(TileIndex tile, uint flags, uint z_old, Slope tileh_old, uint z_new, Slope tileh_new, TrackBits rail_bits)
 
{
 
	if (!_settings.construction.build_on_slopes || !AutoslopeEnabled()) return CMD_ERROR;
 
	if (!_settings_game.construction.build_on_slopes || !AutoslopeEnabled()) return CMD_ERROR;
 

	
 
	/* Is the slope-rail_bits combination valid in general? I.e. is it save to call GetRailFoundation() ? */
 
	if (CmdFailed(CheckRailSlope(tileh_new, rail_bits, TRACK_BIT_NONE, tile))) return CMD_ERROR;
 
@@ -2405,7 +2405,7 @@ static CommandCost TerraformTile_Track(T
 
		/* allow terraforming */
 
		return CommandCost(EXPENSES_CONSTRUCTION, was_water ? _price.clear_water : (Money)0);
 
	} else {
 
		if (_settings.construction.build_on_slopes && AutoslopeEnabled()) {
 
		if (_settings_game.construction.build_on_slopes && AutoslopeEnabled()) {
 
			switch (GetRailTileType(tile)) {
 
				case RAIL_TILE_WAYPOINT: {
 
					CommandCost cost = TestAutoslopeOnRailTile(tile, flags, z_old, tileh_old, z_new, tileh_new, GetRailWaypointBits(tile));
src/rail_gui.cpp
Show inline comments
 
@@ -182,7 +182,7 @@ static void PlaceRail_Station(TileIndex 
 
		VpSetPlaceSizingLimit(-1);
 
	} else if (_railstation.dragdrop) {
 
		VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED, DDSP_BUILD_STATION);
 
		VpSetPlaceSizingLimit(_settings.station.station_spread);
 
		VpSetPlaceSizingLimit(_settings_game.station.station_spread);
 
	} else {
 
		DoCommandP(tile,
 
				_railstation.orientation | (_railstation.numtracks << 8) | (_railstation.platlength << 16) | (_ctrl_pressed << 24),
 
@@ -227,7 +227,7 @@ static void GenericPlaceSignals(TileInde
 
			SB(p1, 7, 1, _convert_signal_button);
 
		} else {
 
			SB(p1, 3, 1, _ctrl_pressed);
 
			SB(p1, 4, 1, (_cur_year < _settings.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC));
 
			SB(p1, 4, 1, (_cur_year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC));
 
			SB(p1, 5, 2, SIGTYPE_NORMAL);
 
			SB(p1, 7, 1, 0);
 
		}
 
@@ -429,7 +429,7 @@ static void BuildRailClick_Station(Windo
 
 */
 
static void BuildRailClick_AutoSignals(Window *w)
 
{
 
	if (_settings.gui.enable_signal_gui != _ctrl_pressed) {
 
	if (_settings_client.gui.enable_signal_gui != _ctrl_pressed) {
 
		if (HandlePlacePushButton(w, RTW_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, VHM_RECT, PlaceRail_AutoSignals)) ShowSignalBuilder(w);
 
	} else {
 
		HandlePlacePushButton(w, RTW_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, VHM_RECT, PlaceRail_AutoSignals);
 
@@ -484,7 +484,7 @@ static void BuildRailClick_Remove(Window
 
				if (_railstation.orientation == 0) Swap(x, y);
 
				SetTileSelectSize(x, y);
 
			} else {
 
				VpSetPlaceSizingLimit(_settings.station.station_spread);
 
				VpSetPlaceSizingLimit(_settings_game.station.station_spread);
 
			}
 
		}
 
	}
 
@@ -547,15 +547,15 @@ static void HandleAutoSignalPlacement()
 
		SB(p2,  3, 1, 0);
 
		SB(p2,  4, 1, _cur_signal_variant);
 
		SB(p2,  6, 1, _ctrl_pressed);
 
		SB(p2, 24, 8, _settings.gui.drag_signals_density);
 
		SB(p2, 24, 8, _settings_client.gui.drag_signals_density);
 
	} else {
 
		SB(p2,  3, 1, 0);
 
		SB(p2,  4, 1, (_cur_year < _settings.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC));
 
		SB(p2,  4, 1, (_cur_year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC));
 
		SB(p2,  6, 1, _ctrl_pressed);
 
		SB(p2, 24, 8, _settings.gui.drag_signals_density);
 
		SB(p2, 24, 8, _settings_client.gui.drag_signals_density);
 
	}
 

	
 
	/* _settings.gui.drag_signals_density is given as a parameter such that each user
 
	/* _settings_client.gui.drag_signals_density is given as a parameter such that each user
 
	 * in a network game can specify his/her own signal density */
 
	DoCommandP(
 
		TileVirtXY(thd->selstart.x, thd->selstart.y),
 
@@ -617,12 +617,12 @@ struct BuildRailToolbarWindow : Window {
 
		this->DisableWidget(RTW_REMOVE);
 

	
 
		this->FindWindowPlacementAndResize(desc);
 
		if (_settings.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
 
		if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
 
	}
 

	
 
	~BuildRailToolbarWindow()
 
	{
 
		if (_settings.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
 
		if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
 
	}
 

	
 
	void UpdateRemoveWidgetStatus(int clicked_widget)
 
@@ -1008,13 +1008,13 @@ public:
 
				SetTileSelectSize(x, y);
 
		}
 

	
 
		int rad = (_settings.station.modified_catchment) ? CA_TRAIN : CA_UNMODIFIED;
 
		int rad = (_settings_game.station.modified_catchment) ? CA_TRAIN : CA_UNMODIFIED;
 

	
 
		if (_station_show_coverage)
 
			SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
 

	
 
		for (uint bits = 0; bits < 7; bits++) {
 
			bool disable = bits >= _settings.station.station_spread;
 
			bool disable = bits >= _settings_game.station.station_spread;
 
			if (statspec == NULL) {
 
				this->SetWidgetDisabledState(bits + BRSW_PLATFORM_NUM_1, disable);
 
				this->SetWidgetDisabledState(bits + BRSW_PLATFORM_LEN_1, disable);
 
@@ -1390,8 +1390,8 @@ public:
 

	
 
		this->SetWidgetLoweredState(BSW_CONVERT, _convert_signal_button);
 

	
 
		this->SetWidgetDisabledState(BSW_DRAG_SIGNALS_DENSITY_DECREASE, _settings.gui.drag_signals_density == 1);
 
		this->SetWidgetDisabledState(BSW_DRAG_SIGNALS_DENSITY_INCREASE, _settings.gui.drag_signals_density == 20);
 
		this->SetWidgetDisabledState(BSW_DRAG_SIGNALS_DENSITY_DECREASE, _settings_client.gui.drag_signals_density == 1);
 
		this->SetWidgetDisabledState(BSW_DRAG_SIGNALS_DENSITY_INCREASE, _settings_client.gui.drag_signals_density == 20);
 

	
 
		this->DrawWidgets();
 

	
 
@@ -1406,7 +1406,7 @@ public:
 
		this->DrawSignalSprite(BSW_ELECTRIC_COMBO,  SPR_IMG_SIGNAL_ELECTRIC_COMBO,  -2,  6);
 

	
 
		/* Draw dragging signal density value in the BSW_DRAG_SIGNALS_DENSITY widget */
 
		SetDParam(0, _settings.gui.drag_signals_density);
 
		SetDParam(0, _settings_client.gui.drag_signals_density);
 
		DrawStringCentered(this->widget[BSW_DRAG_SIGNALS_DENSITY].left + (this->widget[BSW_DRAG_SIGNALS_DENSITY].right -
 
				this->widget[BSW_DRAG_SIGNALS_DENSITY].left) / 2 + 1,
 
				this->widget[BSW_DRAG_SIGNALS_DENSITY].top + 2, STR_JUST_INT, TC_ORANGE);
 
@@ -1434,15 +1434,15 @@ public:
 
				break;
 

	
 
			case BSW_DRAG_SIGNALS_DENSITY_DECREASE:
 
				if (_settings.gui.drag_signals_density > 1) {
 
					_settings.gui.drag_signals_density--;
 
				if (_settings_client.gui.drag_signals_density > 1) {
 
					_settings_client.gui.drag_signals_density--;
 
					SetWindowDirty(FindWindowById(WC_GAME_OPTIONS, 0));
 
				}
 
				break;
 

	
 
			case BSW_DRAG_SIGNALS_DENSITY_INCREASE:
 
				if (_settings.gui.drag_signals_density < 20) {
 
					_settings.gui.drag_signals_density++;
 
				if (_settings_client.gui.drag_signals_density < 20) {
 
					_settings_client.gui.drag_signals_density++;
 
					SetWindowDirty(FindWindowById(WC_GAME_OPTIONS, 0));
 
				}
 
				break;
 
@@ -1701,7 +1701,7 @@ static void SetDefaultRailGui()
 
	if (_local_player == PLAYER_SPECTATOR || !IsValidPlayer(_local_player)) return;
 

	
 
	extern RailType _last_built_railtype;
 
	RailType rt = (RailType)_settings.gui.default_rail_type;
 
	RailType rt = (RailType)_settings_client.gui.default_rail_type;
 
	if (rt >= RAILTYPE_END) {
 
		if (rt == RAILTYPE_END + 2) {
 
			/* Find the most used rail type */
 
@@ -1753,7 +1753,7 @@ static void SetDefaultRailGui()
 
 */
 
int32 ResetSignalVariant(int32 = 0)
 
{
 
	SignalVariant new_variant = (_cur_year < _settings.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC);
 
	SignalVariant new_variant = (_cur_year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC);
 

	
 
	if (new_variant != _cur_signal_variant) {
 
		Window *w = FindWindowById(WC_BUILD_SIGNAL, 0);
src/road.cpp
Show inline comments
 
@@ -103,7 +103,7 @@ RoadTypes GetPlayerRoadtypes(PlayerID p)
 
	FOR_ALL_ENGINES_OF_TYPE(e, VEH_ROAD) {
 
		const EngineInfo *ei = &e->info;
 

	
 
		if (HasBit(ei->climates, _settings.game_creation.landscape) &&
 
		if (HasBit(ei->climates, _settings_game.game_creation.landscape) &&
 
				(HasBit(e->player_avail, p) || _date >= e->intro_date + 365)) {
 
			SetBit(rt, HasBit(ei->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD);
 
		}
src/road_cmd.cpp
Show inline comments
 
@@ -69,9 +69,9 @@ CommandCost CmdSetRoadDriveSide(TileInde
 

	
 
	if (flags & DC_EXEC) {
 
		if (_game_mode == GM_MENU) {
 
			_settings.vehicle.road_side = p1;
 
			_settings_game.vehicle.road_side = p1;
 
		} else {
 
			_settings.vehicle.road_side = p1;
 
			_settings_game.vehicle.road_side = p1;
 
		}
 
		InvalidateWindow(WC_GAME_OPTIONS, 0);
 
	}
 
@@ -182,7 +182,7 @@ bool CheckAllowRemoveRoad(TileIndex tile
 
	 * then allow it */
 
	if (KillFirstBit(n) != ROAD_NONE && (n & remove) != ROAD_NONE) {
 
		/* you can remove all kind of roads with extra dynamite */
 
		if (!_settings.construction.extra_dynamite) {
 
		if (!_settings_game.construction.extra_dynamite) {
 
			SetDParam(0, t->index);
 
			_error_message = STR_2009_LOCAL_AUTHORITY_REFUSES;
 
			return false;
 
@@ -279,7 +279,7 @@ static CommandCost RemoveRoad(TileIndex 
 
			 * @li if build on slopes is disabled */
 
			if (IsSteepSlope(tileh) || (IsStraightRoad(other) &&
 
					(other & _invalid_tileh_slopes_road[0][tileh & SLOPE_ELEVATED]) != ROAD_NONE) ||
 
					(tileh != SLOPE_FLAT && !_settings.construction.build_on_slopes)) {
 
					(tileh != SLOPE_FLAT && !_settings_game.construction.build_on_slopes)) {
 
				pieces |= MirrorRoadBits(pieces);
 
			}
 

	
 
@@ -419,7 +419,7 @@ static CommandCost CheckRoadSlope(Slope 
 
	RoadBits type_bits = existing | *pieces;
 

	
 
	/* Roads on slopes */
 
	if (_settings.construction.build_on_slopes && (_invalid_tileh_slopes_road[0][tileh] & (other | type_bits)) == ROAD_NONE) {
 
	if (_settings_game.construction.build_on_slopes && (_invalid_tileh_slopes_road[0][tileh] & (other | type_bits)) == ROAD_NONE) {
 

	
 
		/* If we add leveling we've got to pay for it */
 
		if ((other | existing) == ROAD_NONE) return CommandCost(EXPENSES_CONSTRUCTION, _price.terraform);
 
@@ -439,7 +439,7 @@ static CommandCost CheckRoadSlope(Slope 
 
		if (IsSlopeWithOneCornerRaised(tileh)) {
 

	
 
			/* Prevent build on slopes if it isn't allowed */
 
			if (_settings.construction.build_on_slopes) {
 
			if (_settings_game.construction.build_on_slopes) {
 

	
 
				/* If we add foundation we've got to pay for it */
 
				if ((other | existing) == ROAD_NONE) return CommandCost(EXPENSES_CONSTRUCTION, _price.terraform);
 
@@ -594,7 +594,7 @@ do_clear:;
 
		CommandCost ret = CheckRoadSlope(tileh, &pieces, existing, other_bits);
 
		/* Return an error if we need to build a foundation (ret != 0) but the
 
		 * current patch-setting is turned off (or stupid AI@work) */
 
		if (CmdFailed(ret) || (ret.GetCost() != 0 && !_settings.construction.build_on_slopes)) {
 
		if (CmdFailed(ret) || (ret.GetCost() != 0 && !_settings_game.construction.build_on_slopes)) {
 
			return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
 
		}
 
		cost.AddCost(ret);
 
@@ -849,7 +849,7 @@ CommandCost CmdBuildRoadDepot(TileIndex 
 

	
 
	Slope tileh = GetTileSlope(tile, NULL);
 
	if (tileh != SLOPE_FLAT && (
 
				!_settings.construction.build_on_slopes ||
 
				!_settings_game.construction.build_on_slopes ||
 
				IsSteepSlope(tileh) ||
 
				!CanBuildDepotByTileh(dir, tileh)
 
			)) {
 
@@ -1000,7 +1000,7 @@ const byte _road_sloped_sprites[14] = {
 
static bool AlwaysDrawUnpavedRoads(TileIndex tile, Roadside roadside)
 
{
 
	return (IsOnSnow(tile) &&
 
			!(_settings.game_creation.landscape == LT_TROPIC && HasGrfMiscBit(GMB_DESERT_PAVED_ROADS) &&
 
			!(_settings_game.game_creation.landscape == LT_TROPIC && HasGrfMiscBit(GMB_DESERT_PAVED_ROADS) &&
 
				roadside != ROADSIDE_BARREN && roadside != ROADSIDE_GRASS && roadside != ROADSIDE_GRASS_ROAD_WORKS));
 
}
 

	
 
@@ -1291,7 +1291,7 @@ static const Roadside _town_road_types_2
 

	
 
static void TileLoop_Road(TileIndex tile)
 
{
 
	switch (_settings.game_creation.landscape) {
 
	switch (_settings_game.game_creation.landscape) {
 
		case LT_ARCTIC:
 
			if (IsOnSnow(tile) != (GetTileZ(tile) > GetSnowLine())) {
 
				ToggleSnow(tile);
 
@@ -1337,7 +1337,7 @@ static void TileLoop_Road(TileIndex tile
 

	
 
		{
 
			/* Adjust road ground type depending on 'grp' (grp is the distance to the center) */
 
			const Roadside* new_rs = (_settings.game_creation.landscape == LT_TOYLAND) ? _town_road_types_2[grp] : _town_road_types[grp];
 
			const Roadside* new_rs = (_settings_game.game_creation.landscape == LT_TOYLAND) ? _town_road_types_2[grp] : _town_road_types[grp];
 
			Roadside cur_rs = GetRoadside(tile);
 

	
 
			/* We have our desired type, do nothing */
 
@@ -1359,7 +1359,7 @@ static void TileLoop_Road(TileIndex tile
 
	} else if (IncreaseRoadWorksCounter(tile)) {
 
		TerminateRoadWorks(tile);
 

	
 
		if (_settings.economy.mod_road_rebuild) {
 
		if (_settings_game.economy.mod_road_rebuild) {
 
			/* Generate a nicer town surface */
 
			const RoadBits old_rb = GetAnyRoadBits(tile, ROADTYPE_ROAD);
 
			const RoadBits new_rb = CleanUpRoadBits(tile, old_rb);
 
@@ -1570,7 +1570,7 @@ static void ChangeTileOwner_Road(TileInd
 

	
 
static CommandCost TerraformTile_Road(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
 
{
 
	if (_settings.construction.build_on_slopes && AutoslopeEnabled()) {
 
	if (_settings_game.construction.build_on_slopes && AutoslopeEnabled()) {
 
		switch (GetRoadTileType(tile)) {
 
			case ROAD_TILE_CROSSING:
 
				if (!IsSteepSlope(tileh_new) && (GetTileMaxZ(tile) == z_new + GetSlopeMaxZ(tileh_new)) && HasBit(VALID_LEVEL_CROSSING_SLOPES, tileh_new)) return CommandCost(EXPENSES_CONSTRUCTION, _price.terraform);
src/road_gui.cpp
Show inline comments
 
@@ -409,12 +409,12 @@ struct BuildRoadToolbarWindow : Window {
 
			WIDGET_LIST_END);
 

	
 
		this->FindWindowPlacementAndResize(desc);
 
		if (_settings.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
 
		if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
 
	}
 

	
 
	~BuildRoadToolbarWindow()
 
	{
 
		if (_settings.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
 
		if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
 
	}
 

	
 
	/**
 
@@ -839,7 +839,7 @@ public:
 
		this->DrawWidgets();
 

	
 
		if (_station_show_coverage) {
 
			int rad = _settings.station.modified_catchment ? CA_TRUCK /* = CA_BUS */ : CA_UNMODIFIED;
 
			int rad = _settings_game.station.modified_catchment ? CA_TRUCK /* = CA_BUS */ : CA_UNMODIFIED;
 
			SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
 
		} else {
 
			SetTileSelectSize(1, 1);
src/roadveh_cmd.cpp
Show inline comments
 
@@ -205,7 +205,7 @@ CommandCost CmdBuildRoadVeh(TileIndex ti
 

	
 
	/* find the first free roadveh id */
 
	unit_num = HasBit(p2, 0) ? 0 : GetFreeUnitNumber(VEH_ROAD);
 
	if (unit_num > _settings.vehicle.max_roadveh)
 
	if (unit_num > _settings_game.vehicle.max_roadveh)
 
		return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
 

	
 
	if (flags & DC_EXEC) {
 
@@ -257,7 +257,7 @@ CommandCost CmdBuildRoadVeh(TileIndex ti
 

	
 
		v->name = NULL;
 

	
 
		v->service_interval = _settings.vehicle.servint_roadveh;
 
		v->service_interval = _settings_game.vehicle.servint_roadveh;
 

	
 
		v->date_of_last_service = _date;
 
		v->build_year = _cur_year;
 
@@ -419,7 +419,7 @@ static bool EnumRoadSignalFindDepot(Tile
 

	
 
static const Depot* FindClosestRoadDepot(const Vehicle* v)
 
{
 
	switch (_settings.pf.pathfinder_for_roadvehs) {
 
	switch (_settings_game.pf.pathfinder_for_roadvehs) {
 
		case VPF_YAPF: /* YAPF */
 
			return YapfFindNearestRoadDepot(v);
 

	
 
@@ -702,7 +702,7 @@ static void HandleBrokenRoadVeh(Vehicle 
 
		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
 

	
 
		if (!PlayVehicleSound(v, VSE_BREAKDOWN)) {
 
			SndPlayVehicleFx((_settings.game_creation.landscape != LT_TOYLAND) ?
 
			SndPlayVehicleFx((_settings_game.game_creation.landscape != LT_TOYLAND) ?
 
				SND_0F_VEHICLE_BREAKDOWN : SND_35_COMEDY_BREAKDOWN, v);
 
		}
 

	
 
@@ -863,7 +863,7 @@ static bool RoadVehAccelerate(Vehicle *v
 
	/* updates statusbar only if speed have changed to save CPU time */
 
	if (spd != v->cur_speed) {
 
		v->cur_speed = spd;
 
		if (_settings.gui.vehicle_speed) {
 
		if (_settings_client.gui.vehicle_speed) {
 
			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 
		}
 
	}
 
@@ -1085,7 +1085,7 @@ static Trackdir RoadFindPathToDest(Vehic
 
				trackdirs = TRACKDIR_BIT_NONE;
 
			} else {
 
				/* Proper station type, check if there is free loading bay */
 
				if (!_settings.pf.roadveh_queue && IsStandardRoadStopTile(tile) &&
 
				if (!_settings_game.pf.roadveh_queue && IsStandardRoadStopTile(tile) &&
 
						!GetRoadStopByTile(tile, rstype)->HasFreeBay()) {
 
					/* Station is full and RV queuing is off */
 
					trackdirs = TRACKDIR_BIT_NONE;
 
@@ -1124,7 +1124,7 @@ static Trackdir RoadFindPathToDest(Vehic
 
		return_track(FindFirstBit2x64(trackdirs));
 
	}
 

	
 
	switch (_settings.pf.pathfinder_for_roadvehs) {
 
	switch (_settings_game.pf.pathfinder_for_roadvehs) {
 
		case VPF_YAPF: { /* YAPF */
 
			Trackdir trackdir = YapfChooseRoadTrack(v, tile, enterdir);
 
			if (trackdir != INVALID_TRACKDIR) return_track(trackdir);
 
@@ -1211,7 +1211,7 @@ found_best_track:;
 

	
 
static uint RoadFindPathToStop(const Vehicle *v, TileIndex tile)
 
{
 
	if (_settings.pf.pathfinder_for_roadvehs == VPF_YAPF) {
 
	if (_settings_game.pf.pathfinder_for_roadvehs == VPF_YAPF) {
 
		/* use YAPF */
 
		return YapfRoadVehDistanceToTile(v, tile);
 
	}
 
@@ -1273,7 +1273,7 @@ static bool RoadVehLeaveDepot(Vehicle *v
 
	v->direction = DiagDirToDir(dir);
 

	
 
	Trackdir tdir = _roadveh_depot_exit_trackdir[dir];
 
	const RoadDriveEntry *rdp = _road_drive_data[v->u.road.roadtype][(_settings.vehicle.road_side << RVS_DRIVE_SIDE) + tdir];
 
	const RoadDriveEntry *rdp = _road_drive_data[v->u.road.roadtype][(_settings_game.vehicle.road_side << RVS_DRIVE_SIDE) + tdir];
 

	
 
	int x = TileX(v->tile) * TILE_SIZE + (rdp[RVC_DEPOT_START_FRAME].x & 0xF);
 
	int y = TileY(v->tile) * TILE_SIZE + (rdp[RVC_DEPOT_START_FRAME].y & 0xF);
 
@@ -1451,7 +1451,7 @@ static bool IndividualRoadVehicleControl
 
	 * In this case v->u.road.state is masked to give the road stop entry direction. */
 
	rd = _road_drive_data[v->u.road.roadtype][(
 
		(HasBit(v->u.road.state, RVS_IN_DT_ROAD_STOP) ? v->u.road.state & RVSB_ROAD_STOP_TRACKDIR_MASK : v->u.road.state) +
 
		(_settings.vehicle.road_side << RVS_DRIVE_SIDE)) ^ v->u.road.overtaking][v->u.road.frame + 1];
 
		(_settings_game.vehicle.road_side << RVS_DRIVE_SIDE)) ^ v->u.road.overtaking][v->u.road.frame + 1];
 

	
 
	if (rd.x & RDE_NEXT_TILE) {
 
		TileIndex tile = v->tile + TileOffsByDiagDir((DiagDirection)(rd.x & 3));
 
@@ -1529,7 +1529,7 @@ again:
 
		}
 

	
 
		/* Get position data for first frame on the new tile */
 
		rdp = _road_drive_data[v->u.road.roadtype][(dir + (_settings.vehicle.road_side << RVS_DRIVE_SIDE)) ^ v->u.road.overtaking];
 
		rdp = _road_drive_data[v->u.road.roadtype][(dir + (_settings_game.vehicle.road_side << RVS_DRIVE_SIDE)) ^ v->u.road.overtaking];
 

	
 
		x = TileX(tile) * TILE_SIZE + rdp[start_frame].x;
 
		y = TileY(tile) * TILE_SIZE + rdp[start_frame].y;
 
@@ -1632,7 +1632,7 @@ again:
 
			return false;
 
		}
 

	
 
		rdp = _road_drive_data[v->u.road.roadtype][(_settings.vehicle.road_side << RVS_DRIVE_SIDE) + dir];
 
		rdp = _road_drive_data[v->u.road.roadtype][(_settings_game.vehicle.road_side << RVS_DRIVE_SIDE) + dir];
 

	
 
		x = TileX(v->tile) * TILE_SIZE + rdp[turn_around_start_frame].x;
 
		y = TileY(v->tile) * TILE_SIZE + rdp[turn_around_start_frame].y;
 
@@ -1711,7 +1711,7 @@ again:
 
	 * (the station test and stop type test ensure that other vehicles, using the road stop as
 
	 * a through route, do not stop) */
 
	if (IsRoadVehFront(v) && ((IsInsideMM(v->u.road.state, RVSB_IN_ROAD_STOP, RVSB_IN_ROAD_STOP_END) &&
 
			_road_veh_data_1[v->u.road.state - RVSB_IN_ROAD_STOP + (_settings.vehicle.road_side << RVS_DRIVE_SIDE)] == v->u.road.frame) ||
 
			_road_veh_data_1[v->u.road.state - RVSB_IN_ROAD_STOP + (_settings_game.vehicle.road_side << RVS_DRIVE_SIDE)] == v->u.road.frame) ||
 
			(IsInsideMM(v->u.road.state, RVSB_IN_DT_ROAD_STOP, RVSB_IN_DT_ROAD_STOP_END) &&
 
			v->current_order.ShouldStopAtStation(v, GetStationIndex(v->tile)) &&
 
			GetRoadStopType(v->tile) == (IsCargoInClass(v->cargo_type, CC_PASSENGERS) ? ROADSTOP_BUS : ROADSTOP_TRUCK) &&
 
@@ -1887,7 +1887,7 @@ void RoadVehicle::Tick()
 
static void CheckIfRoadVehNeedsService(Vehicle *v)
 
{
 
	/* If we already got a slot at a stop, use that FIRST, and go to a depot later */
 
	if (v->u.road.slot != NULL || _settings.vehicle.servint_roadveh == 0 || !v->NeedsAutomaticServicing()) return;
 
	if (v->u.road.slot != NULL || _settings_game.vehicle.servint_roadveh == 0 || !v->NeedsAutomaticServicing()) return;
 
	if (v->IsInDepot()) {
 
		VehicleServiceInDepot(v);
 
		return;
src/saveload.cpp
Show inline comments
 
@@ -1776,7 +1776,7 @@ SaveOrLoadResult SaveOrLoad(const char *
 
	}
 
}
 

	
 
/** Do a save when exiting the game (patch option) _settings.gui.autosave_on_exit */
 
/** Do a save when exiting the game (patch option) _settings_client.gui.autosave_on_exit */
 
void DoExitSave()
 
{
 
	SaveOrLoad("exit.sav", SL_SAVE, AUTOSAVE_DIR);
src/saveload.h
Show inline comments
 
@@ -304,7 +304,7 @@ static inline VarType GetVarFileType(Var
 
 * to add this to the address of the object */
 
static inline void *GetVariableAddress(const void *object, const SaveLoad *sld)
 
{
 
	return (byte*)object + (ptrdiff_t)sld->address;
 
	return (byte*)(sld->global ? NULL : object) + (ptrdiff_t)sld->address;
 
}
 

	
 
int64 ReadValue(const void *ptr, VarType conv);
src/settings.cpp
Show inline comments
 
@@ -64,8 +64,9 @@
 

	
 
#include "table/strings.h"
 

	
 
Settings _settings;
 
Settings _settings_newgame;
 
ClientSettings _settings_client;
 
GameSettings _settings_game;
 
GameSettings _settings_newgame;
 

	
 
struct IniFile;
 
struct IniItem;
 
@@ -765,7 +766,7 @@ static void ini_load_settings(IniFile *i
 
		}
 

	
 
		p = (item == NULL) ? sdb->def : string_to_val(sdb, item->value);
 
		ptr = GetVariableAddress(sld->global ? NULL : object, sld);
 
		ptr = GetVariableAddress(object, sld);
 

	
 
		switch (sdb->cmd) {
 
		case SDT_BOOLX: /* All four are various types of (integer) numbers */
 
@@ -1120,6 +1121,32 @@ static void ini_save_setting_list(IniFil
 
#define SDT_CONDNULL(length, from, to)\
 
	{{"", NULL, {0}, {0}, 0, 0, 0, NULL, STR_NULL, NULL, NULL}, SLE_CONDNULL(length, from, to)}
 

	
 

	
 
#define SDTC_CONDVAR(var, type, from, to, flags, guiflags, def, min, max, interval, str, proc)\
 
	SDTG_GENERAL(#var, SDT_NUMX, SL_VAR, type, flags, guiflags, _settings_client.var, 0, def, min, max, interval, NULL, str, proc, from, to)
 
#define SDTC_VAR(var, type, flags, guiflags, def, min, max, interval, str, proc)\
 
	SDTC_CONDVAR(var, type, 0, SL_MAX_VERSION, flags, guiflags, def, min, max, interval, str, proc)
 

	
 
#define SDTC_CONDBOOL(var, from, to, flags, guiflags, def, str, proc)\
 
	SDTG_GENERAL(#var, SDT_BOOLX, SL_VAR, SLE_BOOL, flags, guiflags, _settings_client.var, 0, def, 0, 1, 0, NULL, str, proc, from, to)
 
#define SDTC_BOOL(var, flags, guiflags, def, str, proc)\
 
	SDTC_CONDBOOL(var, 0, SL_MAX_VERSION, flags, guiflags, def, str, proc)
 

	
 
#define SDTC_CONDLIST(var, type, length, flags, guiflags, def, str, proc, from, to)\
 
	SDTG_GENERAL(#var, SDT_INTLIST, SL_ARR, type, flags, guiflags, _settings_client.var, length, def, 0, 0, 0, NULL, str, proc, from, to)
 
#define SDTC_LIST(var, type, flags, guiflags, def, str, proc)\
 
	SDTG_GENERAL(var, SDT_INTLIST, SL_ARR, type, flags, guiflags, _settings_client.var, lengthof(_settings_client.var), def, 0, 0, 0, NULL, str, proc, 0, SL_MAX_VERSION)
 

	
 
#define SDTC_CONDSTR(var, type, length, flags, guiflags, def, str, proc, from, to)\
 
	SDTG_GENERAL(#var, SDT_STRING, SL_STR, type, flags, guiflags, _settings_client.var, length, def, 0, 0, 0, NULL, str, proc, from, to)
 
#define SDTC_STR(var, type, flags, guiflags, def, str, proc)\
 
	SDTG_GENERAL(var, SDT_STRING, SL_STR, type, flags, guiflags, _settings_client.var, lengthof(_settings_client.var), def, 0, 0, 0, NULL, str, proc, 0, SL_MAX_VERSION)
 

	
 
#define SDTC_CONDOMANY(var, type, from, to, flags, guiflags, def, max, full, str, proc)\
 
	SDTG_GENERAL(#var, SDT_ONEOFMANY, SL_VAR, type, flags, guiflags, _settings_client.var, 0, def, 0, max, 0, full, str, proc, from, to)
 
#define SDTC_OMANY(var, type, flags, guiflags, def, max, full, str, proc)\
 
	SDTC_CONDOMANY(var, type, 0, SL_MAX_VERSION, flags, guiflags, def, max, full, str, proc)
 

	
 
#define SDT_END() {{NULL, NULL, {0}, {0}, 0, 0, 0, NULL, STR_NULL, NULL, NULL}, SLE_END()}
 

	
 
/* Shortcuts for macros below. Logically if we don't save the value
 
@@ -1154,7 +1181,7 @@ static int32 Ai_In_Multiplayer_Warning(i
 
{
 
	if (p1 == 1) {
 
		ShowErrorMessage(INVALID_STRING_ID, TEMP_AI_MULTIPLAYER, 0, 0);
 
		_settings.ai.ainew_active = true;
 
		_settings_game.ai.ainew_active = true;
 
	}
 
	return 0;
 
}
 
@@ -1220,7 +1247,7 @@ static int32 UpdateConsists(int32 p1)
 
static int32 CheckInterval(int32 p1)
 
{
 
	bool warning;
 
	const VehicleSettings *ptc = (_game_mode == GM_MENU) ? &_settings_newgame.vehicle : &_settings.vehicle;
 
	const VehicleSettings *ptc = (_game_mode == GM_MENU) ? &_settings_newgame.vehicle : &_settings_game.vehicle;
 

	
 
	if (p1) {
 
		warning = ( (IsInsideMM(ptc->servint_trains,   5, 90 + 1) || ptc->servint_trains   == 0) &&
 
@@ -1242,19 +1269,19 @@ static int32 CheckInterval(int32 p1)
 

	
 
static int32 EngineRenewUpdate(int32 p1)
 
{
 
	DoCommandP(0, 0, _settings.gui.autorenew, NULL, CMD_SET_AUTOREPLACE);
 
	DoCommandP(0, 0, _settings_client.gui.autorenew, NULL, CMD_SET_AUTOREPLACE);
 
	return 0;
 
}
 

	
 
static int32 EngineRenewMonthsUpdate(int32 p1)
 
{
 
	DoCommandP(0, 1, _settings.gui.autorenew_months, NULL, CMD_SET_AUTOREPLACE);
 
	DoCommandP(0, 1, _settings_client.gui.autorenew_months, NULL, CMD_SET_AUTOREPLACE);
 
	return 0;
 
}
 

	
 
static int32 EngineRenewMoneyUpdate(int32 p1)
 
{
 
	DoCommandP(0, 2, _settings.gui.autorenew_money, NULL, CMD_SET_AUTOREPLACE);
 
	DoCommandP(0, 2, _settings_client.gui.autorenew_money, NULL, CMD_SET_AUTOREPLACE);
 
	return 0;
 
}
 

	
 
@@ -1328,7 +1355,7 @@ void CheckDifficultyLevels()
 

	
 
static int32 DifficultyReset(int32 level)
 
{
 
	SetDifficultyLevel(level, (_game_mode == GM_MENU) ? &_settings_newgame.difficulty : &_settings.difficulty);
 
	SetDifficultyLevel(level, (_game_mode == GM_MENU) ? &_settings_newgame.difficulty : &_settings_game.difficulty);
 
	return 0;
 
}
 

	
 
@@ -1337,7 +1364,7 @@ static int32 DifficultyChange(int32)
 
	if (_game_mode == GM_MENU) {
 
		_settings_newgame.difficulty.diff_level = 3;
 
	} else {
 
		_settings.difficulty.diff_level = 3;
 
		_settings_game.difficulty.diff_level = 3;
 
	}
 

	
 
	/* If we are a network-client, update the difficult setting (if it is open).
 
@@ -1354,7 +1381,7 @@ static int32 DifficultyNoiseChange(int32
 
{
 
	if (_game_mode == GM_NORMAL) {
 
		UpdateAirportsNoise();
 
		if (_settings.economy.station_noise_level) {
 
		if (_settings_game.economy.station_noise_level) {
 
			InvalidateWindowClassesData(WC_TOWN_VIEW, 0);
 
		}
 
	}
 
@@ -1372,14 +1399,14 @@ static int32 DifficultyNoiseChange(int32
 
 */
 
static int32 CheckTownLayout(int32 p1)
 
{
 
	if (_settings.economy.town_layout == TL_NO_ROADS && _game_mode == GM_EDITOR) {
 
	if (_settings_game.economy.town_layout == TL_NO_ROADS && _game_mode == GM_EDITOR) {
 
		ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_PATCHES_TOWN_LAYOUT_INVALID, 0, 0);
 
		_settings.economy.town_layout = TL_ORIGINAL;
 
		_settings_game.economy.town_layout = TL_ORIGINAL;
 
	}
 
	return 0;
 
}
 

	
 
/** Conversion callback for _gameopt_settings.landscape
 
/** Conversion callback for _gameopt_settings_game.landscape
 
 * It converts (or try) between old values and the new ones,
 
 * without loosing initial setting  of the user
 
 * @param value that was read from config file
 
@@ -1399,7 +1426,7 @@ static int32 ConvertLandscape(const char
 
 * So basically, 200, 400, 800 are the lowest allowed values */
 
static int32 CheckNoiseToleranceLevel(const char *value)
 
{
 
	Settings *s = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings;
 
	GameSettings *s = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game;
 
	for (uint16 i = 0; i < lengthof(s->economy.town_noise_population); i++) {
 
		s->economy.town_noise_population[i] = max(uint16(200 * (i + 1)), s->economy.town_noise_population[i]);
 
	}
 
@@ -1521,16 +1548,16 @@ static const SettingDesc _gameopt_settin
 
	 SDTG_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, SLE_FILE_I16 | SLE_VAR_U16,    C, 0, _old_diff_custom, 17, 0, 0, 0, 0, NULL, STR_NULL, NULL, 0,  3),
 
	 SDTG_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, SLE_UINT16,                    C, 0, _old_diff_custom, 18, 0, 0, 0, 0, NULL, STR_NULL, NULL, 4, 96),
 

	
 
	      SDT_VAR(Settings, difficulty.diff_level,    SLE_UINT8,                     0, 0, 0, 0,  3, 0, STR_NULL, NULL),
 
	    SDT_OMANY(Settings, gui.currency,             SLE_UINT8,                     N, 0, 0, CUSTOM_CURRENCY_ID, "GBP|USD|EUR|YEN|ATS|BEF|CHF|CZK|DEM|DKK|ESP|FIM|FRF|GRD|HUF|ISK|ITL|NLG|NOK|PLN|ROL|RUR|SIT|SEK|YTL|SKK|BRR|custom", STR_NULL, NULL, NULL),
 
	    SDT_OMANY(Settings, gui.units,                SLE_UINT8,                     N, 0, 1, 2, "imperial|metric|si", STR_NULL, NULL, NULL),
 
	      SDT_VAR(GameSettings, difficulty.diff_level,    SLE_UINT8,                     0, 0, 0, 0,  3, 0, STR_NULL, NULL),
 
	   SDTC_OMANY(              gui.currency,             SLE_UINT8,                     N, 0, 0, CUSTOM_CURRENCY_ID, "GBP|USD|EUR|YEN|ATS|BEF|CHF|CZK|DEM|DKK|ESP|FIM|FRF|GRD|HUF|ISK|ITL|NLG|NOK|PLN|ROL|RUR|SIT|SEK|YTL|SKK|BRR|custom", STR_NULL, NULL),
 
	   SDTC_OMANY(              gui.units,                SLE_UINT8,                     N, 0, 1, 2, "imperial|metric|si", STR_NULL, NULL),
 
	/* There are only 21 predefined town_name values (0-20), but you can have more with newgrf action F so allow these bigger values (21-255). Invalid values will fallback to english on use and (undefined string) in GUI. */
 
	    SDT_OMANY(Settings, game_creation.town_name,  SLE_UINT8,                     0, 0, 0, 255, "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovakish|norwegian|hungarian|austrian|romanian|czech|swiss|danish|turkish|italian|catalan", STR_NULL, NULL, NULL),
 
	    SDT_OMANY(Settings, game_creation.landscape,  SLE_UINT8,                     0, 0, 0, 3, "temperate|arctic|tropic|toyland", STR_NULL, NULL, ConvertLandscape),
 
	      SDT_VAR(Settings, game_creation.snow_line,  SLE_UINT8,                     0, 0, 7 * TILE_HEIGHT, 2 * TILE_HEIGHT, 13 * TILE_HEIGHT, 0, STR_NULL, NULL),
 
	SDT_CONDOMANY(Settings, gui.autosave,             SLE_UINT8,  0, 22,             N, 0, 0, 0, "", STR_NULL, NULL, NULL),
 
	SDT_CONDOMANY(Settings, gui.autosave,             SLE_UINT8, 23, SL_MAX_VERSION, S, 0, 1, 4, "off|monthly|quarterly|half year|yearly", STR_NULL, NULL, NULL),
 
	    SDT_OMANY(Settings, vehicle.road_side,        SLE_UINT8,                     0, 0, 1, 1, "left|right", STR_NULL, NULL, NULL),
 
	    SDT_OMANY(GameSettings, game_creation.town_name,  SLE_UINT8,                     0, 0, 0, 255, "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovakish|norwegian|hungarian|austrian|romanian|czech|swiss|danish|turkish|italian|catalan", STR_NULL, NULL, NULL),
 
	    SDT_OMANY(GameSettings, game_creation.landscape,  SLE_UINT8,                     0, 0, 0, 3, "temperate|arctic|tropic|toyland", STR_NULL, NULL, ConvertLandscape),
 
	      SDT_VAR(GameSettings, game_creation.snow_line,  SLE_UINT8,                     0, 0, 7 * TILE_HEIGHT, 2 * TILE_HEIGHT, 13 * TILE_HEIGHT, 0, STR_NULL, NULL),
 
 SDTC_CONDOMANY(              gui.autosave,             SLE_UINT8,  0, 22,             N, 0, 0, 0, "", STR_NULL, NULL),
 
 SDTC_CONDOMANY(              gui.autosave,             SLE_UINT8, 23, SL_MAX_VERSION, S, 0, 1, 4, "off|monthly|quarterly|half year|yearly", STR_NULL, NULL),
 
	    SDT_OMANY(GameSettings, vehicle.road_side,        SLE_UINT8,                     0, 0, 1, 1, "left|right", STR_NULL, NULL, NULL),
 
	    SDT_END()
 
};
 

	
 
@@ -1547,217 +1574,217 @@ const SettingDesc _patch_settings[] = {
 
	/***************************************************************************/
 
	/* Saved patch variables. */
 
	/* Do not ADD or REMOVE something in this "difficulty.XXX" table or before it. It breaks savegame compatability. */
 
	 SDT_CONDVAR(Settings, difficulty.max_no_competitors,        SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     2,     0,      7,  1, STR_NULL,                                  DifficultyChange),
 
	 SDT_CONDVAR(Settings, difficulty.competitor_start_time,     SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     2,     0,      3,  1, STR_6830_IMMEDIATE,                        DifficultyChange),
 
	 SDT_CONDVAR(Settings, difficulty.number_towns,              SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     2,     0,      3,  1, STR_NUM_VERY_LOW,                          DifficultyChange),
 
	 SDT_CONDVAR(Settings, difficulty.number_industries,         SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     4,     0,      4,  1, STR_NONE,                                  DifficultyChange),
 
	 SDT_CONDVAR(Settings, difficulty.max_loan,                 SLE_UINT32, 97, SL_MAX_VERSION, 0,NG|CR,300000,100000,500000,50000,STR_NULL,                               DifficultyChange),
 
	 SDT_CONDVAR(Settings, difficulty.initial_interest,          SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     2,     2,      4,  1, STR_NULL,                                  DifficultyChange),
 
	 SDT_CONDVAR(Settings, difficulty.vehicle_costs,             SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     0,     0,      2,  1, STR_6820_LOW,                              DifficultyChange),
 
	 SDT_CONDVAR(Settings, difficulty.competitor_speed,          SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     2,     0,      4,  1, STR_681B_VERY_SLOW,                        DifficultyChange),
 
	 SDT_CONDVAR(Settings, difficulty.competitor_intelligence,   SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     0,     0,      2,  1, STR_6820_LOW,                              DifficultyChange),
 
	 SDT_CONDVAR(Settings, difficulty.vehicle_breakdowns,        SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     1,     0,      2,  1, STR_6823_NONE,                             DifficultyChange),
 
	 SDT_CONDVAR(Settings, difficulty.subsidy_multiplier,        SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     2,     0,      3,  1, STR_6826_X1_5,                             DifficultyChange),
 
	 SDT_CONDVAR(Settings, difficulty.construction_cost,         SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     0,     0,      2,  1, STR_6820_LOW,                              DifficultyChange),
 
	 SDT_CONDVAR(Settings, difficulty.terrain_type,              SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     1,     0,      3,  1, STR_682A_VERY_FLAT,                        DifficultyChange),
 
	 SDT_CONDVAR(Settings, difficulty.quantity_sea_lakes,        SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     0,     0,      3,  1, STR_VERY_LOW,                              DifficultyChange),
 
	 SDT_CONDVAR(Settings, difficulty.economy,                   SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     0,     0,      1,  1, STR_682E_STEADY,                           DifficultyChange),
 
	 SDT_CONDVAR(Settings, difficulty.line_reverse_mode,         SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     0,     0,      1,  1, STR_6834_AT_END_OF_LINE_AND_AT_STATIONS,   DifficultyChange),
 
	 SDT_CONDVAR(Settings, difficulty.disasters,                 SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     0,     0,      1,  1, STR_6836_OFF,                              DifficultyChange),
 
	 SDT_CONDVAR(Settings, difficulty.town_council_tolerance,    SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     0,     0,      2,  1, STR_PERMISSIVE,                            DifficultyNoiseChange),
 
	 SDT_CONDVAR(Settings, difficulty.diff_level,                SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     0,     0,      3,  0, STR_NULL,                                  DifficultyReset),
 
	 SDT_CONDVAR(GameSettings, difficulty.max_no_competitors,        SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     2,     0,      7,  1, STR_NULL,                                  DifficultyChange),
 
	 SDT_CONDVAR(GameSettings, difficulty.competitor_start_time,     SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     2,     0,      3,  1, STR_6830_IMMEDIATE,                        DifficultyChange),
 
	 SDT_CONDVAR(GameSettings, difficulty.number_towns,              SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     2,     0,      3,  1, STR_NUM_VERY_LOW,                          DifficultyChange),
 
	 SDT_CONDVAR(GameSettings, difficulty.number_industries,         SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     4,     0,      4,  1, STR_NONE,                                  DifficultyChange),
 
	 SDT_CONDVAR(GameSettings, difficulty.max_loan,                 SLE_UINT32, 97, SL_MAX_VERSION, 0,NG|CR,300000,100000,500000,50000,STR_NULL,                               DifficultyChange),
 
	 SDT_CONDVAR(GameSettings, difficulty.initial_interest,          SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     2,     2,      4,  1, STR_NULL,                                  DifficultyChange),
 
	 SDT_CONDVAR(GameSettings, difficulty.vehicle_costs,             SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     0,     0,      2,  1, STR_6820_LOW,                              DifficultyChange),
 
	 SDT_CONDVAR(GameSettings, difficulty.competitor_speed,          SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     2,     0,      4,  1, STR_681B_VERY_SLOW,                        DifficultyChange),
 
	 SDT_CONDVAR(GameSettings, difficulty.competitor_intelligence,   SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     0,     0,      2,  1, STR_6820_LOW,                              DifficultyChange),
 
	 SDT_CONDVAR(GameSettings, difficulty.vehicle_breakdowns,        SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     1,     0,      2,  1, STR_6823_NONE,                             DifficultyChange),
 
	 SDT_CONDVAR(GameSettings, difficulty.subsidy_multiplier,        SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     2,     0,      3,  1, STR_6826_X1_5,                             DifficultyChange),
 
	 SDT_CONDVAR(GameSettings, difficulty.construction_cost,         SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     0,     0,      2,  1, STR_6820_LOW,                              DifficultyChange),
 
	 SDT_CONDVAR(GameSettings, difficulty.terrain_type,              SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     1,     0,      3,  1, STR_682A_VERY_FLAT,                        DifficultyChange),
 
	 SDT_CONDVAR(GameSettings, difficulty.quantity_sea_lakes,        SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     0,     0,      3,  1, STR_VERY_LOW,                              DifficultyChange),
 
	 SDT_CONDVAR(GameSettings, difficulty.economy,                   SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     0,     0,      1,  1, STR_682E_STEADY,                           DifficultyChange),
 
	 SDT_CONDVAR(GameSettings, difficulty.line_reverse_mode,         SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     0,     0,      1,  1, STR_6834_AT_END_OF_LINE_AND_AT_STATIONS,   DifficultyChange),
 
	 SDT_CONDVAR(GameSettings, difficulty.disasters,                 SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     0,     0,      1,  1, STR_6836_OFF,                              DifficultyChange),
 
	 SDT_CONDVAR(GameSettings, difficulty.town_council_tolerance,    SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     0,     0,      2,  1, STR_PERMISSIVE,                            DifficultyNoiseChange),
 
	 SDT_CONDVAR(GameSettings, difficulty.diff_level,                SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     0,     0,      3,  0, STR_NULL,                                  DifficultyReset),
 

	
 
	/* There are only 21 predefined town_name values (0-20), but you can have more with newgrf action F so allow these bigger values (21-255). Invalid values will fallback to english on use and (undefined string) in GUI. */
 
 SDT_CONDOMANY(Settings, game_creation.town_name,              SLE_UINT8, 97, SL_MAX_VERSION, 0,NN, 0, 255, "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovakish|norwegian|hungarian|austrian|romanian|czech|swiss|danish|turkish|italian|catalan", STR_NULL, NULL, NULL),
 
 SDT_CONDOMANY(Settings, game_creation.landscape,              SLE_UINT8, 97, SL_MAX_VERSION, 0,NN, 0,   3, "temperate|arctic|tropic|toyland", STR_NULL, NULL, ConvertLandscape),
 
	 SDT_CONDVAR(Settings, game_creation.snow_line,              SLE_UINT8, 97, SL_MAX_VERSION, 0,NN, 7 * TILE_HEIGHT, 2 * TILE_HEIGHT, 13 * TILE_HEIGHT, 0, STR_NULL, NULL),
 
 SDT_CONDOMANY(Settings, vehicle.road_side,                    SLE_UINT8, 97, SL_MAX_VERSION, 0,NN, 1,   1, "left|right", STR_NULL, NULL, NULL),
 
 SDT_CONDOMANY(GameSettings, game_creation.town_name,              SLE_UINT8, 97, SL_MAX_VERSION, 0,NN, 0, 255, "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovakish|norwegian|hungarian|austrian|romanian|czech|swiss|danish|turkish|italian|catalan", STR_NULL, NULL, NULL),
 
 SDT_CONDOMANY(GameSettings, game_creation.landscape,              SLE_UINT8, 97, SL_MAX_VERSION, 0,NN, 0,   3, "temperate|arctic|tropic|toyland", STR_NULL, NULL, ConvertLandscape),
 
	 SDT_CONDVAR(GameSettings, game_creation.snow_line,              SLE_UINT8, 97, SL_MAX_VERSION, 0,NN, 7 * TILE_HEIGHT, 2 * TILE_HEIGHT, 13 * TILE_HEIGHT, 0, STR_NULL, NULL),
 
 SDT_CONDOMANY(GameSettings, vehicle.road_side,                    SLE_UINT8, 97, SL_MAX_VERSION, 0,NN, 1,   1, "left|right", STR_NULL, NULL, NULL),
 

	
 
	    SDT_BOOL(Settings, construction.build_on_slopes,                                        0,NN,  true,                    STR_CONFIG_PATCHES_BUILDONSLOPES,          NULL),
 
	SDT_CONDBOOL(Settings, construction.autoslope,                          75, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_AUTOSLOPE,              NULL),
 
	    SDT_BOOL(Settings, construction.extra_dynamite,                                         0, 0, false,                    STR_CONFIG_PATCHES_EXTRADYNAMITE,          NULL),
 
	    SDT_BOOL(Settings, construction.longbridges,                                            0,NN,  true,                    STR_CONFIG_PATCHES_LONGBRIDGES,            NULL),
 
	    SDT_BOOL(Settings, construction.signal_side,                                            N,NN,  true,                    STR_CONFIG_PATCHES_SIGNALSIDE,             RedrawScreen),
 
	    SDT_BOOL(Settings, station.always_small_airport,                                        0,NN, false,                    STR_CONFIG_PATCHES_SMALL_AIRPORTS,         NULL),
 
	 SDT_CONDVAR(Settings, economy.town_layout,                  SLE_UINT8, 59, SL_MAX_VERSION, 0,MS,TL_ORIGINAL,TL_NO_ROADS,NUM_TLS-1,1, STR_CONFIG_PATCHES_TOWN_LAYOUT,  CheckTownLayout),
 
	    SDT_BOOL(GameSettings, construction.build_on_slopes,                                        0,NN,  true,                    STR_CONFIG_PATCHES_BUILDONSLOPES,          NULL),
 
	SDT_CONDBOOL(GameSettings, construction.autoslope,                          75, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_AUTOSLOPE,              NULL),
 
	    SDT_BOOL(GameSettings, construction.extra_dynamite,                                         0, 0, false,                    STR_CONFIG_PATCHES_EXTRADYNAMITE,          NULL),
 
	    SDT_BOOL(GameSettings, construction.longbridges,                                            0,NN,  true,                    STR_CONFIG_PATCHES_LONGBRIDGES,            NULL),
 
	    SDT_BOOL(GameSettings, construction.signal_side,                                            N,NN,  true,                    STR_CONFIG_PATCHES_SIGNALSIDE,             RedrawScreen),
 
	    SDT_BOOL(GameSettings, station.always_small_airport,                                        0,NN, false,                    STR_CONFIG_PATCHES_SMALL_AIRPORTS,         NULL),
 
	 SDT_CONDVAR(GameSettings, economy.town_layout,                  SLE_UINT8, 59, SL_MAX_VERSION, 0,MS,TL_ORIGINAL,TL_NO_ROADS,NUM_TLS-1,1, STR_CONFIG_PATCHES_TOWN_LAYOUT,  CheckTownLayout),
 

	
 
	    SDT_BOOL(Settings, vehicle.realistic_acceleration,                                      0, 0, false,                    STR_CONFIG_PATCHES_REALISTICACCEL,         RealisticAccelerationChanged),
 
	    SDT_BOOL(Settings, pf.forbid_90_deg,                                                    0, 0, false,                    STR_CONFIG_PATCHES_FORBID_90_DEG,          NULL),
 
	    SDT_BOOL(Settings, vehicle.mammoth_trains,                                              0,NN,  true,                    STR_CONFIG_PATCHES_MAMMOTHTRAINS,          NULL),
 
	    SDT_BOOL(Settings, order.gotodepot,                                                     0, 0,  true,                    STR_CONFIG_PATCHES_GOTODEPOT,              NULL),
 
	    SDT_BOOL(Settings, pf.roadveh_queue,                                                    0, 0,  true,                    STR_CONFIG_PATCHES_ROADVEH_QUEUE,          NULL),
 
	    SDT_BOOL(GameSettings, vehicle.realistic_acceleration,                                      0, 0, false,                    STR_CONFIG_PATCHES_REALISTICACCEL,         RealisticAccelerationChanged),
 
	    SDT_BOOL(GameSettings, pf.forbid_90_deg,                                                    0, 0, false,                    STR_CONFIG_PATCHES_FORBID_90_DEG,          NULL),
 
	    SDT_BOOL(GameSettings, vehicle.mammoth_trains,                                              0,NN,  true,                    STR_CONFIG_PATCHES_MAMMOTHTRAINS,          NULL),
 
	    SDT_BOOL(GameSettings, order.gotodepot,                                                     0, 0,  true,                    STR_CONFIG_PATCHES_GOTODEPOT,              NULL),
 
	    SDT_BOOL(GameSettings, pf.roadveh_queue,                                                    0, 0,  true,                    STR_CONFIG_PATCHES_ROADVEH_QUEUE,          NULL),
 

	
 
	SDT_CONDBOOL(Settings, pf.new_pathfinding_all,                           0,             86, 0, 0, false,                    STR_NULL,                                  NULL),
 
	SDT_CONDBOOL(Settings, pf.yapf.ship_use_yapf,                           28,             86, 0, 0, false,                    STR_NULL,                                  NULL),
 
	SDT_CONDBOOL(Settings, pf.yapf.road_use_yapf,                           28,             86, 0, 0,  true,                    STR_NULL,                                  NULL),
 
	SDT_CONDBOOL(Settings, pf.yapf.rail_use_yapf,                           28,             86, 0, 0,  true,                    STR_NULL,                                  NULL),
 
	SDT_CONDBOOL(GameSettings, pf.new_pathfinding_all,                           0,             86, 0, 0, false,                    STR_NULL,                                  NULL),
 
	SDT_CONDBOOL(GameSettings, pf.yapf.ship_use_yapf,                           28,             86, 0, 0, false,                    STR_NULL,                                  NULL),
 
	SDT_CONDBOOL(GameSettings, pf.yapf.road_use_yapf,                           28,             86, 0, 0,  true,                    STR_NULL,                                  NULL),
 
	SDT_CONDBOOL(GameSettings, pf.yapf.rail_use_yapf,                           28,             86, 0, 0,  true,                    STR_NULL,                                  NULL),
 

	
 
	 SDT_CONDVAR(Settings, pf.pathfinder_for_trains,             SLE_UINT8, 87, SL_MAX_VERSION, 0, MS,    2,     0,       2, 1, STR_CONFIG_PATCHES_PATHFINDER_FOR_TRAINS,  NULL),
 
	 SDT_CONDVAR(Settings, pf.pathfinder_for_roadvehs,           SLE_UINT8, 87, SL_MAX_VERSION, 0, MS,    2,     0,       2, 1, STR_CONFIG_PATCHES_PATHFINDER_FOR_ROADVEH, NULL),
 
	 SDT_CONDVAR(Settings, pf.pathfinder_for_ships,              SLE_UINT8, 87, SL_MAX_VERSION, 0, MS,    0,     0,       2, 1, STR_CONFIG_PATCHES_PATHFINDER_FOR_SHIPS,   NULL),
 
	 SDT_CONDVAR(GameSettings, pf.pathfinder_for_trains,             SLE_UINT8, 87, SL_MAX_VERSION, 0, MS,    2,     0,       2, 1, STR_CONFIG_PATCHES_PATHFINDER_FOR_TRAINS,  NULL),
 
	 SDT_CONDVAR(GameSettings, pf.pathfinder_for_roadvehs,           SLE_UINT8, 87, SL_MAX_VERSION, 0, MS,    2,     0,       2, 1, STR_CONFIG_PATCHES_PATHFINDER_FOR_ROADVEH, NULL),
 
	 SDT_CONDVAR(GameSettings, pf.pathfinder_for_ships,              SLE_UINT8, 87, SL_MAX_VERSION, 0, MS,    0,     0,       2, 1, STR_CONFIG_PATCHES_PATHFINDER_FOR_SHIPS,   NULL),
 

	
 
	    SDT_BOOL(Settings, vehicle.never_expire_vehicles,                                       0,NN, false,                    STR_CONFIG_PATCHES_NEVER_EXPIRE_VEHICLES,  NULL),
 
	     SDT_VAR(Settings, vehicle.max_trains,                  SLE_UINT16,                     0, 0,   500,     0,    5000, 0, STR_CONFIG_PATCHES_MAX_TRAINS,             RedrawScreen),
 
	     SDT_VAR(Settings, vehicle.max_roadveh,                 SLE_UINT16,                     0, 0,   500,     0,    5000, 0, STR_CONFIG_PATCHES_MAX_ROADVEH,            RedrawScreen),
 
	     SDT_VAR(Settings, vehicle.max_aircraft,                SLE_UINT16,                     0, 0,   200,     0,    5000, 0, STR_CONFIG_PATCHES_MAX_AIRCRAFT,           RedrawScreen),
 
	     SDT_VAR(Settings, vehicle.max_ships,                   SLE_UINT16,                     0, 0,   300,     0,    5000, 0, STR_CONFIG_PATCHES_MAX_SHIPS,              RedrawScreen),
 
	    SDT_BOOL(Settings, vehicle.servint_ispercent,                                           0, 0, false,                    STR_CONFIG_PATCHES_SERVINT_ISPERCENT,      CheckInterval),
 
	     SDT_VAR(Settings, vehicle.servint_trains,              SLE_UINT16,                     0,D0,   150,     5,     800, 0, STR_CONFIG_PATCHES_SERVINT_TRAINS,         InValidateDetailsWindow),
 
	     SDT_VAR(Settings, vehicle.servint_roadveh,             SLE_UINT16,                     0,D0,   150,     5,     800, 0, STR_CONFIG_PATCHES_SERVINT_ROADVEH,        InValidateDetailsWindow),
 
	     SDT_VAR(Settings, vehicle.servint_ships,               SLE_UINT16,                     0,D0,   360,     5,     800, 0, STR_CONFIG_PATCHES_SERVINT_SHIPS,          InValidateDetailsWindow),
 
	     SDT_VAR(Settings, vehicle.servint_aircraft,            SLE_UINT16,                     0,D0,   100,     5,     800, 0, STR_CONFIG_PATCHES_SERVINT_AIRCRAFT,       InValidateDetailsWindow),
 
	    SDT_BOOL(Settings, order.no_servicing_if_no_breakdowns,                                 0, 0, false,                    STR_CONFIG_PATCHES_NOSERVICE,              NULL),
 
	    SDT_BOOL(Settings, vehicle.wagon_speed_limits,                                          0,NN,  true,                    STR_CONFIG_PATCHES_WAGONSPEEDLIMITS,       UpdateConsists),
 
	SDT_CONDBOOL(Settings, vehicle.disable_elrails,                         38, SL_MAX_VERSION, 0,NN, false,                    STR_CONFIG_PATCHES_DISABLE_ELRAILS,        SettingsDisableElrail),
 
	 SDT_CONDVAR(Settings, vehicle.freight_trains,               SLE_UINT8, 39, SL_MAX_VERSION, 0,NN,     1,     1,     255, 1, STR_CONFIG_PATCHES_FREIGHT_TRAINS,         NULL),
 
	SDT_CONDBOOL(Settings, order.timetabling,                               67, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_TIMETABLE_ALLOW,        NULL),
 
	 SDT_CONDVAR(Settings, vehicle.plane_speed,                  SLE_UINT8, 90, SL_MAX_VERSION, 0, 0,     4,     1,       4, 0, STR_CONFIG_PATCHES_PLANE_SPEED,            NULL),
 
	SDT_CONDBOOL(Settings, vehicle.dynamic_engines,                         95, SL_MAX_VERSION, 0,NN, false,                    STR_CONFIG_PATCHES_DYNAMIC_ENGINES,        NULL),
 
	    SDT_BOOL(GameSettings, vehicle.never_expire_vehicles,                                       0,NN, false,                    STR_CONFIG_PATCHES_NEVER_EXPIRE_VEHICLES,  NULL),
 
	     SDT_VAR(GameSettings, vehicle.max_trains,                  SLE_UINT16,                     0, 0,   500,     0,    5000, 0, STR_CONFIG_PATCHES_MAX_TRAINS,             RedrawScreen),
 
	     SDT_VAR(GameSettings, vehicle.max_roadveh,                 SLE_UINT16,                     0, 0,   500,     0,    5000, 0, STR_CONFIG_PATCHES_MAX_ROADVEH,            RedrawScreen),
 
	     SDT_VAR(GameSettings, vehicle.max_aircraft,                SLE_UINT16,                     0, 0,   200,     0,    5000, 0, STR_CONFIG_PATCHES_MAX_AIRCRAFT,           RedrawScreen),
 
	     SDT_VAR(GameSettings, vehicle.max_ships,                   SLE_UINT16,                     0, 0,   300,     0,    5000, 0, STR_CONFIG_PATCHES_MAX_SHIPS,              RedrawScreen),
 
	    SDT_BOOL(GameSettings, vehicle.servint_ispercent,                                           0, 0, false,                    STR_CONFIG_PATCHES_SERVINT_ISPERCENT,      CheckInterval),
 
	     SDT_VAR(GameSettings, vehicle.servint_trains,              SLE_UINT16,                     0,D0,   150,     5,     800, 0, STR_CONFIG_PATCHES_SERVINT_TRAINS,         InValidateDetailsWindow),
 
	     SDT_VAR(GameSettings, vehicle.servint_roadveh,             SLE_UINT16,                     0,D0,   150,     5,     800, 0, STR_CONFIG_PATCHES_SERVINT_ROADVEH,        InValidateDetailsWindow),
 
	     SDT_VAR(GameSettings, vehicle.servint_ships,               SLE_UINT16,                     0,D0,   360,     5,     800, 0, STR_CONFIG_PATCHES_SERVINT_SHIPS,          InValidateDetailsWindow),
 
	     SDT_VAR(GameSettings, vehicle.servint_aircraft,            SLE_UINT16,                     0,D0,   100,     5,     800, 0, STR_CONFIG_PATCHES_SERVINT_AIRCRAFT,       InValidateDetailsWindow),
 
	    SDT_BOOL(GameSettings, order.no_servicing_if_no_breakdowns,                                 0, 0, false,                    STR_CONFIG_PATCHES_NOSERVICE,              NULL),
 
	    SDT_BOOL(GameSettings, vehicle.wagon_speed_limits,                                          0,NN,  true,                    STR_CONFIG_PATCHES_WAGONSPEEDLIMITS,       UpdateConsists),
 
	SDT_CONDBOOL(GameSettings, vehicle.disable_elrails,                         38, SL_MAX_VERSION, 0,NN, false,                    STR_CONFIG_PATCHES_DISABLE_ELRAILS,        SettingsDisableElrail),
 
	 SDT_CONDVAR(GameSettings, vehicle.freight_trains,               SLE_UINT8, 39, SL_MAX_VERSION, 0,NN,     1,     1,     255, 1, STR_CONFIG_PATCHES_FREIGHT_TRAINS,         NULL),
 
	SDT_CONDBOOL(GameSettings, order.timetabling,                               67, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_TIMETABLE_ALLOW,        NULL),
 
	 SDT_CONDVAR(GameSettings, vehicle.plane_speed,                  SLE_UINT8, 90, SL_MAX_VERSION, 0, 0,     4,     1,       4, 0, STR_CONFIG_PATCHES_PLANE_SPEED,            NULL),
 
	SDT_CONDBOOL(GameSettings, vehicle.dynamic_engines,                         95, SL_MAX_VERSION, 0,NN, false,                    STR_CONFIG_PATCHES_DYNAMIC_ENGINES,        NULL),
 

	
 
	    SDT_BOOL(Settings, station.join_stations,                                               0, 0,  true,                    STR_CONFIG_PATCHES_JOINSTATIONS,           NULL),
 
	SDT_CONDBOOL(Settings, gui.sg_full_load_any,                             0,             92, 0, 0 , true,                    STR_NULL,                                  NULL),
 
	    SDT_BOOL(Settings, order.improved_load,                                                 0,NN,  true,                    STR_CONFIG_PATCHES_IMPROVEDLOAD,           NULL),
 
	    SDT_BOOL(Settings, order.selectgoods,                                                   0, 0,  true,                    STR_CONFIG_PATCHES_SELECTGOODS,            NULL),
 
	SDT_CONDBOOL(Settings, gui.sg_new_nonstop,                               0,             92, 0, 0, false,                    STR_NULL,                                  NULL),
 
	    SDT_BOOL(Settings, station.nonuniform_stations,                                         0,NN,  true,                    STR_CONFIG_PATCHES_NONUNIFORM_STATIONS,    NULL),
 
	     SDT_VAR(Settings, station.station_spread,               SLE_UINT8,                     0, 0,    12,     4,      64, 0, STR_CONFIG_PATCHES_STATION_SPREAD,         InvalidateStationBuildWindow),
 
	    SDT_BOOL(Settings, order.serviceathelipad,                                              0, 0,  true,                    STR_CONFIG_PATCHES_SERVICEATHELIPAD,       NULL),
 
	    SDT_BOOL(Settings, station.modified_catchment,                                          0, 0,  true,                    STR_CONFIG_PATCHES_CATCHMENT,              NULL),
 
	SDT_CONDBOOL(Settings, order.gradual_loading,                           40, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_GRADUAL_LOADING,        NULL),
 
	SDT_CONDBOOL(Settings, construction.road_stop_on_town_road,             47, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD,      NULL),
 
	SDT_CONDBOOL(Settings, station.adjacent_stations,                       62, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_ADJACENT_STATIONS,      NULL),
 
	SDT_CONDBOOL(Settings, economy.station_noise_level,                     96, SL_MAX_VERSION, 0, 0, false,                    STR_CONFIG_PATCHES_NOISE_LEVEL,            InvalidateTownViewWindow),
 
	    SDT_BOOL(GameSettings, station.join_stations,                                               0, 0,  true,                    STR_CONFIG_PATCHES_JOINSTATIONS,           NULL),
 
 SDTC_CONDBOOL(              gui.sg_full_load_any,                             0,             92, 0, 0 , true,                    STR_NULL,                                  NULL),
 
	    SDT_BOOL(GameSettings, order.improved_load,                                                 0,NN,  true,                    STR_CONFIG_PATCHES_IMPROVEDLOAD,           NULL),
 
	    SDT_BOOL(GameSettings, order.selectgoods,                                                   0, 0,  true,                    STR_CONFIG_PATCHES_SELECTGOODS,            NULL),
 
 SDTC_CONDBOOL(              gui.sg_new_nonstop,                               0,             92, 0, 0, false,                    STR_NULL,                                  NULL),
 
	    SDT_BOOL(GameSettings, station.nonuniform_stations,                                         0,NN,  true,                    STR_CONFIG_PATCHES_NONUNIFORM_STATIONS,    NULL),
 
	     SDT_VAR(GameSettings, station.station_spread,               SLE_UINT8,                     0, 0,    12,     4,      64, 0, STR_CONFIG_PATCHES_STATION_SPREAD,         InvalidateStationBuildWindow),
 
	    SDT_BOOL(GameSettings, order.serviceathelipad,                                              0, 0,  true,                    STR_CONFIG_PATCHES_SERVICEATHELIPAD,       NULL),
 
	    SDT_BOOL(GameSettings, station.modified_catchment,                                          0, 0,  true,                    STR_CONFIG_PATCHES_CATCHMENT,              NULL),
 
	SDT_CONDBOOL(GameSettings, order.gradual_loading,                           40, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_GRADUAL_LOADING,        NULL),
 
	SDT_CONDBOOL(GameSettings, construction.road_stop_on_town_road,             47, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD,      NULL),
 
	SDT_CONDBOOL(GameSettings, station.adjacent_stations,                       62, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_ADJACENT_STATIONS,      NULL),
 
	SDT_CONDBOOL(GameSettings, economy.station_noise_level,                     96, SL_MAX_VERSION, 0, 0, false,                    STR_CONFIG_PATCHES_NOISE_LEVEL,            InvalidateTownViewWindow),
 

	
 
	    SDT_BOOL(Settings, economy.inflation,                                                   0, 0,  true,                    STR_CONFIG_PATCHES_INFLATION,              NULL),
 
	     SDT_VAR(Settings, construction.raw_industry_construction, SLE_UINT8,                   0,MS,     0,     0,       2, 0, STR_CONFIG_PATCHES_RAW_INDUSTRY_CONSTRUCTION_METHOD, InvalidateBuildIndustryWindow),
 
	    SDT_BOOL(Settings, economy.multiple_industry_per_town,                                  0, 0, false,                    STR_CONFIG_PATCHES_MULTIPINDTOWN,          NULL),
 
	    SDT_BOOL(Settings, economy.same_industry_close,                                         0, 0, false,                    STR_CONFIG_PATCHES_SAMEINDCLOSE,           NULL),
 
	    SDT_BOOL(Settings, economy.bribe,                                                       0, 0,  true,                    STR_CONFIG_PATCHES_BRIBE,                  NULL),
 
	SDT_CONDBOOL(Settings, economy.exclusive_rights,                        79, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_ALLOW_EXCLUSIVE,        NULL),
 
	SDT_CONDBOOL(Settings, economy.give_money,                              79, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_ALLOW_GIVE_MONEY,       NULL),
 
	     SDT_VAR(Settings, game_creation.snow_line_height,       SLE_UINT8,                     0, 0,     7,     2,      13, 0, STR_CONFIG_PATCHES_SNOWLINE_HEIGHT,        NULL),
 
	     SDT_VAR(Settings, gui.colored_news_year,                SLE_INT32,                     0,NC,  2000,MIN_YEAR,MAX_YEAR,1,STR_CONFIG_PATCHES_COLORED_NEWS_YEAR,      NULL),
 
	     SDT_VAR(Settings, game_creation.starting_year,          SLE_INT32,                     0,NC,  1950,MIN_YEAR,MAX_YEAR,1,STR_CONFIG_PATCHES_STARTING_YEAR,          NULL),
 
	     SDT_VAR(Settings, gui.ending_year,                      SLE_INT32,                    0,NC|NO,2051,MIN_YEAR,MAX_YEAR,1,STR_CONFIG_PATCHES_ENDING_YEAR,            NULL),
 
	    SDT_BOOL(Settings, economy.smooth_economy,                                              0, 0,  true,                    STR_CONFIG_PATCHES_SMOOTH_ECONOMY,         NULL),
 
	    SDT_BOOL(Settings, economy.allow_shares,                                                0, 0, false,                    STR_CONFIG_PATCHES_ALLOW_SHARES,           NULL),
 
	 SDT_CONDVAR(Settings, economy.town_growth_rate,             SLE_UINT8, 54, SL_MAX_VERSION, 0, MS,    2,     0,       4, 0, STR_CONFIG_PATCHES_TOWN_GROWTH,            NULL),
 
	 SDT_CONDVAR(Settings, economy.larger_towns,                 SLE_UINT8, 54, SL_MAX_VERSION, 0, D0,    4,     0,     255, 1, STR_CONFIG_PATCHES_LARGER_TOWNS,           NULL),
 
	 SDT_CONDVAR(Settings, economy.initial_city_size,            SLE_UINT8, 56, SL_MAX_VERSION, 0, 0,     2,     1,      10, 1, STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER,   NULL),
 
	SDT_CONDBOOL(Settings, economy.mod_road_rebuild,                        77, SL_MAX_VERSION, 0, 0, false,                    STR_CONFIG_MODIFIED_ROAD_REBUILD,          NULL),
 
	    SDT_BOOL(GameSettings, economy.inflation,                                                   0, 0,  true,                    STR_CONFIG_PATCHES_INFLATION,              NULL),
 
	     SDT_VAR(GameSettings, construction.raw_industry_construction, SLE_UINT8,                   0,MS,     0,     0,       2, 0, STR_CONFIG_PATCHES_RAW_INDUSTRY_CONSTRUCTION_METHOD, InvalidateBuildIndustryWindow),
 
	    SDT_BOOL(GameSettings, economy.multiple_industry_per_town,                                  0, 0, false,                    STR_CONFIG_PATCHES_MULTIPINDTOWN,          NULL),
 
	    SDT_BOOL(GameSettings, economy.same_industry_close,                                         0, 0, false,                    STR_CONFIG_PATCHES_SAMEINDCLOSE,           NULL),
 
	    SDT_BOOL(GameSettings, economy.bribe,                                                       0, 0,  true,                    STR_CONFIG_PATCHES_BRIBE,                  NULL),
 
	SDT_CONDBOOL(GameSettings, economy.exclusive_rights,                        79, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_ALLOW_EXCLUSIVE,        NULL),
 
	SDT_CONDBOOL(GameSettings, economy.give_money,                              79, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_ALLOW_GIVE_MONEY,       NULL),
 
	     SDT_VAR(GameSettings, game_creation.snow_line_height,       SLE_UINT8,                     0, 0,     7,     2,      13, 0, STR_CONFIG_PATCHES_SNOWLINE_HEIGHT,        NULL),
 
	    SDTC_VAR(              gui.colored_news_year,                SLE_INT32,                     0,NC,  2000,MIN_YEAR,MAX_YEAR,1,STR_CONFIG_PATCHES_COLORED_NEWS_YEAR,      NULL),
 
	     SDT_VAR(GameSettings, game_creation.starting_year,          SLE_INT32,                     0,NC,  1950,MIN_YEAR,MAX_YEAR,1,STR_CONFIG_PATCHES_STARTING_YEAR,          NULL),
 
	    SDTC_VAR(              gui.ending_year,                      SLE_INT32,                    0,NC|NO,2051,MIN_YEAR,MAX_YEAR,1,STR_CONFIG_PATCHES_ENDING_YEAR,            NULL),
 
	    SDT_BOOL(GameSettings, economy.smooth_economy,                                              0, 0,  true,                    STR_CONFIG_PATCHES_SMOOTH_ECONOMY,         NULL),
 
	    SDT_BOOL(GameSettings, economy.allow_shares,                                                0, 0, false,                    STR_CONFIG_PATCHES_ALLOW_SHARES,           NULL),
 
	 SDT_CONDVAR(GameSettings, economy.town_growth_rate,             SLE_UINT8, 54, SL_MAX_VERSION, 0, MS,    2,     0,       4, 0, STR_CONFIG_PATCHES_TOWN_GROWTH,            NULL),
 
	 SDT_CONDVAR(GameSettings, economy.larger_towns,                 SLE_UINT8, 54, SL_MAX_VERSION, 0, D0,    4,     0,     255, 1, STR_CONFIG_PATCHES_LARGER_TOWNS,           NULL),
 
	 SDT_CONDVAR(GameSettings, economy.initial_city_size,            SLE_UINT8, 56, SL_MAX_VERSION, 0, 0,     2,     1,      10, 1, STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER,   NULL),
 
	SDT_CONDBOOL(GameSettings, economy.mod_road_rebuild,                        77, SL_MAX_VERSION, 0, 0, false,                    STR_CONFIG_MODIFIED_ROAD_REBUILD,          NULL),
 

	
 
	    SDT_BOOL(Settings, ai.ainew_active,                                                     0, 0, false,                    STR_CONFIG_PATCHES_AINEW_ACTIVE,           AiNew_PatchActive_Warning),
 
	    SDT_BOOL(Settings, ai.ai_in_multiplayer,                                                0, 0, false,                    STR_CONFIG_PATCHES_AI_IN_MULTIPLAYER,      Ai_In_Multiplayer_Warning),
 
	    SDT_BOOL(Settings, ai.ai_disable_veh_train,                                             0, 0, false,                    STR_CONFIG_PATCHES_AI_BUILDS_TRAINS,       NULL),
 
	    SDT_BOOL(Settings, ai.ai_disable_veh_roadveh,                                           0, 0, false,                    STR_CONFIG_PATCHES_AI_BUILDS_ROADVEH,      NULL),
 
	    SDT_BOOL(Settings, ai.ai_disable_veh_aircraft,                                          0, 0, false,                    STR_CONFIG_PATCHES_AI_BUILDS_AIRCRAFT,     NULL),
 
	    SDT_BOOL(Settings, ai.ai_disable_veh_ship,                                              0, 0, false,                    STR_CONFIG_PATCHES_AI_BUILDS_SHIPS,        NULL),
 
	    SDT_BOOL(GameSettings, ai.ainew_active,                                                     0, 0, false,                    STR_CONFIG_PATCHES_AINEW_ACTIVE,           AiNew_PatchActive_Warning),
 
	    SDT_BOOL(GameSettings, ai.ai_in_multiplayer,                                                0, 0, false,                    STR_CONFIG_PATCHES_AI_IN_MULTIPLAYER,      Ai_In_Multiplayer_Warning),
 
	    SDT_BOOL(GameSettings, ai.ai_disable_veh_train,                                             0, 0, false,                    STR_CONFIG_PATCHES_AI_BUILDS_TRAINS,       NULL),
 
	    SDT_BOOL(GameSettings, ai.ai_disable_veh_roadveh,                                           0, 0, false,                    STR_CONFIG_PATCHES_AI_BUILDS_ROADVEH,      NULL),
 
	    SDT_BOOL(GameSettings, ai.ai_disable_veh_aircraft,                                          0, 0, false,                    STR_CONFIG_PATCHES_AI_BUILDS_AIRCRAFT,     NULL),
 
	    SDT_BOOL(GameSettings, ai.ai_disable_veh_ship,                                              0, 0, false,                    STR_CONFIG_PATCHES_AI_BUILDS_SHIPS,        NULL),
 

	
 
	     SDT_VAR(Settings, vehicle.extend_vehicle_life,          SLE_UINT8,                     0, 0,     0,     0,     100, 0, STR_NULL,                                  NULL),
 
	     SDT_VAR(Settings, economy.dist_local_authority,         SLE_UINT8,                     0, 0,    20,     5,      60, 0, STR_NULL,                                  NULL),
 
	     SDT_VAR(Settings, pf.wait_oneway_signal,                SLE_UINT8,                     0, 0,    15,     2,     100, 0, STR_NULL,                                  NULL),
 
	     SDT_VAR(Settings, pf.wait_twoway_signal,                SLE_UINT8,                     0, 0,    41,     2,     100, 0, STR_NULL,                                  NULL),
 
	SDT_CONDLISTO(Settings, economy.town_noise_population, 3,   SLE_UINT16, 96, SL_MAX_VERSION, 0,D0, "800,2000,4000",          STR_NULL,                                  NULL, CheckNoiseToleranceLevel),
 
	     SDT_VAR(GameSettings, vehicle.extend_vehicle_life,          SLE_UINT8,                     0, 0,     0,     0,     100, 0, STR_NULL,                                  NULL),
 
	     SDT_VAR(GameSettings, economy.dist_local_authority,         SLE_UINT8,                     0, 0,    20,     5,      60, 0, STR_NULL,                                  NULL),
 
	     SDT_VAR(GameSettings, pf.wait_oneway_signal,                SLE_UINT8,                     0, 0,    15,     2,     100, 0, STR_NULL,                                  NULL),
 
	     SDT_VAR(GameSettings, pf.wait_twoway_signal,                SLE_UINT8,                     0, 0,    41,     2,     100, 0, STR_NULL,                                  NULL),
 
	SDT_CONDLISTO(GameSettings, economy.town_noise_population, 3,   SLE_UINT16, 96, SL_MAX_VERSION, 0,D0, "800,2000,4000",          STR_NULL,                                  NULL, CheckNoiseToleranceLevel),
 

	
 
	     SDT_VAR(Settings, pf.opf.pf_maxlength,                          SLE_UINT16,                     0, 0,  4096,                    64,   65535, 0, STR_NULL,         NULL),
 
	     SDT_VAR(Settings, pf.opf.pf_maxdepth,                            SLE_UINT8,                     0, 0,    48,                     4,     255, 0, STR_NULL,         NULL),
 
	     SDT_VAR(GameSettings, pf.opf.pf_maxlength,                          SLE_UINT16,                     0, 0,  4096,                    64,   65535, 0, STR_NULL,         NULL),
 
	     SDT_VAR(GameSettings, pf.opf.pf_maxdepth,                            SLE_UINT8,                     0, 0,    48,                     4,     255, 0, STR_NULL,         NULL),
 

	
 
	     SDT_VAR(Settings, pf.npf.npf_max_search_nodes,                    SLE_UINT,                     0, 0, 10000,                   500,  100000, 0, STR_NULL,         NULL),
 
	     SDT_VAR(Settings, pf.npf.npf_rail_firstred_penalty,               SLE_UINT,                     0, 0, ( 10 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
 
	     SDT_VAR(Settings, pf.npf.npf_rail_firstred_exit_penalty,          SLE_UINT,                     0, 0, (100 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
 
	     SDT_VAR(Settings, pf.npf.npf_rail_lastred_penalty,                SLE_UINT,                     0, 0, ( 10 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
 
	     SDT_VAR(Settings, pf.npf.npf_rail_station_penalty,                SLE_UINT,                     0, 0, (  1 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
 
	     SDT_VAR(Settings, pf.npf.npf_rail_slope_penalty,                  SLE_UINT,                     0, 0, (  1 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
 
	     SDT_VAR(Settings, pf.npf.npf_rail_curve_penalty,                  SLE_UINT,                     0, 0, 1,                         0,  100000, 0, STR_NULL,         NULL),
 
	     SDT_VAR(Settings, pf.npf.npf_rail_depot_reverse_penalty,          SLE_UINT,                     0, 0, ( 50 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
 
	     SDT_VAR(Settings, pf.npf.npf_buoy_penalty,                        SLE_UINT,                     0, 0, (  2 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
 
	     SDT_VAR(Settings, pf.npf.npf_water_curve_penalty,                 SLE_UINT,                     0, 0, (NPF_TILE_LENGTH / 4),     0,  100000, 0, STR_NULL,         NULL),
 
	     SDT_VAR(Settings, pf.npf.npf_road_curve_penalty,                  SLE_UINT,                     0, 0, 1,                         0,  100000, 0, STR_NULL,         NULL),
 
	     SDT_VAR(Settings, pf.npf.npf_crossing_penalty,                    SLE_UINT,                     0, 0, (  3 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(Settings, pf.npf.npf_road_drive_through_penalty,          SLE_UINT, 47, SL_MAX_VERSION, 0, 0, (  8 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
 
	     SDT_VAR(GameSettings, pf.npf.npf_max_search_nodes,                    SLE_UINT,                     0, 0, 10000,                   500,  100000, 0, STR_NULL,         NULL),
 
	     SDT_VAR(GameSettings, pf.npf.npf_rail_firstred_penalty,               SLE_UINT,                     0, 0, ( 10 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
 
	     SDT_VAR(GameSettings, pf.npf.npf_rail_firstred_exit_penalty,          SLE_UINT,                     0, 0, (100 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
 
	     SDT_VAR(GameSettings, pf.npf.npf_rail_lastred_penalty,                SLE_UINT,                     0, 0, ( 10 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
 
	     SDT_VAR(GameSettings, pf.npf.npf_rail_station_penalty,                SLE_UINT,                     0, 0, (  1 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
 
	     SDT_VAR(GameSettings, pf.npf.npf_rail_slope_penalty,                  SLE_UINT,                     0, 0, (  1 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
 
	     SDT_VAR(GameSettings, pf.npf.npf_rail_curve_penalty,                  SLE_UINT,                     0, 0, 1,                         0,  100000, 0, STR_NULL,         NULL),
 
	     SDT_VAR(GameSettings, pf.npf.npf_rail_depot_reverse_penalty,          SLE_UINT,                     0, 0, ( 50 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
 
	     SDT_VAR(GameSettings, pf.npf.npf_buoy_penalty,                        SLE_UINT,                     0, 0, (  2 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
 
	     SDT_VAR(GameSettings, pf.npf.npf_water_curve_penalty,                 SLE_UINT,                     0, 0, (NPF_TILE_LENGTH / 4),     0,  100000, 0, STR_NULL,         NULL),
 
	     SDT_VAR(GameSettings, pf.npf.npf_road_curve_penalty,                  SLE_UINT,                     0, 0, 1,                         0,  100000, 0, STR_NULL,         NULL),
 
	     SDT_VAR(GameSettings, pf.npf.npf_crossing_penalty,                    SLE_UINT,                     0, 0, (  3 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(GameSettings, pf.npf.npf_road_drive_through_penalty,          SLE_UINT, 47, SL_MAX_VERSION, 0, 0, (  8 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
 

	
 

	
 
	SDT_CONDBOOL(Settings, pf.yapf.disable_node_optimization,                        28, SL_MAX_VERSION, 0, 0, false,                                    STR_NULL,         NULL),
 
	 SDT_CONDVAR(Settings, pf.yapf.max_search_nodes,                       SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 10000,                   500, 1000000, 0, STR_NULL,         NULL),
 
	SDT_CONDBOOL(Settings, pf.yapf.rail_firstred_twoway_eol,                         28, SL_MAX_VERSION, 0, 0,  true,                                    STR_NULL,         NULL),
 
	 SDT_CONDVAR(Settings, pf.yapf.rail_firstred_penalty,                  SLE_UINT, 28, SL_MAX_VERSION, 0, 0,    10 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(Settings, pf.yapf.rail_firstred_exit_penalty,             SLE_UINT, 28, SL_MAX_VERSION, 0, 0,   100 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(Settings, pf.yapf.rail_lastred_penalty,                   SLE_UINT, 28, SL_MAX_VERSION, 0, 0,    10 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(Settings, pf.yapf.rail_lastred_exit_penalty,              SLE_UINT, 28, SL_MAX_VERSION, 0, 0,   100 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(Settings, pf.yapf.rail_station_penalty,                   SLE_UINT, 28, SL_MAX_VERSION, 0, 0,    30 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(Settings, pf.yapf.rail_slope_penalty,                     SLE_UINT, 28, SL_MAX_VERSION, 0, 0,     2 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(Settings, pf.yapf.rail_curve45_penalty,                   SLE_UINT, 28, SL_MAX_VERSION, 0, 0,     1 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(Settings, pf.yapf.rail_curve90_penalty,                   SLE_UINT, 28, SL_MAX_VERSION, 0, 0,     6 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(Settings, pf.yapf.rail_depot_reverse_penalty,             SLE_UINT, 28, SL_MAX_VERSION, 0, 0,    50 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(Settings, pf.yapf.rail_crossing_penalty,                  SLE_UINT, 28, SL_MAX_VERSION, 0, 0,     3 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(Settings, pf.yapf.rail_look_ahead_max_signals,            SLE_UINT, 28, SL_MAX_VERSION, 0, 0,    10,                     1,     100, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(Settings, pf.yapf.rail_look_ahead_signal_p0,               SLE_INT, 28, SL_MAX_VERSION, 0, 0,   500,              -1000000, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(Settings, pf.yapf.rail_look_ahead_signal_p1,               SLE_INT, 28, SL_MAX_VERSION, 0, 0,  -100,              -1000000, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(Settings, pf.yapf.rail_look_ahead_signal_p2,               SLE_INT, 28, SL_MAX_VERSION, 0, 0,     5,              -1000000, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(Settings, pf.yapf.rail_longer_platform_penalty,           SLE_UINT, 33, SL_MAX_VERSION, 0, 0,     8 * YAPF_TILE_LENGTH,  0,   20000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(Settings, pf.yapf.rail_longer_platform_per_tile_penalty,  SLE_UINT, 33, SL_MAX_VERSION, 0, 0,     0 * YAPF_TILE_LENGTH,  0,   20000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(Settings, pf.yapf.rail_shorter_platform_penalty,          SLE_UINT, 33, SL_MAX_VERSION, 0, 0,    40 * YAPF_TILE_LENGTH,  0,   20000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(Settings, pf.yapf.rail_shorter_platform_per_tile_penalty, SLE_UINT, 33, SL_MAX_VERSION, 0, 0,     0 * YAPF_TILE_LENGTH,  0,   20000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(Settings, pf.yapf.road_slope_penalty,                     SLE_UINT, 33, SL_MAX_VERSION, 0, 0,     2 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(Settings, pf.yapf.road_curve_penalty,                     SLE_UINT, 33, SL_MAX_VERSION, 0, 0,     1 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(Settings, pf.yapf.road_crossing_penalty,                  SLE_UINT, 33, SL_MAX_VERSION, 0, 0,     3 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(Settings, pf.yapf.road_stop_penalty,                      SLE_UINT, 47, SL_MAX_VERSION, 0, 0,     8 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	SDT_CONDBOOL(GameSettings, pf.yapf.disable_node_optimization,                        28, SL_MAX_VERSION, 0, 0, false,                                    STR_NULL,         NULL),
 
	 SDT_CONDVAR(GameSettings, pf.yapf.max_search_nodes,                       SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 10000,                   500, 1000000, 0, STR_NULL,         NULL),
 
	SDT_CONDBOOL(GameSettings, pf.yapf.rail_firstred_twoway_eol,                         28, SL_MAX_VERSION, 0, 0,  true,                                    STR_NULL,         NULL),
 
	 SDT_CONDVAR(GameSettings, pf.yapf.rail_firstred_penalty,                  SLE_UINT, 28, SL_MAX_VERSION, 0, 0,    10 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(GameSettings, pf.yapf.rail_firstred_exit_penalty,             SLE_UINT, 28, SL_MAX_VERSION, 0, 0,   100 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(GameSettings, pf.yapf.rail_lastred_penalty,                   SLE_UINT, 28, SL_MAX_VERSION, 0, 0,    10 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(GameSettings, pf.yapf.rail_lastred_exit_penalty,              SLE_UINT, 28, SL_MAX_VERSION, 0, 0,   100 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(GameSettings, pf.yapf.rail_station_penalty,                   SLE_UINT, 28, SL_MAX_VERSION, 0, 0,    30 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(GameSettings, pf.yapf.rail_slope_penalty,                     SLE_UINT, 28, SL_MAX_VERSION, 0, 0,     2 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(GameSettings, pf.yapf.rail_curve45_penalty,                   SLE_UINT, 28, SL_MAX_VERSION, 0, 0,     1 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(GameSettings, pf.yapf.rail_curve90_penalty,                   SLE_UINT, 28, SL_MAX_VERSION, 0, 0,     6 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(GameSettings, pf.yapf.rail_depot_reverse_penalty,             SLE_UINT, 28, SL_MAX_VERSION, 0, 0,    50 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(GameSettings, pf.yapf.rail_crossing_penalty,                  SLE_UINT, 28, SL_MAX_VERSION, 0, 0,     3 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(GameSettings, pf.yapf.rail_look_ahead_max_signals,            SLE_UINT, 28, SL_MAX_VERSION, 0, 0,    10,                     1,     100, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(GameSettings, pf.yapf.rail_look_ahead_signal_p0,               SLE_INT, 28, SL_MAX_VERSION, 0, 0,   500,              -1000000, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(GameSettings, pf.yapf.rail_look_ahead_signal_p1,               SLE_INT, 28, SL_MAX_VERSION, 0, 0,  -100,              -1000000, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(GameSettings, pf.yapf.rail_look_ahead_signal_p2,               SLE_INT, 28, SL_MAX_VERSION, 0, 0,     5,              -1000000, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(GameSettings, pf.yapf.rail_longer_platform_penalty,           SLE_UINT, 33, SL_MAX_VERSION, 0, 0,     8 * YAPF_TILE_LENGTH,  0,   20000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(GameSettings, pf.yapf.rail_longer_platform_per_tile_penalty,  SLE_UINT, 33, SL_MAX_VERSION, 0, 0,     0 * YAPF_TILE_LENGTH,  0,   20000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(GameSettings, pf.yapf.rail_shorter_platform_penalty,          SLE_UINT, 33, SL_MAX_VERSION, 0, 0,    40 * YAPF_TILE_LENGTH,  0,   20000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(GameSettings, pf.yapf.rail_shorter_platform_per_tile_penalty, SLE_UINT, 33, SL_MAX_VERSION, 0, 0,     0 * YAPF_TILE_LENGTH,  0,   20000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(GameSettings, pf.yapf.road_slope_penalty,                     SLE_UINT, 33, SL_MAX_VERSION, 0, 0,     2 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(GameSettings, pf.yapf.road_curve_penalty,                     SLE_UINT, 33, SL_MAX_VERSION, 0, 0,     1 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(GameSettings, pf.yapf.road_crossing_penalty,                  SLE_UINT, 33, SL_MAX_VERSION, 0, 0,     3 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
	 SDT_CONDVAR(GameSettings, pf.yapf.road_stop_penalty,                      SLE_UINT, 47, SL_MAX_VERSION, 0, 0,     8 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 

	
 
	 SDT_CONDVAR(Settings, game_creation.land_generator,                  SLE_UINT8, 30, SL_MAX_VERSION, 0,MS,     1,                     0,       1, 0, STR_CONFIG_PATCHES_LAND_GENERATOR,        NULL),
 
	 SDT_CONDVAR(Settings, game_creation.oil_refinery_limit,              SLE_UINT8, 30, SL_MAX_VERSION, 0, 0,    32,                    12,      48, 0, STR_CONFIG_PATCHES_OIL_REF_EDGE_DISTANCE, NULL),
 
	 SDT_CONDVAR(Settings, game_creation.tgen_smoothness,                 SLE_UINT8, 30, SL_MAX_VERSION, 0,MS,     1,                     0,       3, 0, STR_CONFIG_PATCHES_ROUGHNESS_OF_TERRAIN,  NULL),
 
	 SDT_CONDVAR(Settings, game_creation.generation_seed,                SLE_UINT32, 30, SL_MAX_VERSION, 0, 0,      GENERATE_NEW_SEED, 0, UINT32_MAX, 0, STR_NULL,                                 NULL),
 
	 SDT_CONDVAR(Settings, game_creation.tree_placer,                     SLE_UINT8, 30, SL_MAX_VERSION, 0,MS,     2,                     0,       2, 0, STR_CONFIG_PATCHES_TREE_PLACER,           NULL),
 
	     SDT_VAR(Settings, game_creation.heightmap_rotation,              SLE_UINT8,                     S,MS,     0,                     0,       1, 0, STR_CONFIG_PATCHES_HEIGHTMAP_ROTATION,    NULL),
 
	     SDT_VAR(Settings, game_creation.se_flat_world_height,            SLE_UINT8,                     S, 0,     0,                     0,      15, 0, STR_CONFIG_PATCHES_SE_FLAT_WORLD_HEIGHT,  NULL),
 
	 SDT_CONDVAR(GameSettings, game_creation.land_generator,                  SLE_UINT8, 30, SL_MAX_VERSION, 0,MS,     1,                     0,       1, 0, STR_CONFIG_PATCHES_LAND_GENERATOR,        NULL),
 
	 SDT_CONDVAR(GameSettings, game_creation.oil_refinery_limit,              SLE_UINT8, 30, SL_MAX_VERSION, 0, 0,    32,                    12,      48, 0, STR_CONFIG_PATCHES_OIL_REF_EDGE_DISTANCE, NULL),
 
	 SDT_CONDVAR(GameSettings, game_creation.tgen_smoothness,                 SLE_UINT8, 30, SL_MAX_VERSION, 0,MS,     1,                     0,       3, 0, STR_CONFIG_PATCHES_ROUGHNESS_OF_TERRAIN,  NULL),
 
	 SDT_CONDVAR(GameSettings, game_creation.generation_seed,                SLE_UINT32, 30, SL_MAX_VERSION, 0, 0,      GENERATE_NEW_SEED, 0, UINT32_MAX, 0, STR_NULL,                                 NULL),
 
	 SDT_CONDVAR(GameSettings, game_creation.tree_placer,                     SLE_UINT8, 30, SL_MAX_VERSION, 0,MS,     2,                     0,       2, 0, STR_CONFIG_PATCHES_TREE_PLACER,           NULL),
 
	     SDT_VAR(GameSettings, game_creation.heightmap_rotation,              SLE_UINT8,                     S,MS,     0,                     0,       1, 0, STR_CONFIG_PATCHES_HEIGHTMAP_ROTATION,    NULL),
 
	     SDT_VAR(GameSettings, game_creation.se_flat_world_height,            SLE_UINT8,                     S, 0,     0,                     0,      15, 0, STR_CONFIG_PATCHES_SE_FLAT_WORLD_HEIGHT,  NULL),
 

	
 
 SDT_CONDOMANY(Settings, gui.currency,                                  SLE_UINT8, 97, SL_MAX_VERSION, N, 0, 0, CUSTOM_CURRENCY_ID, "GBP|USD|EUR|YEN|ATS|BEF|CHF|CZK|DEM|DKK|ESP|FIM|FRF|GRD|HUF|ISK|ITL|NLG|NOK|PLN|ROL|RUR|SIT|SEK|YTL|SKK|BRR|custom", STR_NULL, NULL, NULL),
 
 SDT_CONDOMANY(Settings, gui.units,                                     SLE_UINT8, 97, SL_MAX_VERSION, N, 0, 1, 2, "imperial|metric|si", STR_NULL, NULL, NULL),
 
	     SDT_VAR(GameSettings, game_creation.map_x,                           SLE_UINT8,                     S, 0,     8,                     6,      11, 0, STR_CONFIG_PATCHES_MAP_X,                 NULL),
 
	     SDT_VAR(GameSettings, game_creation.map_y,                           SLE_UINT8,                     S, 0,     8,                     6,      11, 0, STR_CONFIG_PATCHES_MAP_Y,                 NULL),
 

	
 
SDTC_CONDOMANY(              gui.currency,                                  SLE_UINT8, 97, SL_MAX_VERSION, N, 0, 0, CUSTOM_CURRENCY_ID, "GBP|USD|EUR|YEN|ATS|BEF|CHF|CZK|DEM|DKK|ESP|FIM|FRF|GRD|HUF|ISK|ITL|NLG|NOK|PLN|ROL|RUR|SIT|SEK|YTL|SKK|BRR|custom", STR_NULL, NULL),
 
SDTC_CONDOMANY(              gui.units,                                     SLE_UINT8, 97, SL_MAX_VERSION, N, 0, 1, 2, "imperial|metric|si", STR_NULL, NULL),
 

	
 
	/***************************************************************************/
 
	/* Unsaved patch variables. */
 
 SDT_OMANY(Settings, gui.autosave,               SLE_UINT8, S, 0, 1, 4, "off|monthly|quarterly|half year|yearly", STR_NULL, NULL,               NULL),
 
	SDT_BOOL(Settings, gui.vehicle_speed,                     S, 0,  true,                        STR_CONFIG_PATCHES_VEHICLESPEED,                NULL),
 
	SDT_BOOL(Settings, gui.status_long_date,                  S, 0,  true,                        STR_CONFIG_PATCHES_LONGDATE,                    NULL),
 
	SDT_BOOL(Settings, gui.show_finances,                     S, 0,  true,                        STR_CONFIG_PATCHES_SHOWFINANCES,                NULL),
 
	SDT_BOOL(Settings, gui.autoscroll,                        S, 0, false,                        STR_CONFIG_PATCHES_AUTOSCROLL,                  NULL),
 
	SDT_BOOL(Settings, gui.reverse_scroll,                    S, 0, false,                        STR_CONFIG_PATCHES_REVERSE_SCROLLING,           NULL),
 
	SDT_BOOL(Settings, gui.smooth_scroll,                     S, 0, false,                        STR_CONFIG_PATCHES_SMOOTH_SCROLLING,            NULL),
 
	SDT_BOOL(Settings, gui.measure_tooltip,                   S, 0, false,                        STR_CONFIG_PATCHES_MEASURE_TOOLTIP,             NULL),
 
	 SDT_VAR(Settings, gui.errmsg_duration,        SLE_UINT8, S, 0,     5,        0,       20, 0, STR_CONFIG_PATCHES_ERRMSG_DURATION,             NULL),
 
	 SDT_VAR(Settings, gui.toolbar_pos,            SLE_UINT8, S,MS,     0,        0,        2, 0, STR_CONFIG_PATCHES_TOOLBAR_POS,                 v_PositionMainToolbar),
 
	 SDT_VAR(Settings, gui.window_snap_radius,     SLE_UINT8, S,D0,    10,        1,       32, 0, STR_CONFIG_PATCHES_SNAP_RADIUS,                 NULL),
 
	SDT_BOOL(Settings, gui.population_in_label,               S, 0,  true,                        STR_CONFIG_PATCHES_POPULATION_IN_LABEL,         PopulationInLabelActive),
 
	SDT_BOOL(Settings, gui.link_terraform_toolbar,            S, 0, false,                        STR_CONFIG_PATCHES_LINK_TERRAFORM_TOOLBAR,      NULL),
 
	 SDT_VAR(Settings, gui.liveries,               SLE_UINT8, S,MS,     2,        0,        2, 0, STR_CONFIG_PATCHES_LIVERIES,                    RedrawScreen),
 
	SDT_BOOL(Settings, gui.prefer_teamchat,                   S, 0, false,                        STR_CONFIG_PATCHES_PREFER_TEAMCHAT,             NULL),
 
	 SDT_VAR(Settings, gui.scrollwheel_scrolling,  SLE_UINT8, S,MS,     0,        0,        2, 0, STR_CONFIG_PATCHES_SCROLLWHEEL_SCROLLING,       NULL),
 
	 SDT_VAR(Settings, gui.scrollwheel_multiplier, SLE_UINT8, S, 0,     5,        1,       15, 1, STR_CONFIG_PATCHES_SCROLLWHEEL_MULTIPLIER,      NULL),
 
	SDT_BOOL(Settings, gui.pause_on_newgame,                  S, 0, false,                        STR_CONFIG_PATCHES_PAUSE_ON_NEW_GAME,           NULL),
 
	 SDT_VAR(Settings, gui.advanced_vehicle_list,  SLE_UINT8, S,MS,     1,        0,        2, 0, STR_CONFIG_PATCHES_ADVANCED_VEHICLE_LISTS,      NULL),
 
	SDT_BOOL(Settings, gui.timetable_in_ticks,                S, 0, false,                        STR_CONFIG_PATCHES_TIMETABLE_IN_TICKS,          NULL),
 
	 SDT_VAR(Settings, gui.loading_indicators,     SLE_UINT8, S,MS,     1,        0,        2, 0, STR_CONFIG_PATCHES_LOADING_INDICATORS,          RedrawScreen),
 
	 SDT_VAR(Settings, gui.default_rail_type,      SLE_UINT8, S,MS,     4,        0,        6, 0, STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE,           NULL),
 
	SDT_BOOL(Settings, gui.enable_signal_gui,                 S, 0, false,                        STR_CONFIG_PATCHES_ENABLE_SIGNAL_GUI,           CloseSignalGUI),
 
	 SDT_VAR(Settings, gui.drag_signals_density,   SLE_UINT8, S, 0,     4,        1,       20, 0, STR_CONFIG_PATCHES_DRAG_SIGNALS_DENSITY,        DragSignalsDensityChanged),
 
	 SDT_VAR(Settings, gui.semaphore_build_before, SLE_INT32, S, NC, 1975, MIN_YEAR, MAX_YEAR, 1, STR_CONFIG_PATCHES_SEMAPHORE_BUILD_BEFORE_DATE, ResetSignalVariant),
 
	SDT_BOOL(Settings, gui.train_income_warn,                 S, 0,  true,                        STR_CONFIG_PATCHES_WARN_INCOME_LESS,            NULL),
 
	 SDT_VAR(Settings, gui.order_review_system,    SLE_UINT8, S,MS,     2,        0,        2, 0, STR_CONFIG_PATCHES_ORDER_REVIEW,                NULL),
 
	SDT_BOOL(Settings, gui.lost_train_warn,                   S, 0,  true,                        STR_CONFIG_PATCHES_WARN_LOST_TRAIN,             NULL),
 
	SDT_BOOL(Settings, gui.autorenew,                         S, 0, false,                        STR_CONFIG_PATCHES_AUTORENEW_VEHICLE,           EngineRenewUpdate),
 
	 SDT_VAR(Settings, gui.autorenew_months,       SLE_INT16, S, 0,     6,      -12,       12, 0, STR_CONFIG_PATCHES_AUTORENEW_MONTHS,            EngineRenewMonthsUpdate),
 
	 SDT_VAR(Settings, gui.autorenew_money,         SLE_UINT, S,CR,100000,        0,  2000000, 0, STR_CONFIG_PATCHES_AUTORENEW_MONEY,             EngineRenewMoneyUpdate),
 
	SDT_BOOL(Settings, gui.always_build_infrastructure,       S, 0, false,                        STR_CONFIG_PATCHES_ALWAYS_BUILD_INFRASTRUCTURE, RedrawScreen),
 
	SDT_BOOL(Settings, gui.new_nonstop,                       S, 0, false,                        STR_CONFIG_PATCHES_NEW_NONSTOP,                 NULL),
 
	SDT_BOOL(Settings, gui.keep_all_autosave,                 S, 0, false,                        STR_NULL,                                       NULL),
 
	SDT_BOOL(Settings, gui.autosave_on_exit,                  S, 0, false,                        STR_NULL,                                       NULL),
 
	 SDT_VAR(Settings, gui.max_num_autosaves,      SLE_UINT8, S, 0,    16,        0,      255, 0, STR_NULL,                                       NULL),
 
	SDT_BOOL(Settings, gui.bridge_pillars,                    S, 0,  true,                        STR_NULL,                                       NULL),
 
	SDT_BOOL(Settings, gui.auto_euro,                         S, 0,  true,                        STR_NULL,                                       NULL),
 
	 SDT_VAR(Settings, gui.news_message_timeout,   SLE_UINT8, S, 0,     2,        1,      255, 0, STR_NULL,                                       NULL),
 

	
 
	 SDT_VAR(Settings, game_creation.map_x,        SLE_UINT8, S, 0,     8,        6,       11, 0, STR_CONFIG_PATCHES_MAP_X,                       NULL),
 
	 SDT_VAR(Settings, game_creation.map_y,        SLE_UINT8, S, 0,     8,        6,       11, 0, STR_CONFIG_PATCHES_MAP_Y,                       NULL),
 
	SDTC_OMANY(gui.autosave,               SLE_UINT8, S, 0, 1, 4, "off|monthly|quarterly|half year|yearly", STR_NULL,                     NULL),
 
	 SDTC_BOOL(gui.vehicle_speed,                     S, 0,  true,                        STR_CONFIG_PATCHES_VEHICLESPEED,                NULL),
 
	 SDTC_BOOL(gui.status_long_date,                  S, 0,  true,                        STR_CONFIG_PATCHES_LONGDATE,                    NULL),
 
	 SDTC_BOOL(gui.show_finances,                     S, 0,  true,                        STR_CONFIG_PATCHES_SHOWFINANCES,                NULL),
 
	 SDTC_BOOL(gui.autoscroll,                        S, 0, false,                        STR_CONFIG_PATCHES_AUTOSCROLL,                  NULL),
 
	 SDTC_BOOL(gui.reverse_scroll,                    S, 0, false,                        STR_CONFIG_PATCHES_REVERSE_SCROLLING,           NULL),
 
	 SDTC_BOOL(gui.smooth_scroll,                     S, 0, false,                        STR_CONFIG_PATCHES_SMOOTH_SCROLLING,            NULL),
 
	 SDTC_BOOL(gui.measure_tooltip,                   S, 0, false,                        STR_CONFIG_PATCHES_MEASURE_TOOLTIP,             NULL),
 
	  SDTC_VAR(gui.errmsg_duration,        SLE_UINT8, S, 0,     5,        0,       20, 0, STR_CONFIG_PATCHES_ERRMSG_DURATION,             NULL),
 
	  SDTC_VAR(gui.toolbar_pos,            SLE_UINT8, S,MS,     0,        0,        2, 0, STR_CONFIG_PATCHES_TOOLBAR_POS,                 v_PositionMainToolbar),
 
	  SDTC_VAR(gui.window_snap_radius,     SLE_UINT8, S,D0,    10,        1,       32, 0, STR_CONFIG_PATCHES_SNAP_RADIUS,                 NULL),
 
	 SDTC_BOOL(gui.population_in_label,               S, 0,  true,                        STR_CONFIG_PATCHES_POPULATION_IN_LABEL,         PopulationInLabelActive),
 
	 SDTC_BOOL(gui.link_terraform_toolbar,            S, 0, false,                        STR_CONFIG_PATCHES_LINK_TERRAFORM_TOOLBAR,      NULL),
 
	  SDTC_VAR(gui.liveries,               SLE_UINT8, S,MS,     2,        0,        2, 0, STR_CONFIG_PATCHES_LIVERIES,                    RedrawScreen),
 
	 SDTC_BOOL(gui.prefer_teamchat,                   S, 0, false,                        STR_CONFIG_PATCHES_PREFER_TEAMCHAT,             NULL),
 
	  SDTC_VAR(gui.scrollwheel_scrolling,  SLE_UINT8, S,MS,     0,        0,        2, 0, STR_CONFIG_PATCHES_SCROLLWHEEL_SCROLLING,       NULL),
 
	  SDTC_VAR(gui.scrollwheel_multiplier, SLE_UINT8, S, 0,     5,        1,       15, 1, STR_CONFIG_PATCHES_SCROLLWHEEL_MULTIPLIER,      NULL),
 
	 SDTC_BOOL(gui.pause_on_newgame,                  S, 0, false,                        STR_CONFIG_PATCHES_PAUSE_ON_NEW_GAME,           NULL),
 
	  SDTC_VAR(gui.advanced_vehicle_list,  SLE_UINT8, S,MS,     1,        0,        2, 0, STR_CONFIG_PATCHES_ADVANCED_VEHICLE_LISTS,      NULL),
 
	 SDTC_BOOL(gui.timetable_in_ticks,                S, 0, false,                        STR_CONFIG_PATCHES_TIMETABLE_IN_TICKS,          NULL),
 
	  SDTC_VAR(gui.loading_indicators,     SLE_UINT8, S,MS,     1,        0,        2, 0, STR_CONFIG_PATCHES_LOADING_INDICATORS,          RedrawScreen),
 
	  SDTC_VAR(gui.default_rail_type,      SLE_UINT8, S,MS,     4,        0,        6, 0, STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE,           NULL),
 
	 SDTC_BOOL(gui.enable_signal_gui,                 S, 0, false,                        STR_CONFIG_PATCHES_ENABLE_SIGNAL_GUI,           CloseSignalGUI),
 
	  SDTC_VAR(gui.drag_signals_density,   SLE_UINT8, S, 0,     4,        1,       20, 0, STR_CONFIG_PATCHES_DRAG_SIGNALS_DENSITY,        DragSignalsDensityChanged),
 
	  SDTC_VAR(gui.semaphore_build_before, SLE_INT32, S, NC, 1975, MIN_YEAR, MAX_YEAR, 1, STR_CONFIG_PATCHES_SEMAPHORE_BUILD_BEFORE_DATE, ResetSignalVariant),
 
	 SDTC_BOOL(gui.train_income_warn,                 S, 0,  true,                        STR_CONFIG_PATCHES_WARN_INCOME_LESS,            NULL),
 
	  SDTC_VAR(gui.order_review_system,    SLE_UINT8, S,MS,     2,        0,        2, 0, STR_CONFIG_PATCHES_ORDER_REVIEW,                NULL),
 
	 SDTC_BOOL(gui.lost_train_warn,                   S, 0,  true,                        STR_CONFIG_PATCHES_WARN_LOST_TRAIN,             NULL),
 
	 SDTC_BOOL(gui.autorenew,                         S, 0, false,                        STR_CONFIG_PATCHES_AUTORENEW_VEHICLE,           EngineRenewUpdate),
 
	  SDTC_VAR(gui.autorenew_months,       SLE_INT16, S, 0,     6,      -12,       12, 0, STR_CONFIG_PATCHES_AUTORENEW_MONTHS,            EngineRenewMonthsUpdate),
 
	  SDTC_VAR(gui.autorenew_money,         SLE_UINT, S,CR,100000,        0,  2000000, 0, STR_CONFIG_PATCHES_AUTORENEW_MONEY,             EngineRenewMoneyUpdate),
 
	 SDTC_BOOL(gui.always_build_infrastructure,       S, 0, false,                        STR_CONFIG_PATCHES_ALWAYS_BUILD_INFRASTRUCTURE, RedrawScreen),
 
	 SDTC_BOOL(gui.new_nonstop,                       S, 0, false,                        STR_CONFIG_PATCHES_NEW_NONSTOP,                 NULL),
 
	 SDTC_BOOL(gui.keep_all_autosave,                 S, 0, false,                        STR_NULL,                                       NULL),
 
	 SDTC_BOOL(gui.autosave_on_exit,                  S, 0, false,                        STR_NULL,                                       NULL),
 
	  SDTC_VAR(gui.max_num_autosaves,      SLE_UINT8, S, 0,    16,        0,      255, 0, STR_NULL,                                       NULL),
 
	 SDTC_BOOL(gui.bridge_pillars,                    S, 0,  true,                        STR_NULL,                                       NULL),
 
	 SDTC_BOOL(gui.auto_euro,                         S, 0,  true,                        STR_NULL,                                       NULL),
 
	  SDTC_VAR(gui.news_message_timeout,   SLE_UINT8, S, 0,     2,        1,      255, 0, STR_NULL,                                       NULL),
 

	
 
	/*
 
	 * Since the network code (CmdChangePatchSetting and friends) use the index in this array to decide
 
@@ -1768,7 +1795,7 @@ const SettingDesc _patch_settings[] = {
 

	
 
#ifdef __APPLE__
 
	/* We might need to emulate a right mouse button on mac */
 
	     SDT_VAR(Settings, gui.right_mouse_btn_emulation, SLE_UINT8, S, MS, 0, 0, 2, 0, STR_CONFIG_PATCHES_RIGHT_MOUSE_BTN_EMU, NULL),
 
	 SDTC_VAR(gui.right_mouse_btn_emulation, SLE_UINT8, S, MS, 0, 0, 2, 0, STR_CONFIG_PATCHES_RIGHT_MOUSE_BTN_EMU, NULL),
 
#endif
 

	
 
	SDT_END()
 
@@ -1824,7 +1851,7 @@ static void HandleOldDiffCustom(bool sav
 

	
 
	for (uint i = 0; i < options_to_load; i++) {
 
		const SettingDesc *sd = &_patch_settings[i];
 
		void *var = GetVariableAddress(savegame ? &_settings : &_settings_newgame, &sd->save);
 
		void *var = GetVariableAddress(savegame ? &_settings_game : &_settings_newgame, &sd->save);
 
		Write_ValidateSetting(var, sd, (int32)((i == 4 ? 1000 : 1) * _old_diff_custom[i]));
 
	}
 
}
 
@@ -2068,7 +2095,7 @@ CommandCost CmdChangePatchSetting(TileIn
 
	if ((sd->desc.flags & SGF_NEWGAME_ONLY) && _game_mode != GM_MENU) return CMD_ERROR;
 

	
 
	if (flags & DC_EXEC) {
 
		Settings *s = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings;
 
		GameSettings *s = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game;
 
		void *var = GetVariableAddress(s, &sd->save);
 
		Write_ValidateSetting(var, sd, (int32)p2);
 
		if (sd->desc.proc != NULL) sd->desc.proc((int32)ReadValue(var, sd->save.conv));
 
@@ -2086,7 +2113,7 @@ CommandCost CmdChangePatchSetting(TileIn
 
 * This only affects patch-members that are not needed to be the same on all
 
 * clients in a network game.
 
 * @param value new value of the patch */
 
bool SetPatchValue(uint index, const Settings *object, int32 value)
 
bool SetPatchValue(uint index, int32 value)
 
{
 
	const SettingDesc *sd = &_patch_settings[index];
 
	/* If an item is player-based, we do not send it over the network
 
@@ -2094,7 +2121,7 @@ bool SetPatchValue(uint index, const Set
 
	 * of patches because changing a player-based setting in a game also
 
	 * changes its defaults. At least that is the convention we have chosen */
 
	if (sd->save.conv & SLF_NETWORK_NO) {
 
		void *var = GetVariableAddress(object, &sd->save);
 
		void *var = GetVariableAddress((_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game, &sd->save);
 
		Write_ValidateSetting(var, sd, value);
 

	
 
		if (_game_mode != GM_MENU) {
 
@@ -2150,10 +2177,10 @@ bool IConsoleSetPatchSetting(const char 
 
		return true;
 
	}
 

	
 
	Settings *s = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings;
 
	GameSettings *s = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game;
 
	ptr = GetVariableAddress(s, &sd->save);
 

	
 
	success = SetPatchValue(index, s, value);
 
	success = SetPatchValue(index, value);
 
	return success;
 
}
 

	
 
@@ -2169,7 +2196,7 @@ void IConsoleGetPatchSetting(const char 
 
		return;
 
	}
 

	
 
	ptr = GetVariableAddress((_game_mode == GM_MENU) ? &_settings_newgame : &_settings, &sd->save);
 
	ptr = GetVariableAddress((_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game, &sd->save);
 

	
 
	if (sd->desc.cmd == SDT_BOOLX) {
 
		snprintf(value, sizeof(value), (*(bool*)ptr == 1) ? "on" : "off");
 
@@ -2187,7 +2214,7 @@ void IConsoleListPatches()
 

	
 
	for (const SettingDesc *sd = _patch_settings; sd->save.cmd != SL_END; sd++) {
 
		char value[80];
 
		const void *ptr = GetVariableAddress((_game_mode == GM_MENU) ? &_settings_newgame : &_settings, &sd->save);
 
		const void *ptr = GetVariableAddress((_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game, &sd->save);
 

	
 
		if (sd->desc.cmd == SDT_BOOLX) {
 
			snprintf(value, lengthof(value), (*(bool*)ptr == 1) ? "on" : "off");
 
@@ -2208,7 +2235,7 @@ static void LoadSettings(const SettingDe
 
{
 
	for (; osd->save.cmd != SL_END; osd++) {
 
		const SaveLoad *sld = &osd->save;
 
		void *ptr = GetVariableAddress(sld->global ? NULL : object, sld);
 
		void *ptr = GetVariableAddress(object, sld);
 

	
 
		if (!SlObjectMember(ptr, sld)) continue;
 
	}
 
@@ -2259,7 +2286,7 @@ static void Load_OPTS()
 
	 * a networking environment. This ensures for example that the local
 
	 * autosave-frequency stays when joining a network-server */
 
	PrepareOldDiffCustom();
 
	LoadSettings(_gameopt_settings, &_settings);
 
	LoadSettings(_gameopt_settings, &_settings_game);
 
	HandleOldDiffCustom(true);
 
}
 

	
 
@@ -2268,12 +2295,12 @@ static void Load_PATS()
 
	/* Copy over default setting since some might not get loaded in
 
	 * a networking environment. This ensures for example that the local
 
	 * signal_side stays when joining a network-server */
 
	LoadSettings(_patch_settings, &_settings);
 
	LoadSettings(_patch_settings, &_settings_game);
 
}
 

	
 
static void Save_PATS()
 
{
 
	SaveSettings(_patch_settings, &_settings);
 
	SaveSettings(_patch_settings, &_settings_game);
 
}
 

	
 
void CheckConfig()
src/settings_gui.cpp
Show inline comments
 
@@ -142,11 +142,11 @@ static void ShowTownnameDropdown(Window 
 
static void ShowCustCurrency();
 

	
 
struct GameOptionsWindow : Window {
 
	Settings *opt;
 
	GameSettings *opt;
 

	
 
	GameOptionsWindow(const WindowDesc *desc) : Window(desc)
 
	{
 
		this->opt = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings;
 
		this->opt = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game;
 
		this->FindWindowPlacementAndResize(desc);
 
	}
 

	
 
@@ -162,11 +162,11 @@ struct GameOptionsWindow : Window {
 
		this->SetWidgetDisabledState(GAMEOPT_VEHICLENAME_SAVE, !(_vehicle_design_names & 1));
 
		if (!this->IsWidgetDisabled(GAMEOPT_VEHICLENAME_SAVE)) str = STR_02BF_CUSTOM;
 
		SetDParam(0, str);
 
		SetDParam(1, _currency_specs[this->opt->gui.currency].name);
 
		SetDParam(2, STR_UNITS_IMPERIAL + this->opt->gui.units);
 
		SetDParam(1, _currency_specs[_settings_client.gui.currency].name);
 
		SetDParam(2, STR_UNITS_IMPERIAL + _settings_client.gui.units);
 
		SetDParam(3, STR_02E9_DRIVE_ON_LEFT + this->opt->vehicle.road_side);
 
		SetDParam(4, TownName(this->opt->game_creation.town_name));
 
		SetDParam(5, _autosave_dropdown[this->opt->gui.autosave]);
 
		SetDParam(5, _autosave_dropdown[_settings_client.gui.autosave]);
 
		SetDParam(6, SPECSTR_LANGUAGE_START + _dynlang.curr);
 
		int i = GetCurRes();
 
		SetDParam(7, i == _num_resolutions ? STR_RES_OTHER : SPECSTR_RESOLUTION_START + i);
 
@@ -181,11 +181,11 @@ struct GameOptionsWindow : Window {
 
	{
 
		switch (widget) {
 
			case GAMEOPT_CURRENCY_BTN: // Setup currencies dropdown
 
				ShowDropDownMenu(this, BuildCurrencyDropdown(), this->opt->gui.currency, GAMEOPT_CURRENCY_BTN, _game_mode == GM_MENU ? 0 : ~GetMaskOfAllowedCurrencies(), 0);
 
				ShowDropDownMenu(this, BuildCurrencyDropdown(), _settings_client.gui.currency, GAMEOPT_CURRENCY_BTN, _game_mode == GM_MENU ? 0 : ~GetMaskOfAllowedCurrencies(), 0);
 
				break;
 

	
 
			case GAMEOPT_DISTANCE_BTN: // Setup distance unit dropdown
 
				ShowDropDownMenu(this, _units_dropdown, this->opt->gui.units, GAMEOPT_DISTANCE_BTN, 0, 0);
 
				ShowDropDownMenu(this, _units_dropdown, _settings_client.gui.units, GAMEOPT_DISTANCE_BTN, 0, 0);
 
				break;
 

	
 
			case GAMEOPT_ROADSIDE_BTN: { // Setup road-side dropdown
 
@@ -206,7 +206,7 @@ struct GameOptionsWindow : Window {
 
				break;
 

	
 
			case GAMEOPT_AUTOSAVE_BTN: // Setup autosave dropdown
 
				ShowDropDownMenu(this, _autosave_dropdown, this->opt->gui.autosave, GAMEOPT_AUTOSAVE_BTN, 0, 0);
 
				ShowDropDownMenu(this, _autosave_dropdown, _settings_client.gui.autosave, GAMEOPT_AUTOSAVE_BTN, 0, 0);
 
				break;
 

	
 
			case GAMEOPT_VEHICLENAME_BTN: // Setup customized vehicle-names dropdown
 
@@ -265,12 +265,12 @@ struct GameOptionsWindow : Window {
 

	
 
			case GAMEOPT_CURRENCY_BTN: /* Currency */
 
				if (index == CUSTOM_CURRENCY_ID) ShowCustCurrency();
 
				this->opt->gui.currency = index;
 
				_settings_client.gui.currency = index;
 
				MarkWholeScreenDirty();
 
				break;
 

	
 
			case GAMEOPT_DISTANCE_BTN: // Measuring units
 
				this->opt->gui.units = index;
 
				_settings_client.gui.units = index;
 
				MarkWholeScreenDirty();
 
				break;
 

	
 
@@ -289,7 +289,7 @@ struct GameOptionsWindow : Window {
 
				break;
 

	
 
			case GAMEOPT_AUTOSAVE_BTN: // Autosave options
 
				_settings.gui.autosave = _settings_newgame.gui.autosave = index;
 
				_settings_client.gui.autosave = index;
 
				this->SetDirty();
 
				break;
 

	
 
@@ -398,7 +398,7 @@ private:
 
	uint8 timeout;
 

	
 
	/* Temporary holding place of values in the difficulty window until 'Save' is clicked */
 
	Settings opt_mod_temp;
 
	GameSettings opt_mod_temp;
 

	
 
	enum {
 
		GAMEDIFF_WND_TOP_OFFSET = 45,
 
@@ -427,7 +427,7 @@ public:
 
	{
 
		/* Copy current settings (ingame or in intro) to temporary holding place
 
		 * change that when setting stuff, copy back on clicking 'OK' */
 
		this->opt_mod_temp = (_game_mode == GM_MENU) ? _settings_newgame : _settings;
 
		this->opt_mod_temp = (_game_mode == GM_MENU) ? _settings_newgame : _settings_game;
 
		this->clicked_increase = false;
 
		this->clicked_button = NO_SETTINGS_BUTTON;
 
		this->timeout = 0;
 
@@ -537,7 +537,7 @@ public:
 
				break;
 

	
 
			case GDW_ACCEPT: { // Save button - save changes
 
				Settings *opt_ptr = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings;
 
				GameSettings *opt_ptr = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game;
 

	
 
				uint i;
 
				const SettingDesc *sd = GetPatchFromName("difficulty.max_no_competitors", &i);
 
@@ -738,7 +738,7 @@ enum PatchesSelectionWidgets {
 
};
 

	
 
struct PatchesSelectionWindow : Window {
 
	static Settings *patches_ptr;
 
	static GameSettings *patches_ptr;
 
	static int patches_max;
 

	
 
	int page;
 
@@ -749,7 +749,7 @@ struct PatchesSelectionWindow : Window {
 
	{
 
		static bool first_time = true;
 

	
 
		patches_ptr = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings;
 
		patches_ptr = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game;
 

	
 
		/* Build up the dynamic settings-array only once per OpenTTD session */
 
		if (first_time) {
 
@@ -762,6 +762,7 @@ struct PatchesSelectionWindow : Window {
 
				page->entries = MallocT<PatchEntry>(page->num);
 
				for (i = 0; i != page->num; i++) {
 
					uint index;
 
					printf("%s\n", page->names[i]);
 
					const SettingDesc *sd = GetPatchFromName(page->names[i], &index);
 
					assert(sd != NULL);
 

	
 
@@ -912,7 +913,7 @@ struct PatchesSelectionWindow : Window {
 
					}
 

	
 
					if (value != oldvalue) {
 
						SetPatchValue(page->entries[btn].index, patches_ptr, value);
 
						SetPatchValue(page->entries[btn].index, value);
 
						this->SetDirty();
 
					}
 
				} else {
 
@@ -955,13 +956,13 @@ struct PatchesSelectionWindow : Window {
 
			/* Save the correct currency-translated value */
 
			if (sd->desc.flags & SGF_CURRENCY) value /= _currency->rate;
 

	
 
			SetPatchValue(pe->index, patches_ptr, value);
 
			SetPatchValue(pe->index, value);
 
			this->SetDirty();
 
		}
 
	}
 
};
 

	
 
Settings *PatchesSelectionWindow::patches_ptr = NULL;
 
GameSettings *PatchesSelectionWindow::patches_ptr = NULL;
 
int PatchesSelectionWindow::patches_max = 0;
 

	
 
static const Widget _patches_selection_widgets[] = {
src/settings_internal.h
Show inline comments
 
@@ -84,6 +84,6 @@ enum IniGroupType {
 
};
 

	
 
const SettingDesc *GetPatchFromName(const char *name, uint *i);
 
bool SetPatchValue(uint index, const Settings *object, int32 value);
 
bool SetPatchValue(uint index, int32 value);
 

	
 
#endif /* SETTINGS_H */
src/settings_type.h
Show inline comments
 
@@ -265,10 +265,9 @@ struct StationSettings {
 
	byte   station_spread;                   ///< amount a station may spread
 
};
 

	
 
/** All settings together. */
 
struct Settings {
 
/** All settings together for the game. */
 
struct GameSettings {
 
	DifficultySettings   difficulty;         ///< settings related to the difficulty
 
	GUISettings          gui;                ///< settings related to the GUI
 
	GameCreationSettings game_creation;      ///< settings used during the creation of a game (map)
 
	ConstructionSettings construction;       ///< construction of things in-game
 
	AISettings           ai;                 ///< what may the AI do?
 
@@ -279,10 +278,18 @@ struct Settings {
 
	StationSettings      station;            ///< settings related to station management
 
};
 

	
 
/** The current settings. */
 
extern Settings _settings;
 
/** All settings that are only important for the local client. */
 
struct ClientSettings {
 
	GUISettings          gui;                ///< settings related to the GUI
 
};
 

	
 
/** The settings values that are used for new games and/or modified in config file */
 
extern Settings _settings_newgame;
 
/** The current settings for this game. */
 
extern ClientSettings _settings_client;
 

	
 
/** The current settings for this game. */
 
extern GameSettings _settings_game;
 

	
 
/** The settings values that are used for new games and/or modified in config file. */
 
extern GameSettings _settings_newgame;
 

	
 
#endif /* SETTINGS_TYPE_H */
src/ship_cmd.cpp
Show inline comments
 
@@ -106,7 +106,7 @@ SpriteID Ship::GetImage(Direction direct
 

	
 
static const Depot* FindClosestShipDepot(const Vehicle* v)
 
{
 
	if (_settings.pf.pathfinder_for_ships == VPF_NPF) { /* NPF is used */
 
	if (_settings_game.pf.pathfinder_for_ships == VPF_NPF) { /* NPF is used */
 
		Trackdir trackdir = GetVehicleTrackdir(v);
 
		NPFFoundTargetData ftd = NPFRouteToDepotTrialError(v->tile, trackdir, false, TRANSPORT_WATER, 0, v->owner, INVALID_RAILTYPES);
 

	
 
@@ -137,7 +137,7 @@ static const Depot* FindClosestShipDepot
 

	
 
static void CheckIfShipNeedsService(Vehicle *v)
 
{
 
	if (_settings.vehicle.servint_ships == 0 || !v->NeedsAutomaticServicing()) return;
 
	if (_settings_game.vehicle.servint_ships == 0 || !v->NeedsAutomaticServicing()) return;
 
	if (v->IsInDepot()) {
 
		VehicleServiceInDepot(v);
 
		return;
 
@@ -196,7 +196,7 @@ static void HandleBrokenShip(Vehicle *v)
 
		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
 

	
 
		if (!PlayVehicleSound(v, VSE_BREAKDOWN)) {
 
			SndPlayVehicleFx((_settings.game_creation.landscape != LT_TOYLAND) ?
 
			SndPlayVehicleFx((_settings_game.game_creation.landscape != LT_TOYLAND) ?
 
				SND_10_TRAIN_BREAKDOWN : SND_3A_COMEDY_BREAKDOWN_2, v);
 
		}
 

	
 
@@ -320,7 +320,7 @@ static bool ShipAccelerate(Vehicle *v)
 
	/*updates statusbar only if speed have changed to save CPU time */
 
	if (spd != v->cur_speed) {
 
		v->cur_speed = spd;
 
		if (_settings.gui.vehicle_speed)
 
		if (_settings_client.gui.vehicle_speed)
 
			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 
	}
 

	
 
@@ -459,7 +459,7 @@ static Track ChooseShipTrack(Vehicle *v,
 
{
 
	assert(IsValidDiagDirection(enterdir));
 

	
 
	switch (_settings.pf.pathfinder_for_ships) {
 
	switch (_settings_game.pf.pathfinder_for_ships) {
 
		case VPF_YAPF: { /* YAPF */
 
			Trackdir trackdir = YapfChooseShipTrack(v, tile, enterdir, tracks);
 
			if (trackdir != INVALID_TRACKDIR) return TrackdirToTrack(trackdir);
 
@@ -756,7 +756,7 @@ CommandCost CmdBuildShip(TileIndex tile,
 

	
 
	unit_num = HasBit(p2, 0) ? 0 : GetFreeUnitNumber(VEH_SHIP);
 

	
 
	if (!Vehicle::AllocateList(NULL, 1) || unit_num > _settings.vehicle.max_ships)
 
	if (!Vehicle::AllocateList(NULL, 1) || unit_num > _settings_game.vehicle.max_ships)
 
		return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
 

	
 
	if (flags & DC_EXEC) {
 
@@ -800,7 +800,7 @@ CommandCost CmdBuildShip(TileIndex tile,
 
		v->name = NULL;
 
		v->u.ship.state = TRACK_BIT_DEPOT;
 

	
 
		v->service_interval = _settings.vehicle.servint_ships;
 
		v->service_interval = _settings_game.vehicle.servint_ships;
 
		v->date_of_last_service = _date;
 
		v->build_year = _cur_year;
 
		v->cur_image = 0x0E5E;
src/smallmap_gui.cpp
Show inline comments
 
@@ -459,7 +459,7 @@ static inline uint32 GetSmallMapVegetati
 

	
 
		case MP_TREES:
 
			if (GetTreeGround(tile) == TREE_GROUND_SNOW_DESERT) {
 
				bits = (_settings.game_creation.landscape == LT_ARCTIC) ? MKCOLOR(0x98575798) : MKCOLOR(0xC25757C2);
 
				bits = (_settings_game.game_creation.landscape == LT_ARCTIC) ? MKCOLOR(0x98575798) : MKCOLOR(0xC25757C2);
 
			} else {
 
				bits = MKCOLOR(0x54575754);
 
			}
src/station.cpp
Show inline comments
 
@@ -285,7 +285,7 @@ bool StationRect::BeforeAddTile(TileInde
 
		/* check new rect dimensions against preset max */
 
		int w = new_rect.right - new_rect.left + 1;
 
		int h = new_rect.bottom - new_rect.top + 1;
 
		if (mode != ADD_FORCE && (w > _settings.station.station_spread || h > _settings.station.station_spread)) {
 
		if (mode != ADD_FORCE && (w > _settings_game.station.station_spread || h > _settings_game.station.station_spread)) {
 
			assert(mode != ADD_TRY);
 
			_error_message = STR_306C_STATION_TOO_SPREAD_OUT;
 
			return false;
src/station_cmd.cpp
Show inline comments
 
@@ -296,7 +296,7 @@ static StringID GenerateStationName(Stat
 
				CountMapSquareAround(tile, CMSATree) >= 8 ||
 
				CountMapSquareAround(tile, CMSAForest) >= 2)
 
			) {
 
		return _settings.game_creation.landscape == LT_TROPIC ? STR_SV_STNAME_FOREST : STR_SV_STNAME_WOODS;
 
		return _settings_game.game_creation.landscape == LT_TROPIC ? STR_SV_STNAME_FOREST : STR_SV_STNAME_WOODS;
 
	}
 

	
 
	/* check elevation compared to town */
 
@@ -563,7 +563,7 @@ static void UpdateStationAcceptance(Stat
 
			TileXY(rect.left, rect.bottom),
 
			rect.right - rect.left   + 1,
 
			rect.top   - rect.bottom + 1,
 
			_settings.station.modified_catchment ? FindCatchmentRadius(st) : (uint)CA_UNMODIFIED
 
			_settings_game.station.modified_catchment ? FindCatchmentRadius(st) : (uint)CA_UNMODIFIED
 
		);
 
	} else {
 
		memset(accepts, 0, sizeof(accepts));
 
@@ -692,7 +692,7 @@ CommandCost CheckFlatLandBelow(TileIndex
 
		 *     b) the build_on_slopes switch is disabled
 
		 */
 
		if (IsSteepSlope(tileh) ||
 
				((_is_old_ai_player || !_settings.construction.build_on_slopes) && tileh != SLOPE_FLAT)) {
 
				((_is_old_ai_player || !_settings_game.construction.build_on_slopes) && tileh != SLOPE_FLAT)) {
 
			return_cmd_error(STR_0007_FLAT_LAND_REQUIRED);
 
		}
 

	
 
@@ -750,7 +750,7 @@ static bool CanExpandRailroadStation(con
 
	uint w = fin[1];
 
	uint h = fin[2];
 

	
 
	if (_settings.station.nonuniform_stations) {
 
	if (_settings_game.station.nonuniform_stations) {
 
		/* determine new size of train station region.. */
 
		int x = min(TileX(st->train_tile), TileX(tile));
 
		int y = min(TileY(st->train_tile), TileY(tile));
 
@@ -794,7 +794,7 @@ static bool CanExpandRailroadStation(con
 
		}
 
	}
 
	/* make sure the final size is not too big. */
 
	if (curw > _settings.station.station_spread || curh > _settings.station.station_spread) {
 
	if (curw > _settings_game.station.station_spread || curh > _settings_game.station.station_spread) {
 
		_error_message = STR_306C_STATION_TOO_SPREAD_OUT;
 
		return false;
 
	}
 
@@ -883,7 +883,7 @@ CommandCost CmdBuildRailroadStation(Tile
 
		w_org = numtracks;
 
	}
 

	
 
	if (h_org > _settings.station.station_spread || w_org > _settings.station.station_spread) return CMD_ERROR;
 
	if (h_org > _settings_game.station.station_spread || w_org > _settings_game.station.station_spread) return CMD_ERROR;
 

	
 
	/* these values are those that will be stored in train_tile and station_platforms */
 
	uint finalvalues[3];
 
@@ -896,14 +896,14 @@ CommandCost CmdBuildRailroadStation(Tile
 
	/* If DC_EXEC is in flag, do not want to pass it to CheckFlatLandBelow, because of a nice bug
 
	 * for detail info, see:
 
	 * https://sourceforge.net/tracker/index.php?func=detail&aid=1029064&group_id=103924&atid=636365 */
 
	CommandCost ret = CheckFlatLandBelow(tile_org, w_org, h_org, flags & ~DC_EXEC, 5 << axis, _settings.station.nonuniform_stations ? &est : NULL);
 
	CommandCost ret = CheckFlatLandBelow(tile_org, w_org, h_org, flags & ~DC_EXEC, 5 << axis, _settings_game.station.nonuniform_stations ? &est : NULL);
 
	if (CmdFailed(ret)) return ret;
 
	CommandCost cost(EXPENSES_CONSTRUCTION, ret.GetCost() + (numtracks * _price.train_station_track + _price.train_station_length) * plat_len);
 

	
 
	Station *st = NULL;
 
	bool check_surrounding = true;
 

	
 
	if (_settings.station.adjacent_stations) {
 
	if (_settings_game.station.adjacent_stations) {
 
		if (est != INVALID_STATION) {
 
			if (HasBit(p1, 24)) {
 
				/* You can't build an adjacent station over the top of one that
 
@@ -938,7 +938,7 @@ CommandCost CmdBuildRailroadStation(Tile
 

	
 
		if (st->train_tile != 0) {
 
			/* check if we want to expanding an already existing station? */
 
			if (_is_old_ai_player || !_settings.station.join_stations)
 
			if (_is_old_ai_player || !_settings_game.station.join_stations)
 
				return_cmd_error(STR_3005_TOO_CLOSE_TO_ANOTHER_RAILROAD);
 
			if (!CanExpandRailroadStation(st, finalvalues, axis))
 
				return CMD_ERROR;
 
@@ -993,7 +993,7 @@ CommandCost CmdBuildRailroadStation(Tile
 
		/* Now really clear the land below the station
 
		 * It should never return CMD_ERROR.. but you never know ;)
 
		 * (a bit strange function name for it, but it really does clear the land, when DC_EXEC is in flags) */
 
		ret = CheckFlatLandBelow(tile_org, w_org, h_org, flags, 5 << axis, _settings.station.nonuniform_stations ? &est : NULL);
 
		ret = CheckFlatLandBelow(tile_org, w_org, h_org, flags, 5 << axis, _settings_game.station.nonuniform_stations ? &est : NULL);
 
		if (CmdFailed(ret)) return ret;
 

	
 
		st->train_tile = finalvalues[0];
 
@@ -1162,7 +1162,7 @@ CommandCost CmdRemoveFromRailroadStation
 
		/* Do not allow removing from stations if non-uniform stations are not enabled
 
		 * The check must be here to give correct error message
 
		 */
 
		if (!_settings.station.nonuniform_stations) return_cmd_error(STR_NONUNIFORM_STATIONS_DISALLOWED);
 
		if (!_settings_game.station.nonuniform_stations) return_cmd_error(STR_NONUNIFORM_STATIONS_DISALLOWED);
 

	
 
		/* If we reached here, the tile is valid so increase the quantity of tiles we will remove */
 
		quantity++;
 
@@ -1207,7 +1207,7 @@ CommandCost CmdRemoveFromRailroadStation
 
static CommandCost RemoveRailroadStation(Station *st, TileIndex tile, uint32 flags)
 
{
 
	/* if there is flooding and non-uniform stations are enabled, remove platforms tile by tile */
 
	if (_current_player == OWNER_WATER && _settings.station.nonuniform_stations) {
 
	if (_current_player == OWNER_WATER && _settings_game.station.nonuniform_stations) {
 
		return DoCommand(tile, 0, 0, DC_EXEC, CMD_REMOVE_FROM_RAILROAD_STATION);
 
	}
 

	
 
@@ -1326,7 +1326,7 @@ CommandCost CmdBuildRoadStop(TileIndex t
 
			Owner road_owner = GetRoadOwner(tile, ROADTYPE_ROAD);
 
			if (road_owner == OWNER_TOWN) {
 
				town_owned_road = true;
 
				if (!_settings.construction.road_stop_on_town_road) return_cmd_error(STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD);
 
				if (!_settings_game.construction.road_stop_on_town_road) return_cmd_error(STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD);
 
			} else {
 
				if (road_owner != OWNER_NONE && !CheckOwnership(road_owner)) return CMD_ERROR;
 
			}
 
@@ -1350,7 +1350,7 @@ CommandCost CmdBuildRoadStop(TileIndex t
 

	
 
	Station *st = NULL;
 

	
 
	if (!_settings.station.adjacent_stations || !HasBit(p2, 5)) {
 
	if (!_settings_game.station.adjacent_stations || !HasBit(p2, 5)) {
 
		st = GetStationAround(tile, 1, 1, INVALID_STATION);
 
		if (st == CHECK_STATIONS_ERR) return CMD_ERROR;
 
	}
 
@@ -1681,7 +1681,7 @@ uint8 GetAirportNoiseLevelForTown(const 
 
	 * adding the town_council_tolerance 4 times, as a way to graduate, depending of the tolerance.
 
	 * Basically, it says that the less tolerant a town is, the bigger the distance before
 
	 * an actual decrease can be granted */
 
	uint8 town_tolerance_distance = 8 + (_settings.difficulty.town_council_tolerance * 4);
 
	uint8 town_tolerance_distance = 8 + (_settings_game.difficulty.town_council_tolerance * 4);
 

	
 
	/* now, we want to have the distance segmented using the distance judged bareable by town
 
	 * This will give us the coefficient of reduction the distance provides. */
 
@@ -1715,7 +1715,7 @@ CommandCost CmdBuildAirport(TileIndex ti
 
	int h = afc->size_y;
 
	Station *st = NULL;
 

	
 
	if (w > _settings.station.station_spread || h > _settings.station.station_spread) {
 
	if (w > _settings_game.station.station_spread || h > _settings_game.station.station_spread) {
 
		_error_message = STR_306C_STATION_TOO_SPREAD_OUT;
 
		return CMD_ERROR;
 
	}
 
@@ -1729,7 +1729,7 @@ CommandCost CmdBuildAirport(TileIndex ti
 
	/* Check if local auth would allow a new airport */
 
	bool authority_refused;
 

	
 
	if (_settings.economy.station_noise_level) {
 
	if (_settings_game.economy.station_noise_level) {
 
		/* do not allow to build a new airport if this raise the town noise over the maximum allowed by town */
 
		authority_refused = (t->noise_reached + newnoise_level) > t->MaxTownNoise();
 
	} else {
 
@@ -1746,7 +1746,7 @@ CommandCost CmdBuildAirport(TileIndex ti
 
		return_cmd_error(STR_2035_LOCAL_AUTHORITY_REFUSES);
 
	}
 

	
 
	if (!_settings.station.adjacent_stations || !HasBit(p2, 0)) {
 
	if (!_settings_game.station.adjacent_stations || !HasBit(p2, 0)) {
 
		st = GetStationAround(tile, w, h, INVALID_STATION);
 
		if (st == CHECK_STATIONS_ERR) return CMD_ERROR;
 
	} else {
 
@@ -1821,7 +1821,7 @@ CommandCost CmdBuildAirport(TileIndex ti
 
		InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
 
		InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_PLANES);
 

	
 
		if (_settings.economy.station_noise_level) {
 
		if (_settings_game.economy.station_noise_level) {
 
			InvalidateWindow(WC_TOWN_VIEW, st->town->index);
 
		}
 
	}
 
@@ -1878,7 +1878,7 @@ static CommandCost RemoveAirport(Station
 

	
 
		InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_PLANES);
 

	
 
		if (_settings.economy.station_noise_level) {
 
		if (_settings_game.economy.station_noise_level) {
 
			InvalidateWindow(WC_TOWN_VIEW, st->town->index);
 
		}
 

	
 
@@ -2041,7 +2041,7 @@ CommandCost CmdBuildDock(TileIndex tile,
 
	/* middle */
 
	Station *st = NULL;
 

	
 
	if (!_settings.station.adjacent_stations || !HasBit(p1, 0)) {
 
	if (!_settings_game.station.adjacent_stations || !HasBit(p1, 0)) {
 
		st = GetStationAround(
 
				tile + ToTileIndexDiff(_dock_tileoffs_chkaround[direction]),
 
				_dock_w_chk[direction], _dock_h_chk[direction], INVALID_STATION);
 
@@ -2771,7 +2771,7 @@ StationSet FindStationsAroundIndustryTil
 
	int w_prod; // width and height of the "producer" of the cargo
 
	int h_prod;
 
	int max_rad;
 
	if (_settings.station.modified_catchment) {
 
	if (_settings_game.station.modified_catchment) {
 
		w_prod = w;
 
		h_prod = h;
 
		w += 2 * MAX_CATCHMENT;
 
@@ -2794,7 +2794,7 @@ StationSet FindStationsAroundIndustryTil
 
		if (st->IsBuoy()) continue; // bouys don't accept cargo
 

	
 

	
 
		if (_settings.station.modified_catchment) {
 
		if (_settings_game.station.modified_catchment) {
 
			/* min and max coordinates of the producer relative */
 
			const int x_min_prod = max_rad + 1;
 
			const int x_max_prod = max_rad + w_prod;
 
@@ -2848,7 +2848,7 @@ uint MoveGoodsToStation(TileIndex tile, 
 

	
 
		if (st->goods[type].rating == 0) continue; // Lowest possible rating, better not to give cargo anymore
 

	
 
		if (_settings.order.selectgoods && st->goods[type].last_speed == 0) continue; // Selectively servicing stations, and not this one
 
		if (_settings_game.order.selectgoods && st->goods[type].last_speed == 0) continue; // Selectively servicing stations, and not this one
 

	
 
		if (IsCargoInClass(type, CC_PASSENGERS)) {
 
			if (st->facilities == FACIL_TRUCK_STOP) continue; // passengers are never served by just a truck stop
 
@@ -3073,7 +3073,7 @@ void AfterLoadStations()
 

	
 
static CommandCost TerraformTile_Station(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
 
{
 
	if (_settings.construction.build_on_slopes && AutoslopeEnabled()) {
 
	if (_settings_game.construction.build_on_slopes && AutoslopeEnabled()) {
 
		/* TODO: If you implement newgrf callback 149 'land slope check', you have to decide what to do with it here.
 
		 *       TTDP does not call it.
 
		 */
src/station_type.h
Show inline comments
 
@@ -57,7 +57,7 @@ enum CatchmentArea {
 
	CA_TRAIN           =  4,
 
	CA_DOCK            =  5,
 

	
 
	CA_UNMODIFIED      =  4, ///< Used when _settings.station.modified_catchment is false
 
	CA_UNMODIFIED      =  4, ///< Used when _settings_game.station.modified_catchment is false
 

	
 
	MAX_CATCHMENT      = 10, ///< Airports have a catchment up to this number.
 
};
src/statusbar_gui.cpp
Show inline comments
 
@@ -82,7 +82,7 @@ struct StatusBarWindow : Window {
 

	
 
		this->DrawWidgets();
 
		SetDParam(0, _date);
 
		DrawStringCentered(70, 1, (_pause_game || _settings.gui.status_long_date) ? STR_00AF : STR_00AE, TC_FROMSTRING);
 
		DrawStringCentered(70, 1, (_pause_game || _settings_client.gui.status_long_date) ? STR_00AF : STR_00AE, TC_FROMSTRING);
 

	
 
		if (p != NULL) {
 
			/* Draw player money */

Changeset was too big and was cut off... Show full diff anyway

0 comments (0 inline, 0 general)