(svn r13251) -Codechange: rename _patches to _settings as that is more logic.

-Codechange: move all Settings into substructs of _settings in a way that they are logically grouped.
This commit is contained in:
rubidium 2008-05-25 19:17:03 +00:00
parent 6ea832ec7c
commit 4625695653
80 changed files with 1143 additions and 1179 deletions

View File

@ -154,7 +154,7 @@ static void AI_RunTick(PlayerID player)
Player *p = GetPlayer(player); Player *p = GetPlayer(player);
_current_player = player; _current_player = player;
if (_patches.ainew_active) { if (_settings.ai.ainew_active) {
AiNewDoGameLoop(p); AiNewDoGameLoop(p);
} else { } else {
/* Enable all kind of cheats the old AI needs in order to operate correctly... */ /* Enable all kind of cheats the old AI needs in order to operate correctly... */
@ -178,7 +178,7 @@ void AI_RunGameLoop()
if (!_ai.enabled) return; if (!_ai.enabled) return;
/* Don't do anything if we are a network-client, or the AI has been disabled */ /* Don't do anything if we are a network-client, or the AI has been disabled */
if (_networking && (!_network_server || !_patches.ai_in_multiplayer)) return; if (_networking && (!_network_server || !_settings.ai.ai_in_multiplayer)) return;
/* New tick */ /* New tick */
_ai.tick++; _ai.tick++;

View File

@ -67,14 +67,14 @@ static inline bool AI_AllowNewAI()
/* If in network, and server, possible AI */ /* If in network, and server, possible AI */
if (_networking && _network_server) { if (_networking && _network_server) {
/* Do we want AIs in multiplayer? */ /* Do we want AIs in multiplayer? */
if (!_patches.ai_in_multiplayer) if (!_settings.ai.ai_in_multiplayer)
return false; return false;
/* Only the NewAI is allowed... sadly enough the old AI just doesn't support this /* 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 * 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 * a big problem, because it uses variables that are only set AFTER the command
* is really executed... */ * is really executed... */
if (!_patches.ainew_active) if (!_settings.ai.ainew_active)
return false; return false;
} }

View File

@ -1570,21 +1570,21 @@ static void AiStateWantNewRoute(Player *p)
for (;;) { for (;;) {
r = (uint16)Random(); r = (uint16)Random();
if (_patches.ai_disable_veh_train && if (_settings.ai.ai_disable_veh_train &&
_patches.ai_disable_veh_roadveh && _settings.ai.ai_disable_veh_roadveh &&
_patches.ai_disable_veh_aircraft && _settings.ai.ai_disable_veh_aircraft &&
_patches.ai_disable_veh_ship) { _settings.ai.ai_disable_veh_ship) {
return; return;
} }
if (r < 0x7626) { if (r < 0x7626) {
if (_patches.ai_disable_veh_train) continue; if (_settings.ai.ai_disable_veh_train) continue;
AiWantTrainRoute(p); AiWantTrainRoute(p);
} else if (r < 0xC4EA) { } else if (r < 0xC4EA) {
if (_patches.ai_disable_veh_roadveh) continue; if (_settings.ai.ai_disable_veh_roadveh) continue;
AiWantRoadRoute(p); AiWantRoadRoute(p);
} else if (r < 0xD89B) { } else if (r < 0xD89B) {
if (_patches.ai_disable_veh_aircraft) continue; if (_settings.ai.ai_disable_veh_aircraft) continue;
AiWantAircraftRoute(p); AiWantAircraftRoute(p);
} else { } else {
/* Ships are not implemented in this (broken) AI */ /* Ships are not implemented in this (broken) AI */
@ -1603,7 +1603,7 @@ static void AiStateWantNewRoute(Player *p)
static bool AiCheckTrackResources(TileIndex tile, const AiDefaultBlockData *p, byte cargo) static bool AiCheckTrackResources(TileIndex tile, const AiDefaultBlockData *p, byte cargo)
{ {
uint rad = (_patches.modified_catchment) ? CA_TRAIN : CA_UNMODIFIED; uint rad = (_settings.station.modified_catchment) ? CA_TRAIN : CA_UNMODIFIED;
for (; p->mode != 4; p++) { for (; p->mode != 4; p++) {
AcceptedCargo values; AcceptedCargo values;
@ -2599,7 +2599,7 @@ static bool AiCheckRoadResources(TileIndex tile, const AiDefaultBlockData *p, by
uint values[NUM_CARGO]; uint values[NUM_CARGO];
int rad; int rad;
if (_patches.modified_catchment) { if (_settings.station.modified_catchment) {
rad = CA_TRUCK; // Same as CA_BUS at the moment? rad = CA_TRUCK; // Same as CA_BUS at the moment?
} else { // change that at some point? } else { // change that at some point?
rad = 4; rad = 4;
@ -3423,7 +3423,7 @@ static bool AiCheckAirportResources(TileIndex tile, const AiDefaultBlockData *p,
const AirportFTAClass* airport = GetAirport(p->attr); const AirportFTAClass* airport = GetAirport(p->attr);
uint w = airport->size_x; uint w = airport->size_x;
uint h = airport->size_y; uint h = airport->size_y;
uint rad = _patches.modified_catchment ? airport->catchment : (uint)CA_UNMODIFIED; uint rad = _settings.station.modified_catchment ? airport->catchment : (uint)CA_UNMODIFIED;
if (cargo & 0x80) { if (cargo & 0x80) {
GetProductionAroundTiles(values, tile2, w, h, rad); GetProductionAroundTiles(values, tile2, w, h, rad);
@ -3975,7 +3975,7 @@ void AiDoGameLoop(Player *p)
// to the patch-setting // to the patch-setting
// Also, it takes into account the setting if the service-interval is in days // Also, it takes into account the setting if the service-interval is in days
// or in % // or in %
_ai_service_interval = _patches.servint_ispercent ? 80 : 180; _ai_service_interval = _settings.vehicle.servint_ispercent ? 80 : 180;
if (IsHumanPlayer(_current_player)) return; if (IsHumanPlayer(_current_player)) return;

View File

@ -130,9 +130,9 @@ static void AiNew_State_WakeUp(Player *p)
// Check all vehicles once in a while // Check all vehicles once in a while
_players_ainew[p->index].action = AI_ACTION_CHECK_ALL_VEHICLES; _players_ainew[p->index].action = AI_ACTION_CHECK_ALL_VEHICLES;
_players_ainew[p->index].last_vehiclecheck_date = _date; _players_ainew[p->index].last_vehiclecheck_date = _date;
} else if (c < 100 && !_patches.ai_disable_veh_roadveh) { } else if (c < 100 && !_settings.ai.ai_disable_veh_roadveh) {
// Do we have any spots for road-vehicles left open? // Do we have any spots for road-vehicles left open?
if (GetFreeUnitNumber(VEH_ROAD) <= _patches.max_roadveh) { if (GetFreeUnitNumber(VEH_ROAD) <= _settings.vehicle.max_roadveh) {
if (c < 85) { if (c < 85) {
_players_ainew[p->index].action = AI_ACTION_TRUCK_ROUTE; _players_ainew[p->index].action = AI_ACTION_TRUCK_ROUTE;
} else { } else {
@ -140,8 +140,8 @@ static void AiNew_State_WakeUp(Player *p)
} }
} }
#if 0 #if 0
} else if (c < 200 && !_patches.ai_disable_veh_train) { } else if (c < 200 && !_settings.ai.ai_disable_veh_train) {
if (GetFreeUnitNumber(VEH_TRAIN) <= _patches.max_trains) { if (GetFreeUnitNumber(VEH_TRAIN) <= _settings.vehicle.max_trains) {
_players_ainew[p->index].action = AI_ACTION_TRAIN_ROUTE; _players_ainew[p->index].action = AI_ACTION_TRAIN_ROUTE;
} }
#endif #endif
@ -155,7 +155,7 @@ static void AiNew_State_WakeUp(Player *p)
return; return;
} }
if (_patches.ai_disable_veh_roadveh && ( if (_settings.ai.ai_disable_veh_roadveh && (
_players_ainew[p->index].action == AI_ACTION_BUS_ROUTE || _players_ainew[p->index].action == AI_ACTION_BUS_ROUTE ||
_players_ainew[p->index].action == AI_ACTION_TRUCK_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.. // to build the route anyway..
if (_players_ainew[p->index].action == AI_ACTION_BUS_ROUTE && if (_players_ainew[p->index].action == AI_ACTION_BUS_ROUTE &&
money > AI_MINIMUM_BUS_ROUTE_MONEY) { money > AI_MINIMUM_BUS_ROUTE_MONEY) {
if (GetFreeUnitNumber(VEH_ROAD) > _patches.max_roadveh) { if (GetFreeUnitNumber(VEH_ROAD) > _settings.vehicle.max_roadveh) {
_players_ainew[p->index].action = AI_ACTION_NONE; _players_ainew[p->index].action = AI_ACTION_NONE;
return; return;
} }
@ -190,7 +190,7 @@ static void AiNew_State_WakeUp(Player *p)
} }
if (_players_ainew[p->index].action == AI_ACTION_TRUCK_ROUTE && if (_players_ainew[p->index].action == AI_ACTION_TRUCK_ROUTE &&
money > AI_MINIMUM_TRUCK_ROUTE_MONEY) { money > AI_MINIMUM_TRUCK_ROUTE_MONEY) {
if (GetFreeUnitNumber(VEH_ROAD) > _patches.max_roadveh) { if (GetFreeUnitNumber(VEH_ROAD) > _settings.vehicle.max_roadveh) {
_players_ainew[p->index].action = AI_ACTION_NONE; _players_ainew[p->index].action = AI_ACTION_NONE;
return; return;
} }
@ -1035,7 +1035,7 @@ static void AiNew_State_BuildPath(Player *p)
if (_players_ainew[p->index].path_info.position == -2) { if (_players_ainew[p->index].path_info.position == -2) {
// This means we are done building! // This means we are done building!
if (_players_ainew[p->index].tbt == AI_TRUCK && !_patches.roadveh_queue) { if (_players_ainew[p->index].tbt == AI_TRUCK && !_settings.pf.roadveh_queue) {
// If they not queue, they have to go up and down to try again at a station... // 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 // We don't want that, so try building some road left or right of the station
DiagDirection dir1, dir2, dir3; DiagDirection dir1, dir2, dir3;
@ -1186,7 +1186,7 @@ static void AiNew_State_GiveOrders(Player *p)
} }
// Very handy for AI, goto depot.. but yeah, it needs to be activated ;) // Very handy for AI, goto depot.. but yeah, it needs to be activated ;)
if (_patches.gotodepot) { if (_settings.order.gotodepot) {
idx = 0; idx = 0;
order.MakeGoToDepot(GetDepotByTile(_players_ainew[p->index].depot_tile)->index, ODTFB_PART_OF_ORDERS); 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); AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), order.Pack(), DC_EXEC, CMD_INSERT_ORDER);

View File

@ -287,7 +287,7 @@ CommandCost CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
} }
UnitID unit_num = HasBit(p2, 0) ? 0 : GetFreeUnitNumber(VEH_AIRCRAFT); UnitID unit_num = HasBit(p2, 0) ? 0 : GetFreeUnitNumber(VEH_AIRCRAFT);
if (unit_num > _patches.max_aircraft) if (unit_num > _settings.vehicle.max_aircraft)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME); return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
@ -404,7 +404,7 @@ CommandCost CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v->u.air.targetairport = GetStationIndex(tile); v->u.air.targetairport = GetStationIndex(tile);
v->SetNext(u); v->SetNext(u);
v->service_interval = _patches.servint_aircraft; v->service_interval = _settings.vehicle.servint_aircraft;
v->date_of_last_service = _date; v->date_of_last_service = _date;
v->build_year = u->build_year = _cur_year; v->build_year = u->build_year = _cur_year;
@ -664,7 +664,7 @@ CommandCost CmdRefitAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
static void CheckIfAircraftNeedsService(Vehicle *v) static void CheckIfAircraftNeedsService(Vehicle *v)
{ {
if (_patches.servint_aircraft == 0 || !v->NeedsAutomaticServicing()) return; if (_settings.vehicle.servint_aircraft == 0 || !v->NeedsAutomaticServicing()) return;
if (v->IsInDepot()) { if (v->IsInDepot()) {
VehicleServiceInDepot(v); VehicleServiceInDepot(v);
return; return;
@ -884,7 +884,7 @@ static int UpdateAircraftSpeed(Vehicle *v, uint speed_limit = SPEED_LIMIT_NONE,
/* Adjust speed limits by plane speed factor to prevent taxiing /* Adjust speed limits by plane speed factor to prevent taxiing
* and take-off speeds being too low. */ * and take-off speeds being too low. */
speed_limit *= _patches.plane_speed; speed_limit *= _settings.vehicle.plane_speed;
if (v->u.air.cached_max_speed < speed_limit) { if (v->u.air.cached_max_speed < speed_limit) {
if (v->cur_speed < speed_limit) hard_limit = false; if (v->cur_speed < speed_limit) hard_limit = false;
@ -902,7 +902,7 @@ static int UpdateAircraftSpeed(Vehicle *v, uint speed_limit = SPEED_LIMIT_NONE,
* speeds to that aircraft do not get to taxi speed straight after * speeds to that aircraft do not get to taxi speed straight after
* touchdown. */ * touchdown. */
if (!hard_limit && v->cur_speed > speed_limit) { if (!hard_limit && v->cur_speed > speed_limit) {
speed_limit = v->cur_speed - max(1, ((v->cur_speed * v->cur_speed) / 16384) / _patches.plane_speed); speed_limit = v->cur_speed - max(1, ((v->cur_speed * v->cur_speed) / 16384) / _settings.vehicle.plane_speed);
} }
spd = min(v->cur_speed + (spd >> 8) + (v->subspeed < t), speed_limit); spd = min(v->cur_speed + (spd >> 8) + (v->subspeed < t), speed_limit);
@ -913,12 +913,12 @@ static int UpdateAircraftSpeed(Vehicle *v, uint speed_limit = SPEED_LIMIT_NONE,
/* updates statusbar only if speed have changed to save CPU time */ /* updates statusbar only if speed have changed to save CPU time */
if (spd != v->cur_speed) { if (spd != v->cur_speed) {
v->cur_speed = spd; v->cur_speed = spd;
if (_patches.vehicle_speed) if (_settings.gui.vehicle_speed)
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
/* Adjust distance moved by plane speed setting */ /* Adjust distance moved by plane speed setting */
if (_patches.plane_speed > 1) spd /= _patches.plane_speed; if (_settings.vehicle.plane_speed > 1) spd /= _settings.vehicle.plane_speed;
if (!(v->direction & 1)) spd = spd * 3 / 4; if (!(v->direction & 1)) spd = spd * 3 / 4;
@ -1599,7 +1599,7 @@ static void AircraftEventHandler_AtTerminal(Vehicle *v, const AirportFTAClass *a
AircraftEventHandler_EnterTerminal(v, apc); AircraftEventHandler_EnterTerminal(v, apc);
/* on an airport with helipads, a helicopter will always land there /* on an airport with helipads, a helicopter will always land there
* and get serviced at the same time - patch setting */ * and get serviced at the same time - patch setting */
if (_patches.serviceathelipad) { if (_settings.order.serviceathelipad) {
if (v->subtype == AIR_HELICOPTER && apc->helipads != NULL) { if (v->subtype == AIR_HELICOPTER && apc->helipads != NULL) {
/* an exerpt of ServiceAircraft, without the invisibility stuff */ /* an exerpt of ServiceAircraft, without the invisibility stuff */
v->date_of_last_service = _date; v->date_of_last_service = _date;

View File

@ -477,7 +477,7 @@ uint32 GetValidAirports()
{ {
uint32 mask = 0; uint32 mask = 0;
if (_cur_year < 1960 || _patches.always_small_airport) SetBit(mask, 0); // small airport if (_cur_year < 1960 || _settings.station.always_small_airport) SetBit(mask, 0); // small airport
if (_cur_year >= 1955) SetBit(mask, 1); // city airport if (_cur_year >= 1955) SetBit(mask, 1); // city airport
if (_cur_year >= 1963) SetBit(mask, 2); // heliport if (_cur_year >= 1963) SetBit(mask, 2); // heliport
if (_cur_year >= 1980) SetBit(mask, 3); // metropolitan airport if (_cur_year >= 1980) SetBit(mask, 3); // metropolitan airport

View File

@ -70,12 +70,12 @@ struct BuildAirToolbarWindow : Window {
BuildAirToolbarWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number) BuildAirToolbarWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
{ {
this->FindWindowPlacementAndResize(desc); this->FindWindowPlacementAndResize(desc);
if (_patches.link_terraform_toolbar) ShowTerraformToolbar(this); if (_settings.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
} }
~BuildAirToolbarWindow() ~BuildAirToolbarWindow()
{ {
if (_patches.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0); if (_settings.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
} }
virtual void OnPaint() virtual void OnPaint()
@ -178,7 +178,7 @@ public:
this->SetWidgetLoweredState(BAW_BTN_DOHILIGHT, _station_show_coverage); this->SetWidgetLoweredState(BAW_BTN_DOHILIGHT, _station_show_coverage);
this->LowerWidget(_selected_airport_type + BAW_SMALL_AIRPORT); this->LowerWidget(_selected_airport_type + BAW_SMALL_AIRPORT);
if (_patches.station_noise_level) { if (_settings.economy.station_noise_level) {
ResizeWindowForWidget(this, BAW_BOTTOMPANEL, 0, 10); ResizeWindowForWidget(this, BAW_BOTTOMPANEL, 0, 10);
} }
@ -211,14 +211,14 @@ public:
airport = GetAirport(_selected_airport_type); airport = GetAirport(_selected_airport_type);
SetTileSelectSize(airport->size_x, airport->size_y); SetTileSelectSize(airport->size_x, airport->size_y);
int rad = _patches.modified_catchment ? airport->catchment : (uint)CA_UNMODIFIED; int rad = _settings.station.modified_catchment ? airport->catchment : (uint)CA_UNMODIFIED;
if (_station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad); if (_station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
this->DrawWidgets(); this->DrawWidgets();
/* only show the station (airport) noise, if the noise option is activated */ /* only show the station (airport) noise, if the noise option is activated */
if (_patches.station_noise_level) { if (_settings.economy.station_noise_level) {
/* show the noise of the selected airport */ /* show the noise of the selected airport */
SetDParam(0, airport->noise_level); SetDParam(0, airport->noise_level);
DrawString(2, 206, STR_STATION_NOISE, 0); DrawString(2, 206, STR_STATION_NOISE, 0);

View File

@ -38,7 +38,7 @@ static inline bool AutoslopeCheckForEntranceEdge(TileIndex tile, uint z_new, Slo
*/ */
static inline bool AutoslopeEnabled() static inline bool AutoslopeEnabled()
{ {
return (_patches.autoslope && return (_settings.construction.autoslope &&
((IsValidPlayer(_current_player) && !_is_old_ai_player) || ((IsValidPlayer(_current_player) && !_is_old_ai_player) ||
(_current_player == OWNER_NONE && _game_mode == GM_EDITOR))); (_current_player == OWNER_NONE && _game_mode == GM_EDITOR)));
} }

View File

@ -506,7 +506,7 @@ static int DrawRailWagonPurchaseInfo(int x, int y, EngineID engine_number, const
y += 10; y += 10;
/* Wagon speed limit, displayed if above zero */ /* Wagon speed limit, displayed if above zero */
if (_patches.wagon_speed_limits) { if (_settings.vehicle.wagon_speed_limits) {
uint max_speed = GetEngineProperty(engine_number, 0x09, rvi->max_speed); uint max_speed = GetEngineProperty(engine_number, 0x09, rvi->max_speed);
if (max_speed > 0) { if (max_speed > 0) {
SetDParam(0, max_speed * 10 / 16); SetDParam(0, max_speed * 10 / 16);
@ -544,7 +544,7 @@ static int DrawRailEnginePurchaseInfo(int x, int y, EngineID engine_number, cons
y += 10; y += 10;
/* Max tractive effort - not applicable if old acceleration or maglev */ /* Max tractive effort - not applicable if old acceleration or maglev */
if (_patches.realistic_acceleration && rvi->railtype != RAILTYPE_MAGLEV) { if (_settings.vehicle.realistic_acceleration && rvi->railtype != RAILTYPE_MAGLEV) {
SetDParam(0, ((weight << multihead) * 10 * GetEngineProperty(engine_number, 0x1F, rvi->tractive_effort)) / 256); SetDParam(0, ((weight << multihead) * 10 * GetEngineProperty(engine_number, 0x1F, rvi->tractive_effort)) / 256);
DrawString(x, y, STR_PURCHASE_INFO_MAX_TE, TC_FROMSTRING); DrawString(x, y, STR_PURCHASE_INFO_MAX_TE, TC_FROMSTRING);
y += 10; y += 10;

View File

@ -346,7 +346,7 @@ static void ChangeTileOwner_Clear(TileIndex tile, PlayerID old_player, PlayerID
void InitializeClearLand() void InitializeClearLand()
{ {
_opt.snow_line = _patches.snow_line_height * TILE_HEIGHT; _opt.snow_line = _settings.game_creation.snow_line_height * TILE_HEIGHT;
} }
static CommandCost TerraformTile_Clear(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new) static CommandCost TerraformTile_Clear(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)

View File

@ -926,8 +926,8 @@ DEF_CONSOLE_CMD(ConRestart)
} }
/* Don't copy the _newgame pointers to the real pointers, so call SwitchMode directly */ /* Don't copy the _newgame pointers to the real pointers, so call SwitchMode directly */
_patches.map_x = MapLogX(); _settings.game_creation.map_x = MapLogX();
_patches.map_y = FindFirstBit(MapSizeY()); _settings.game_creation.map_y = FindFirstBit(MapSizeY());
SwitchMode(SM_NEWGAME); SwitchMode(SM_NEWGAME);
return true; return true;
} }
@ -940,7 +940,7 @@ DEF_CONSOLE_CMD(ConGetSeed)
return true; return true;
} }
IConsolePrintF(CC_DEFAULT, "Generation Seed: %u", _patches.generation_seed); IConsolePrintF(CC_DEFAULT, "Generation Seed: %u", _settings.game_creation.generation_seed);
return true; return true;
} }
@ -1083,7 +1083,7 @@ DEF_CONSOLE_CMD(ConExit)
return true; return true;
} }
if (_game_mode == GM_NORMAL && _patches.autosave_on_exit) DoExitSave(); if (_game_mode == GM_NORMAL && _settings.gui.autosave_on_exit) DoExitSave();
_exit_game = true; _exit_game = true;
return true; return true;

View File

@ -283,10 +283,10 @@ void IncreaseDate()
ShipsYearlyLoop(); ShipsYearlyLoop();
if (_network_server) NetworkServerYearlyLoop(); if (_network_server) NetworkServerYearlyLoop();
if (_cur_year == _patches.semaphore_build_before) ResetSignalVariant(); if (_cur_year == _settings.gui.semaphore_build_before) ResetSignalVariant();
/* check if we reached end of the game */ /* check if we reached end of the game */
if (_cur_year == _patches.ending_year) { if (_cur_year == _settings.gui.ending_year) {
ShowEndGameChart(); ShowEndGameChart();
/* check if we reached the maximum year, decrement dates by a year */ /* check if we reached the maximum year, decrement dates by a year */
} else if (_cur_year == MAX_YEAR + 1) { } else if (_cur_year == MAX_YEAR + 1) {
@ -303,5 +303,5 @@ void IncreaseDate()
InitChatMessage(); InitChatMessage();
} }
if (_patches.auto_euro) CheckSwitchToEuro(); if (_settings.gui.auto_euro) CheckSwitchToEuro();
} }

View File

@ -136,12 +136,12 @@ struct BuildDocksToolbarWindow : Window {
BuildDocksToolbarWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number) BuildDocksToolbarWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
{ {
this->FindWindowPlacementAndResize(desc); this->FindWindowPlacementAndResize(desc);
if (_patches.link_terraform_toolbar) ShowTerraformToolbar(this); if (_settings.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
} }
~BuildDocksToolbarWindow() ~BuildDocksToolbarWindow()
{ {
if (_patches.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0); if (_settings.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
} }
virtual void OnPaint() virtual void OnPaint()
@ -263,7 +263,7 @@ public:
virtual void OnPaint() virtual void OnPaint()
{ {
int rad = (_patches.modified_catchment) ? CA_DOCK : CA_UNMODIFIED; int rad = (_settings.station.modified_catchment) ? CA_DOCK : CA_UNMODIFIED;
this->DrawWidgets(); this->DrawWidgets();

View File

@ -654,7 +654,7 @@ static void AddInflation()
* inflation doesn't add anything after that either; it even makes playing * inflation doesn't add anything after that either; it even makes playing
* it impossible due to the diverging cost and income rates. * it impossible due to the diverging cost and income rates.
*/ */
if ((_cur_year - _patches.starting_year) >= (ORIGINAL_MAX_YEAR - ORIGINAL_BASE_YEAR)) return; if ((_cur_year - _settings.game_creation.starting_year) >= (ORIGINAL_MAX_YEAR - ORIGINAL_BASE_YEAR)) return;
/* Approximation for (100 + infl_amount)% ** (1 / 12) - 100% /* Approximation for (100 + infl_amount)% ** (1 / 12) - 100%
* scaled by 65536 * scaled by 65536
@ -1208,7 +1208,7 @@ static void DeliverGoodsToIndustry(TileIndex xy, CargoID cargo_type, int num_pie
* XXX - Think of something better to * XXX - Think of something better to
* 1) Only deliver to industries which are withing the catchment radius * 1) Only deliver to industries which are withing the catchment radius
* 2) Distribute between industries if more then one is present */ * 2) Distribute between industries if more then one is present */
best_dist = (_patches.station_spread + 8) * 2; best_dist = (_settings.station.station_spread + 8) * 2;
FOR_ALL_INDUSTRIES(ind) { FOR_ALL_INDUSTRIES(ind) {
indspec = GetIndustrySpec(ind->type); indspec = GetIndustrySpec(ind->type);
uint i; uint i;
@ -1481,7 +1481,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
/* We have not waited enough time till the next round of loading/unloading */ /* We have not waited enough time till the next round of loading/unloading */
if (--v->load_unload_time_rem != 0) { if (--v->load_unload_time_rem != 0) {
if (_patches.improved_load && (v->current_order.GetLoadType() & OLFB_FULL_LOAD)) { if (_settings.order.improved_load && (v->current_order.GetLoadType() & OLFB_FULL_LOAD)) {
/* 'Reserve' this cargo for this vehicle, because we were first. */ /* 'Reserve' this cargo for this vehicle, because we were first. */
for (; v != NULL; v = v->Next()) { for (; v != NULL; v = v->Next()) {
if (v->cargo_cap != 0) cargo_left[v->cargo_type] -= v->cargo_cap - v->cargo.Count(); 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, int *cargo_left)
if (v->cargo_cap == 0) continue; if (v->cargo_cap == 0) continue;
byte load_amount = EngInfo(v->engine_type)->load_amount; byte load_amount = EngInfo(v->engine_type)->load_amount;
if (_patches.gradual_loading && HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_LOAD_AMOUNT)) { if (_settings.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); 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); 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, int *cargo_left)
if (HasBit(v->vehicle_flags, VF_CARGO_UNLOADING) && (u->current_order.GetUnloadType() & OUFB_NO_UNLOAD) == 0) { if (HasBit(v->vehicle_flags, VF_CARGO_UNLOADING) && (u->current_order.GetUnloadType() & OUFB_NO_UNLOAD) == 0) {
uint cargo_count = v->cargo.Count(); uint cargo_count = v->cargo.Count();
uint amount_unloaded = _patches.gradual_loading ? min(cargo_count, load_amount) : cargo_count; uint amount_unloaded = _settings.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? 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)) { if (HasBit(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE) && !(u->current_order.GetUnloadType() & OUFB_TRANSFER)) {
@ -1552,7 +1552,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
unloading_time += amount_unloaded; unloading_time += amount_unloaded;
anything_unloaded = true; anything_unloaded = true;
if (_patches.gradual_loading && remaining) { if (_settings.order.gradual_loading && remaining) {
completely_emptied = false; completely_emptied = false;
} else { } else {
/* We have finished unloading (cargo count == 0) */ /* We have finished unloading (cargo count == 0) */
@ -1586,14 +1586,14 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
/* Skip loading this vehicle if another train/vehicle is already handling /* Skip loading this vehicle if another train/vehicle is already handling
* the same cargo type at this station */ * the same cargo type at this station */
if (_patches.improved_load && cargo_left[v->cargo_type] <= 0) { if (_settings.order.improved_load && cargo_left[v->cargo_type] <= 0) {
SetBit(cargo_not_full, v->cargo_type); SetBit(cargo_not_full, v->cargo_type);
continue; continue;
} }
if (cap > count) cap = count; if (cap > count) cap = count;
if (_patches.gradual_loading) cap = min(cap, load_amount); if (_settings.order.gradual_loading) cap = min(cap, load_amount);
if (_patches.improved_load) { if (_settings.order.improved_load) {
/* Don't load stuff that is already 'reserved' for other vehicles */ /* Don't load stuff that is already 'reserved' for other vehicles */
cap = min((uint)cargo_left[v->cargo_type], cap); cap = min((uint)cargo_left[v->cargo_type], cap);
cargo_left[v->cargo_type] -= cap; cargo_left[v->cargo_type] -= cap;
@ -1637,7 +1637,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
* all wagons at the same time instead of using the same 'improved' * all wagons at the same time instead of using the same 'improved'
* loading algorithm for the wagons (only fill wagon when there is * loading algorithm for the wagons (only fill wagon when there is
* enough to fill the previous wagons) */ * enough to fill the previous wagons) */
if (_patches.improved_load && (u->current_order.GetLoadType() & OLFB_FULL_LOAD)) { if (_settings.order.improved_load && (u->current_order.GetLoadType() & OLFB_FULL_LOAD)) {
/* Update left cargo */ /* Update left cargo */
for (v = u; v != NULL; v = v->Next()) { for (v = u; v != NULL; v = v->Next()) {
if (v->cargo_cap != 0) cargo_left[v->cargo_type] -= v->cargo_cap - v->cargo.Count(); 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, int *cargo_left)
v = u; v = u;
if (anything_loaded || anything_unloaded) { if (anything_loaded || anything_unloaded) {
if (_patches.gradual_loading) { if (_settings.order.gradual_loading) {
/* The time it takes to load one 'slice' of cargo or passengers depends /* 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 */ * on the vehicle type - the values here are those found in TTDPatch */
const uint gradual_loading_wait_time[] = { 40, 20, 10, 20 }; const uint gradual_loading_wait_time[] = { 40, 20, 10, 20 };
@ -1684,11 +1684,11 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
/* Calculate the loading indicator fill percent and display /* Calculate the loading indicator fill percent and display
* In the Game Menu do not display indicators * In the Game Menu do not display indicators
* If _patches.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 == 2, show indicators (bool can be promoted to int as 0 or 1 - results in 2 > 0,1 )
* if _patches.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 == 1, _local_player must be the owner or must be a spectator to show ind., so 1 > 0
* if _patches.loading_indicators == 0, do not display indicators ... 0 is never greater than anything * if _settings.gui.loading_indicators == 0, do not display indicators ... 0 is never greater than anything
*/ */
if (_game_mode != GM_MENU && (_patches.loading_indicators > (uint)(v->owner != _local_player && _local_player != PLAYER_SPECTATOR))) { if (_game_mode != GM_MENU && (_settings.gui.loading_indicators > (uint)(v->owner != _local_player && _local_player != PLAYER_SPECTATOR))) {
StringID percent_up_down = STR_NULL; StringID percent_up_down = STR_NULL;
int percent = CalcPercentVehicleFilled(v, &percent_up_down); int percent = CalcPercentVehicleFilled(v, &percent_up_down);
if (v->fill_percent_te_id == INVALID_TE_ID) { if (v->fill_percent_te_id == INVALID_TE_ID) {
@ -1736,7 +1736,7 @@ void LoadUnloadStation(Station *st)
void PlayersMonthlyLoop() void PlayersMonthlyLoop()
{ {
PlayersGenStatistics(); PlayersGenStatistics();
if (_patches.inflation && _cur_year < MAX_YEAR) if (_settings.economy.inflation && _cur_year < MAX_YEAR)
AddInflation(); AddInflation();
PlayersPayInterest(); PlayersPayInterest();
/* Reset the _current_player flag */ /* Reset the _current_player flag */
@ -1802,7 +1802,7 @@ CommandCost CmdBuyShareInCompany(TileIndex tile, uint32 flags, uint32 p1, uint32
/* Check if buying shares is allowed (protection against modified clients) */ /* Check if buying shares is allowed (protection against modified clients) */
/* Cannot buy own shares */ /* Cannot buy own shares */
if (!IsValidPlayer((PlayerID)p1) || !_patches.allow_shares || _current_player == (PlayerID)p1) return CMD_ERROR; if (!IsValidPlayer((PlayerID)p1) || !_settings.economy.allow_shares || _current_player == (PlayerID)p1) return CMD_ERROR;
p = GetPlayer((PlayerID)p1); p = GetPlayer((PlayerID)p1);
@ -1851,7 +1851,7 @@ CommandCost CmdSellShareInCompany(TileIndex tile, uint32 flags, uint32 p1, uint3
/* Check if selling shares is allowed (protection against modified clients) */ /* Check if selling shares is allowed (protection against modified clients) */
/* Cannot sell own shares */ /* Cannot sell own shares */
if (!IsValidPlayer((PlayerID)p1) || !_patches.allow_shares || _current_player == (PlayerID)p1) return CMD_ERROR; if (!IsValidPlayer((PlayerID)p1) || !_settings.economy.allow_shares || _current_player == (PlayerID)p1) return CMD_ERROR;
p = GetPlayer((PlayerID)p1); p = GetPlayer((PlayerID)p1);

View File

@ -25,7 +25,7 @@ static inline bool HasCatenary(RailType rt)
*/ */
static inline bool HasCatenaryDrawn(RailType rt) static inline bool HasCatenaryDrawn(RailType rt)
{ {
return HasCatenary(rt) && !IsInvisibilitySet(TO_CATENARY) && !_patches.disable_elrails; return HasCatenary(rt) && !IsInvisibilitySet(TO_CATENARY) && !_settings.vehicle.disable_elrails;
} }
/** /**
@ -37,6 +37,6 @@ void DrawCatenary(const TileInfo *ti);
void DrawCatenaryOnTunnel(const TileInfo *ti); void DrawCatenaryOnTunnel(const TileInfo *ti);
void DrawCatenaryOnBridge(const TileInfo *ti); void DrawCatenaryOnBridge(const TileInfo *ti);
int32 SettingsDisableElrail(int32 p1); ///< _patches.disable_elrail callback int32 SettingsDisableElrail(int32 p1); ///< _settings.disable_elrail callback
#endif /* ELRAIL_FUNC_H */ #endif /* ELRAIL_FUNC_H */

View File

@ -217,7 +217,7 @@ static void CalcEngineReliability(Engine *e)
uint age = e->age; uint age = e->age;
/* Check for early retirement */ /* Check for early retirement */
if (e->player_avail != 0 && !_patches.never_expire_vehicles) { if (e->player_avail != 0 && !_settings.vehicle.never_expire_vehicles) {
int retire_early = e->info.retire_early; 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); 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) { if (retire_early != 0 && age >= retire_early_max_age) {
@ -230,7 +230,7 @@ static void CalcEngineReliability(Engine *e)
if (age < e->duration_phase_1) { if (age < e->duration_phase_1) {
uint start = e->reliability_start; uint start = e->reliability_start;
e->reliability = age * (e->reliability_max - start) / e->duration_phase_1 + start; e->reliability = age * (e->reliability_max - start) / e->duration_phase_1 + start;
} else if ((age -= e->duration_phase_1) < e->duration_phase_2 || _patches.never_expire_vehicles) { } else if ((age -= e->duration_phase_1) < e->duration_phase_2 || _settings.vehicle.never_expire_vehicles) {
/* We are at the peak of this engines life. It will have max reliability. /* 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 */ * This is also true if the engines never expire. They will not go bad over time */
e->reliability = e->reliability_max; e->reliability = e->reliability_max;
@ -293,7 +293,7 @@ void StartupEngines()
CalcEngineReliability(e); CalcEngineReliability(e);
} }
e->lifelength = ei->lifelength + _patches.extend_vehicle_life; e->lifelength = ei->lifelength + _settings.vehicle.extend_vehicle_life;
/* prevent certain engines from ever appearing. */ /* prevent certain engines from ever appearing. */
if (!HasBit(ei->climates, _opt.landscape)) { if (!HasBit(ei->climates, _opt.landscape)) {

View File

@ -91,8 +91,8 @@ static void * CDECL _GenerateWorld(void *arg)
_generating_world = true; _generating_world = true;
if (_network_dedicated) DEBUG(net, 0, "Generating map, please wait..."); 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 */ /* Set the Random() seed to generation_seed so we produce the same map with the same seed */
if (_patches.generation_seed == GENERATE_NEW_SEED) _patches.generation_seed = _patches_newgame.generation_seed = InteractiveRandom(); if (_settings.game_creation.generation_seed == GENERATE_NEW_SEED) _settings.game_creation.generation_seed = _settings_newgame.game_creation.generation_seed = InteractiveRandom();
_random.SetSeed(_patches.generation_seed); _random.SetSeed(_settings.game_creation.generation_seed);
SetGeneratingWorldProgress(GWP_MAP_INIT, 2); SetGeneratingWorldProgress(GWP_MAP_INIT, 2);
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, VHM_NONE, WC_MAIN_WINDOW, 0); SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, VHM_NONE, WC_MAIN_WINDOW, 0);
@ -105,7 +105,7 @@ static void * CDECL _GenerateWorld(void *arg)
SetGeneratingWorldProgress(GWP_UNMOVABLE, 1); SetGeneratingWorldProgress(GWP_UNMOVABLE, 1);
/* Make the map the height of the patch setting */ /* Make the map the height of the patch setting */
if (_game_mode != GM_MENU) FlatEmptyWorld(_patches.se_flat_world_height); if (_game_mode != GM_MENU) FlatEmptyWorld(_settings.game_creation.se_flat_world_height);
ConvertGroundTilesIntoWaterTiles(); ConvertGroundTilesIntoWaterTiles();
IncreaseGeneratingWorldProgress(GWP_UNMOVABLE); IncreaseGeneratingWorldProgress(GWP_UNMOVABLE);
@ -165,7 +165,7 @@ static void * CDECL _GenerateWorld(void *arg)
if (_network_dedicated) DEBUG(net, 0, "Map generated, starting game"); if (_network_dedicated) DEBUG(net, 0, "Map generated, starting game");
if (_patches.pause_on_newgame && _game_mode == GM_NORMAL) DoCommandP(0, 1, 0, NULL, CMD_PAUSE); if (_settings.gui.pause_on_newgame && _game_mode == GM_NORMAL) DoCommandP(0, 1, 0, NULL, CMD_PAUSE);
} catch (...) { } catch (...) {
_generating_world = false; _generating_world = false;
throw; throw;
@ -273,7 +273,7 @@ void GenerateWorld(int mode, uint size_x, uint size_y)
_current_player = OWNER_NONE; _current_player = OWNER_NONE;
/* Set the date before loading sprites as some newgrfs check it */ /* Set the date before loading sprites as some newgrfs check it */
SetDate(ConvertYMDToDate(_patches.starting_year, 0, 1)); SetDate(ConvertYMDToDate(_settings.game_creation.starting_year, 0, 1));
/* Load the right landscape stuff */ /* Load the right landscape stuff */
GfxLoadSprites(); GfxLoadSprites();

View File

@ -256,7 +256,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
{ {
this->LowerWidget(_opt_newgame.landscape + GLAND_TEMPERATE); this->LowerWidget(_opt_newgame.landscape + GLAND_TEMPERATE);
snprintf(this->edit_str_buf, sizeof(this->edit_str_buf), "%u", _patches_newgame.generation_seed); snprintf(this->edit_str_buf, sizeof(this->edit_str_buf), "%u", _settings_newgame.game_creation.generation_seed);
InitializeTextBuffer(&this->text, this->edit_str_buf, lengthof(this->edit_str_buf), 120); InitializeTextBuffer(&this->text, this->edit_str_buf, lengthof(this->edit_str_buf), 120);
this->caption = STR_NULL; this->caption = STR_NULL;
this->afilter = CS_NUMERAL; this->afilter = CS_NUMERAL;
@ -270,7 +270,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
{ {
/* You can't select smoothness if not terragenesis */ /* You can't select smoothness if not terragenesis */
if (mode == GLWP_GENERATE) { if (mode == GLWP_GENERATE) {
this->SetWidgetDisabledState(GLAND_SMOOTHNESS_PULLDOWN, _patches_newgame.land_generator == 0); this->SetWidgetDisabledState(GLAND_SMOOTHNESS_PULLDOWN, _settings_newgame.game_creation.land_generator == 0);
} }
/* Disable snowline if not hilly */ /* Disable snowline if not hilly */
this->SetWidgetDisabledState(GLAND_SNOW_LEVEL_TEXT, _opt_newgame.landscape != LT_ARCTIC); this->SetWidgetDisabledState(GLAND_SNOW_LEVEL_TEXT, _opt_newgame.landscape != LT_ARCTIC);
@ -279,10 +279,10 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
this->SetWidgetDisabledState(GLAND_INDUSTRY_PULLDOWN, _game_mode == GM_EDITOR); this->SetWidgetDisabledState(GLAND_INDUSTRY_PULLDOWN, _game_mode == GM_EDITOR);
this->SetWidgetDisabledState(GLAND_TREE_PULLDOWN, _game_mode == GM_EDITOR); this->SetWidgetDisabledState(GLAND_TREE_PULLDOWN, _game_mode == GM_EDITOR);
this->SetWidgetDisabledState(GLAND_START_DATE_DOWN, _patches_newgame.starting_year <= MIN_YEAR); this->SetWidgetDisabledState(GLAND_START_DATE_DOWN, _settings_newgame.game_creation.starting_year <= MIN_YEAR);
this->SetWidgetDisabledState(GLAND_START_DATE_UP, _patches_newgame.starting_year >= MAX_YEAR); this->SetWidgetDisabledState(GLAND_START_DATE_UP, _settings_newgame.game_creation.starting_year >= MAX_YEAR);
this->SetWidgetDisabledState(GLAND_SNOW_LEVEL_DOWN, _patches_newgame.snow_line_height <= 2 || _opt_newgame.landscape != LT_ARCTIC); this->SetWidgetDisabledState(GLAND_SNOW_LEVEL_DOWN, _settings_newgame.game_creation.snow_line_height <= 2 || _opt_newgame.landscape != LT_ARCTIC);
this->SetWidgetDisabledState(GLAND_SNOW_LEVEL_UP, _patches_newgame.snow_line_height >= MAX_SNOWLINE_HEIGHT || _opt_newgame.landscape != LT_ARCTIC); this->SetWidgetDisabledState(GLAND_SNOW_LEVEL_UP, _settings_newgame.game_creation.snow_line_height >= MAX_SNOWLINE_HEIGHT || _opt_newgame.landscape != LT_ARCTIC);
this->SetWidgetLoweredState(GLAND_TEMPERATE, _opt_newgame.landscape == LT_TEMPERATE); this->SetWidgetLoweredState(GLAND_TEMPERATE, _opt_newgame.landscape == LT_TEMPERATE);
this->SetWidgetLoweredState(GLAND_ARCTIC, _opt_newgame.landscape == LT_ARCTIC); this->SetWidgetLoweredState(GLAND_ARCTIC, _opt_newgame.landscape == LT_ARCTIC);
@ -298,21 +298,21 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
} }
if (mode == GLWP_GENERATE) { if (mode == GLWP_GENERATE) {
this->widget[GLAND_LANDSCAPE_PULLDOWN].data = _landscape[_patches_newgame.land_generator]; this->widget[GLAND_LANDSCAPE_PULLDOWN].data = _landscape[_settings_newgame.game_creation.land_generator];
this->widget[GLAND_TREE_PULLDOWN].data = _tree_placer[_patches_newgame.tree_placer]; this->widget[GLAND_TREE_PULLDOWN].data = _tree_placer[_settings_newgame.game_creation.tree_placer];
this->widget[GLAND_TERRAIN_PULLDOWN].data = _elevations[_opt_newgame.diff.terrain_type]; this->widget[GLAND_TERRAIN_PULLDOWN].data = _elevations[_opt_newgame.diff.terrain_type];
this->widget[GLAND_WATER_PULLDOWN].data = _sea_lakes[_opt_newgame.diff.quantity_sea_lakes]; this->widget[GLAND_WATER_PULLDOWN].data = _sea_lakes[_opt_newgame.diff.quantity_sea_lakes];
this->widget[GLAND_SMOOTHNESS_PULLDOWN].data = _smoothness[_patches_newgame.tgen_smoothness]; this->widget[GLAND_SMOOTHNESS_PULLDOWN].data = _smoothness[_settings_newgame.game_creation.tgen_smoothness];
} else { } else {
this->widget[GLAND_TREE_PULLDOWN].data = _tree_placer[_patches_newgame.tree_placer]; this->widget[GLAND_TREE_PULLDOWN].data = _tree_placer[_settings_newgame.game_creation.tree_placer];
this->widget[GLAND_HEIGHTMAP_ROTATION_PULLDOWN].data = _rotation[_patches_newgame.heightmap_rotation]; this->widget[GLAND_HEIGHTMAP_ROTATION_PULLDOWN].data = _rotation[_settings_newgame.game_creation.heightmap_rotation];
} }
/* Set parameters for widget text that requires them. */ /* Set parameters for widget text that requires them. */
SetDParam(0, ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); // GLAND_START_DATE_TEXT SetDParam(0, ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1)); // GLAND_START_DATE_TEXT
SetDParam(1, 1 << _patches_newgame.map_x); // GLAND_MAPSIZE_X_PULLDOWN SetDParam(1, 1 << _settings_newgame.game_creation.map_x); // GLAND_MAPSIZE_X_PULLDOWN
SetDParam(2, 1 << _patches_newgame.map_y); // GLAND_MAPSIZE_Y_PULLDOWN SetDParam(2, 1 << _settings_newgame.game_creation.map_y); // GLAND_MAPSIZE_Y_PULLDOWN
SetDParam(3, _patches_newgame.snow_line_height); // GLAND_SNOW_LEVEL_TEXT SetDParam(3, _settings_newgame.game_creation.snow_line_height); // GLAND_SNOW_LEVEL_TEXT
this->DrawWidgets(); this->DrawWidgets();
@ -321,7 +321,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
if (mode != GLWP_GENERATE) { if (mode != GLWP_GENERATE) {
char buffer[512]; char buffer[512];
if (_patches_newgame.heightmap_rotation == HM_CLOCKWISE) { if (_settings_newgame.game_creation.heightmap_rotation == HM_CLOCKWISE) {
SetDParam(0, this->y); SetDParam(0, this->y);
SetDParam(1, this->x); SetDParam(1, this->x);
} else { } else {
@ -351,11 +351,11 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
break; break;
case GLAND_MAPSIZE_X_PULLDOWN: // Mapsize X case GLAND_MAPSIZE_X_PULLDOWN: // Mapsize X
ShowDropDownList(this, BuildMapsizeDropDown(), _patches_newgame.map_x, GLAND_MAPSIZE_X_PULLDOWN); ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_x, GLAND_MAPSIZE_X_PULLDOWN);
break; break;
case GLAND_MAPSIZE_Y_PULLDOWN: // Mapsize Y case GLAND_MAPSIZE_Y_PULLDOWN: // Mapsize Y
ShowDropDownList(this, BuildMapsizeDropDown(), _patches_newgame.map_y, GLAND_MAPSIZE_Y_PULLDOWN); ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_y, GLAND_MAPSIZE_Y_PULLDOWN);
break; break;
case GLAND_TOWN_PULLDOWN: // Number of towns case GLAND_TOWN_PULLDOWN: // Number of towns
@ -367,8 +367,8 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
break; break;
case GLAND_RANDOM_BUTTON: // Random seed case GLAND_RANDOM_BUTTON: // Random seed
_patches_newgame.generation_seed = InteractiveRandom(); _settings_newgame.game_creation.generation_seed = InteractiveRandom();
snprintf(this->edit_str_buf, lengthof(this->edit_str_buf), "%u", _patches_newgame.generation_seed); snprintf(this->edit_str_buf, lengthof(this->edit_str_buf), "%u", _settings_newgame.game_creation.generation_seed);
UpdateTextBufferSize(&this->text); UpdateTextBufferSize(&this->text);
this->SetDirty(); this->SetDirty();
break; break;
@ -380,17 +380,17 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
case GLAND_GENERATE_BUTTON: // Generate case GLAND_GENERATE_BUTTON: // Generate
UpdatePatches(); UpdatePatches();
if (_patches.town_layout == TL_NO_ROADS) { if (_settings.economy.town_layout == TL_NO_ROADS) {
ShowQuery( ShowQuery(
STR_TOWN_LAYOUT_WARNING_CAPTION, STR_TOWN_LAYOUT_WARNING_CAPTION,
STR_TOWN_LAYOUT_WARNING_MESSAGE, STR_TOWN_LAYOUT_WARNING_MESSAGE,
this, this,
LandscapeGenerationCallback); LandscapeGenerationCallback);
} else if (mode == GLWP_HEIGHTMAP && } else if (mode == GLWP_HEIGHTMAP &&
(this->x * 2 < (1U << _patches_newgame.map_x) || (this->x * 2 < (1U << _settings_newgame.game_creation.map_x) ||
this->x / 2 > (1U << _patches_newgame.map_x) || this->x / 2 > (1U << _settings_newgame.game_creation.map_x) ||
this->y * 2 < (1U << _patches_newgame.map_y) || this->y * 2 < (1U << _settings_newgame.game_creation.map_y) ||
this->y / 2 > (1U << _patches_newgame.map_y))) { this->y / 2 > (1U << _settings_newgame.game_creation.map_y))) {
ShowQuery( ShowQuery(
STR_HEIGHTMAP_SCALE_WARNING_CAPTION, STR_HEIGHTMAP_SCALE_WARNING_CAPTION,
STR_HEIGHTMAP_SCALE_WARNING_MESSAGE, STR_HEIGHTMAP_SCALE_WARNING_MESSAGE,
@ -408,14 +408,14 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
this->HandleButtonClick(widget); this->HandleButtonClick(widget);
this->SetDirty(); this->SetDirty();
_patches_newgame.starting_year = Clamp(_patches_newgame.starting_year + widget - GLAND_START_DATE_TEXT, MIN_YEAR, MAX_YEAR); _settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year + widget - GLAND_START_DATE_TEXT, MIN_YEAR, MAX_YEAR);
} }
_left_button_clicked = false; _left_button_clicked = false;
break; break;
case GLAND_START_DATE_TEXT: // Year text case GLAND_START_DATE_TEXT: // Year text
this->widget_id = GLAND_START_DATE_TEXT; this->widget_id = GLAND_START_DATE_TEXT;
SetDParam(0, _patches_newgame.starting_year); SetDParam(0, _settings_newgame.game_creation.starting_year);
ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_START_DATE_QUERY_CAPT, 8, 100, this, CS_NUMERAL); ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_START_DATE_QUERY_CAPT, 8, 100, this, CS_NUMERAL);
break; break;
@ -426,27 +426,27 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
this->HandleButtonClick(widget); this->HandleButtonClick(widget);
this->SetDirty(); this->SetDirty();
_patches_newgame.snow_line_height = Clamp(_patches_newgame.snow_line_height + widget - GLAND_SNOW_LEVEL_TEXT, 2, MAX_SNOWLINE_HEIGHT); _settings_newgame.game_creation.snow_line_height = Clamp(_settings_newgame.game_creation.snow_line_height + widget - GLAND_SNOW_LEVEL_TEXT, 2, MAX_SNOWLINE_HEIGHT);
} }
_left_button_clicked = false; _left_button_clicked = false;
break; break;
case GLAND_SNOW_LEVEL_TEXT: // Snow line text case GLAND_SNOW_LEVEL_TEXT: // Snow line text
this->widget_id = GLAND_SNOW_LEVEL_TEXT; this->widget_id = GLAND_SNOW_LEVEL_TEXT;
SetDParam(0, _patches_newgame.snow_line_height); SetDParam(0, _settings_newgame.game_creation.snow_line_height);
ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_SNOW_LINE_QUERY_CAPT, 3, 100, this, CS_NUMERAL); ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_SNOW_LINE_QUERY_CAPT, 3, 100, this, CS_NUMERAL);
break; break;
case GLAND_TREE_PULLDOWN: // Tree placer case GLAND_TREE_PULLDOWN: // Tree placer
ShowDropDownMenu(this, _tree_placer, _patches_newgame.tree_placer, GLAND_TREE_PULLDOWN, 0, 0); ShowDropDownMenu(this, _tree_placer, _settings_newgame.game_creation.tree_placer, GLAND_TREE_PULLDOWN, 0, 0);
break; break;
case GLAND_LANDSCAPE_PULLDOWN: // Landscape generator OR Heightmap rotation case GLAND_LANDSCAPE_PULLDOWN: // Landscape generator OR Heightmap rotation
/* case GLAND_HEIGHTMAP_ROTATION_TEXT: case GLAND_HEIGHTMAP_ROTATION_PULLDOWN:*/ /* case GLAND_HEIGHTMAP_ROTATION_TEXT: case GLAND_HEIGHTMAP_ROTATION_PULLDOWN:*/
if (mode == GLWP_HEIGHTMAP) { if (mode == GLWP_HEIGHTMAP) {
ShowDropDownMenu(this, _rotation, _patches_newgame.heightmap_rotation, GLAND_HEIGHTMAP_ROTATION_PULLDOWN, 0, 0); ShowDropDownMenu(this, _rotation, _settings_newgame.game_creation.heightmap_rotation, GLAND_HEIGHTMAP_ROTATION_PULLDOWN, 0, 0);
} else { } else {
ShowDropDownMenu(this, _landscape, _patches_newgame.land_generator, GLAND_LANDSCAPE_PULLDOWN, 0, 0); ShowDropDownMenu(this, _landscape, _settings_newgame.game_creation.land_generator, GLAND_LANDSCAPE_PULLDOWN, 0, 0);
} }
break; break;
@ -459,7 +459,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
break; break;
case GLAND_SMOOTHNESS_PULLDOWN: // Map smoothness case GLAND_SMOOTHNESS_PULLDOWN: // Map smoothness
ShowDropDownMenu(this, _smoothness, _patches_newgame.tgen_smoothness, GLAND_SMOOTHNESS_PULLDOWN, 0, 0); ShowDropDownMenu(this, _smoothness, _settings_newgame.game_creation.tgen_smoothness, GLAND_SMOOTHNESS_PULLDOWN, 0, 0);
break; break;
} }
} }
@ -478,17 +478,17 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
* (use random seed) it should not be possible to be * (use random seed) it should not be possible to be
* entered into the input field; the generate seed * entered into the input field; the generate seed
* button can be used instead. */ * button can be used instead. */
_patches_newgame.generation_seed = minu(strtoul(this->edit_str_buf, NULL, sizeof(this->edit_str_buf) - 1), MAX_UVALUE(uint32) - 1); _settings_newgame.game_creation.generation_seed = minu(strtoul(this->edit_str_buf, NULL, sizeof(this->edit_str_buf) - 1), MAX_UVALUE(uint32) - 1);
return state; return state;
} }
virtual void OnDropdownSelect(int widget, int index) virtual void OnDropdownSelect(int widget, int index)
{ {
switch (widget) { switch (widget) {
case GLAND_MAPSIZE_X_PULLDOWN: _patches_newgame.map_x = index; break; case GLAND_MAPSIZE_X_PULLDOWN: _settings_newgame.game_creation.map_x = index; break;
case GLAND_MAPSIZE_Y_PULLDOWN: _patches_newgame.map_y = index; break; case GLAND_MAPSIZE_Y_PULLDOWN: _settings_newgame.game_creation.map_y = index; break;
case GLAND_TREE_PULLDOWN: _patches_newgame.tree_placer = index; break; case GLAND_TREE_PULLDOWN: _settings_newgame.game_creation.tree_placer = index; break;
case GLAND_SMOOTHNESS_PULLDOWN: _patches_newgame.tgen_smoothness = index; break; case GLAND_SMOOTHNESS_PULLDOWN: _settings_newgame.game_creation.tgen_smoothness = index; break;
case GLAND_TOWN_PULLDOWN: case GLAND_TOWN_PULLDOWN:
_opt_newgame.diff.number_towns = index; _opt_newgame.diff.number_towns = index;
@ -505,9 +505,9 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
case GLAND_LANDSCAPE_PULLDOWN: case GLAND_LANDSCAPE_PULLDOWN:
/* case GLAND_HEIGHTMAP_PULLDOWN: */ /* case GLAND_HEIGHTMAP_PULLDOWN: */
if (mode == GLWP_HEIGHTMAP) { if (mode == GLWP_HEIGHTMAP) {
_patches_newgame.heightmap_rotation = index; _settings_newgame.game_creation.heightmap_rotation = index;
} else { } else {
_patches_newgame.land_generator = index; _settings_newgame.game_creation.land_generator = index;
} }
break; break;
@ -534,12 +534,12 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
switch (this->widget_id) { switch (this->widget_id) {
case GLAND_START_DATE_TEXT: case GLAND_START_DATE_TEXT:
this->InvalidateWidget(GLAND_START_DATE_TEXT); this->InvalidateWidget(GLAND_START_DATE_TEXT);
_patches_newgame.starting_year = Clamp(value, MIN_YEAR, MAX_YEAR); _settings_newgame.game_creation.starting_year = Clamp(value, MIN_YEAR, MAX_YEAR);
break; break;
case GLAND_SNOW_LEVEL_TEXT: case GLAND_SNOW_LEVEL_TEXT:
this->InvalidateWidget(GLAND_SNOW_LEVEL_TEXT); this->InvalidateWidget(GLAND_SNOW_LEVEL_TEXT);
_patches_newgame.snow_line_height = Clamp(value, 2, MAX_SNOWLINE_HEIGHT); _settings_newgame.game_creation.snow_line_height = Clamp(value, 2, MAX_SNOWLINE_HEIGHT);
break; break;
} }
@ -570,7 +570,7 @@ static void _ShowGenerateLandscape(glwp_modes mode)
DeleteWindowByClass(WC_GENERATE_LANDSCAPE); DeleteWindowByClass(WC_GENERATE_LANDSCAPE);
/* Always give a new seed if not editor */ /* Always give a new seed if not editor */
if (_game_mode != GM_EDITOR) _patches_newgame.generation_seed = InteractiveRandom(); if (_game_mode != GM_EDITOR) _settings_newgame.game_creation.generation_seed = InteractiveRandom();
if (mode == GLWP_HEIGHTMAP) { if (mode == GLWP_HEIGHTMAP) {
/* If the function returns negative, it means there was a problem loading the heightmap */ /* If the function returns negative, it means there was a problem loading the heightmap */
@ -600,8 +600,8 @@ void ShowHeightmapLoad()
void StartScenarioEditor() void StartScenarioEditor()
{ {
if (_patches_newgame.town_layout == TL_NO_ROADS) { if (_settings_newgame.economy.town_layout == TL_NO_ROADS) {
_patches_newgame.town_layout = TL_ORIGINAL; _settings_newgame.economy.town_layout = TL_ORIGINAL;
} }
StartGeneratingLandscape(GLWP_SCENARIO); StartGeneratingLandscape(GLWP_SCENARIO);
@ -610,7 +610,7 @@ void StartScenarioEditor()
void StartNewGameWithoutGUI(uint seed) void StartNewGameWithoutGUI(uint seed)
{ {
/* GenerateWorld takes care of the possible GENERATE_NEW_SEED value in 'seed' */ /* GenerateWorld takes care of the possible GENERATE_NEW_SEED value in 'seed' */
_patches_newgame.generation_seed = seed; _settings_newgame.game_creation.generation_seed = seed;
StartGeneratingLandscape(GLWP_GENERATE); StartGeneratingLandscape(GLWP_GENERATE);
} }
@ -649,10 +649,10 @@ struct CreateScenarioWindow : public Window
virtual void OnPaint() virtual void OnPaint()
{ {
this->SetWidgetDisabledState(CSCEN_START_DATE_DOWN, _patches_newgame.starting_year <= MIN_YEAR); this->SetWidgetDisabledState(CSCEN_START_DATE_DOWN, _settings_newgame.game_creation.starting_year <= MIN_YEAR);
this->SetWidgetDisabledState(CSCEN_START_DATE_UP, _patches_newgame.starting_year >= MAX_YEAR); this->SetWidgetDisabledState(CSCEN_START_DATE_UP, _settings_newgame.game_creation.starting_year >= MAX_YEAR);
this->SetWidgetDisabledState(CSCEN_FLAT_LAND_HEIGHT_DOWN, _patches_newgame.se_flat_world_height <= 0); this->SetWidgetDisabledState(CSCEN_FLAT_LAND_HEIGHT_DOWN, _settings_newgame.game_creation.se_flat_world_height <= 0);
this->SetWidgetDisabledState(CSCEN_FLAT_LAND_HEIGHT_UP, _patches_newgame.se_flat_world_height >= MAX_TILE_HEIGHT); this->SetWidgetDisabledState(CSCEN_FLAT_LAND_HEIGHT_UP, _settings_newgame.game_creation.se_flat_world_height >= MAX_TILE_HEIGHT);
this->SetWidgetLoweredState(CSCEN_TEMPERATE, _opt_newgame.landscape == LT_TEMPERATE); this->SetWidgetLoweredState(CSCEN_TEMPERATE, _opt_newgame.landscape == LT_TEMPERATE);
this->SetWidgetLoweredState(CSCEN_ARCTIC, _opt_newgame.landscape == LT_ARCTIC); this->SetWidgetLoweredState(CSCEN_ARCTIC, _opt_newgame.landscape == LT_ARCTIC);
@ -660,10 +660,10 @@ struct CreateScenarioWindow : public Window
this->SetWidgetLoweredState(CSCEN_TOYLAND, _opt_newgame.landscape == LT_TOYLAND); this->SetWidgetLoweredState(CSCEN_TOYLAND, _opt_newgame.landscape == LT_TOYLAND);
/* Set parameters for widget text that requires them */ /* Set parameters for widget text that requires them */
SetDParam(0, ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); // CSCEN_START_DATE_TEXT SetDParam(0, ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1)); // CSCEN_START_DATE_TEXT
SetDParam(1, 1 << _patches_newgame.map_x); // CSCEN_MAPSIZE_X_PULLDOWN SetDParam(1, 1 << _settings_newgame.game_creation.map_x); // CSCEN_MAPSIZE_X_PULLDOWN
SetDParam(2, 1 << _patches_newgame.map_y); // CSCEN_MAPSIZE_Y_PULLDOWN SetDParam(2, 1 << _settings_newgame.game_creation.map_y); // CSCEN_MAPSIZE_Y_PULLDOWN
SetDParam(3, _patches_newgame.se_flat_world_height); // CSCEN_FLAT_LAND_HEIGHT_TEXT SetDParam(3, _settings_newgame.game_creation.se_flat_world_height); // CSCEN_FLAT_LAND_HEIGHT_TEXT
this->DrawWidgets(); this->DrawWidgets();
} }
@ -680,11 +680,11 @@ struct CreateScenarioWindow : public Window
break; break;
case CSCEN_MAPSIZE_X_PULLDOWN: // Mapsize X case CSCEN_MAPSIZE_X_PULLDOWN: // Mapsize X
ShowDropDownList(this, BuildMapsizeDropDown(), _patches_newgame.map_x, CSCEN_MAPSIZE_X_PULLDOWN); ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_x, CSCEN_MAPSIZE_X_PULLDOWN);
break; break;
case CSCEN_MAPSIZE_Y_PULLDOWN: // Mapsize Y case CSCEN_MAPSIZE_Y_PULLDOWN: // Mapsize Y
ShowDropDownList(this, BuildMapsizeDropDown(), _patches_newgame.map_y, CSCEN_MAPSIZE_Y_PULLDOWN); ShowDropDownList(this, BuildMapsizeDropDown(), _settings_newgame.game_creation.map_y, CSCEN_MAPSIZE_Y_PULLDOWN);
break; break;
case CSCEN_EMPTY_WORLD: // Empty world / flat world case CSCEN_EMPTY_WORLD: // Empty world / flat world
@ -702,14 +702,14 @@ struct CreateScenarioWindow : public Window
this->HandleButtonClick(widget); this->HandleButtonClick(widget);
this->SetDirty(); this->SetDirty();
_patches_newgame.starting_year = Clamp(_patches_newgame.starting_year + widget - CSCEN_START_DATE_TEXT, MIN_YEAR, MAX_YEAR); _settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year + widget - CSCEN_START_DATE_TEXT, MIN_YEAR, MAX_YEAR);
} }
_left_button_clicked = false; _left_button_clicked = false;
break; break;
case CSCEN_START_DATE_TEXT: // Year text case CSCEN_START_DATE_TEXT: // Year text
this->widget_id = CSCEN_START_DATE_TEXT; this->widget_id = CSCEN_START_DATE_TEXT;
SetDParam(0, _patches_newgame.starting_year); SetDParam(0, _settings_newgame.game_creation.starting_year);
ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_START_DATE_QUERY_CAPT, 8, 100, this, CS_NUMERAL); ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_START_DATE_QUERY_CAPT, 8, 100, this, CS_NUMERAL);
break; break;
@ -720,14 +720,14 @@ struct CreateScenarioWindow : public Window
this->HandleButtonClick(widget); this->HandleButtonClick(widget);
this->SetDirty(); this->SetDirty();
_patches_newgame.se_flat_world_height = Clamp(_patches_newgame.se_flat_world_height + widget - CSCEN_FLAT_LAND_HEIGHT_TEXT, 0, MAX_TILE_HEIGHT); _settings_newgame.game_creation.se_flat_world_height = Clamp(_settings_newgame.game_creation.se_flat_world_height + widget - CSCEN_FLAT_LAND_HEIGHT_TEXT, 0, MAX_TILE_HEIGHT);
} }
_left_button_clicked = false; _left_button_clicked = false;
break; break;
case CSCEN_FLAT_LAND_HEIGHT_TEXT: // Height level text case CSCEN_FLAT_LAND_HEIGHT_TEXT: // Height level text
this->widget_id = CSCEN_FLAT_LAND_HEIGHT_TEXT; this->widget_id = CSCEN_FLAT_LAND_HEIGHT_TEXT;
SetDParam(0, _patches_newgame.se_flat_world_height); SetDParam(0, _settings_newgame.game_creation.se_flat_world_height);
ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_FLAT_WORLD_HEIGHT_QUERY_CAPT, 3, 100, this, CS_NUMERAL); ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_FLAT_WORLD_HEIGHT_QUERY_CAPT, 3, 100, this, CS_NUMERAL);
break; break;
} }
@ -736,8 +736,8 @@ struct CreateScenarioWindow : public Window
virtual void OnDropdownSelect(int widget, int index) virtual void OnDropdownSelect(int widget, int index)
{ {
switch (widget) { switch (widget) {
case CSCEN_MAPSIZE_X_PULLDOWN: _patches_newgame.map_x = index; break; case CSCEN_MAPSIZE_X_PULLDOWN: _settings_newgame.game_creation.map_x = index; break;
case CSCEN_MAPSIZE_Y_PULLDOWN: _patches_newgame.map_y = index; break; case CSCEN_MAPSIZE_Y_PULLDOWN: _settings_newgame.game_creation.map_y = index; break;
} }
this->SetDirty(); this->SetDirty();
} }
@ -750,12 +750,12 @@ struct CreateScenarioWindow : public Window
switch (this->widget_id) { switch (this->widget_id) {
case CSCEN_START_DATE_TEXT: case CSCEN_START_DATE_TEXT:
this->InvalidateWidget(CSCEN_START_DATE_TEXT); this->InvalidateWidget(CSCEN_START_DATE_TEXT);
_patches_newgame.starting_year = Clamp(value, MIN_YEAR, MAX_YEAR); _settings_newgame.game_creation.starting_year = Clamp(value, MIN_YEAR, MAX_YEAR);
break; break;
case CSCEN_FLAT_LAND_HEIGHT_TEXT: case CSCEN_FLAT_LAND_HEIGHT_TEXT:
this->InvalidateWidget(CSCEN_FLAT_LAND_HEIGHT_TEXT); this->InvalidateWidget(CSCEN_FLAT_LAND_HEIGHT_TEXT);
_patches_newgame.se_flat_world_height = Clamp(value, 0, MAX_TILE_HEIGHT); _settings_newgame.game_creation.se_flat_world_height = Clamp(value, 0, MAX_TILE_HEIGHT);
break; break;
} }

View File

@ -297,7 +297,7 @@ static void GrayscaleToMapHeights(uint img_width, uint img_height, byte *map)
TileIndex tile; TileIndex tile;
/* Get map size and calculate scale and padding values */ /* Get map size and calculate scale and padding values */
switch (_patches.heightmap_rotation) { switch (_settings.game_creation.heightmap_rotation) {
default: NOT_REACHED(); default: NOT_REACHED();
case HM_COUNTER_CLOCKWISE: case HM_COUNTER_CLOCKWISE:
width = MapSizeX(); width = MapSizeX();
@ -322,7 +322,7 @@ static void GrayscaleToMapHeights(uint img_width, uint img_height, byte *map)
/* Form the landscape */ /* Form the landscape */
for (row = 0; row < height - 1; row++) { for (row = 0; row < height - 1; row++) {
for (col = 0; col < width - 1; col++) { for (col = 0; col < width - 1; col++) {
switch (_patches.heightmap_rotation) { switch (_settings.game_creation.heightmap_rotation) {
default: NOT_REACHED(); default: NOT_REACHED();
case HM_COUNTER_CLOCKWISE: tile = TileXY(col, row); break; case HM_COUNTER_CLOCKWISE: tile = TileXY(col, row); break;
case HM_CLOCKWISE: tile = TileXY(row, col); break; case HM_CLOCKWISE: tile = TileXY(row, col); break;
@ -337,7 +337,7 @@ static void GrayscaleToMapHeights(uint img_width, uint img_height, byte *map)
/* Use nearest neighbor resizing to scale map data. /* Use nearest neighbor resizing to scale map data.
* We rotate the map 45 degrees (counter)clockwise */ * We rotate the map 45 degrees (counter)clockwise */
img_row = (((row - row_pad) * num_div) / img_scale); img_row = (((row - row_pad) * num_div) / img_scale);
switch (_patches.heightmap_rotation) { switch (_settings.game_creation.heightmap_rotation) {
default: NOT_REACHED(); default: NOT_REACHED();
case HM_COUNTER_CLOCKWISE: case HM_COUNTER_CLOCKWISE:
img_col = (((width - 1 - col - col_pad) * num_div) / img_scale); img_col = (((width - 1 - col - col_pad) * num_div) / img_scale);

View File

@ -1075,7 +1075,7 @@ static bool CheckNewIndustry_Forest(TileIndex tile)
static bool CheckNewIndustry_OilRefinery(TileIndex tile) static bool CheckNewIndustry_OilRefinery(TileIndex tile)
{ {
if (_game_mode == GM_EDITOR) return true; if (_game_mode == GM_EDITOR) return true;
if (DistanceFromEdge(TILE_ADDXY(tile, 1, 1)) < _patches.oil_refinery_limit) return true; if (DistanceFromEdge(TILE_ADDXY(tile, 1, 1)) < _settings.game_creation.oil_refinery_limit) return true;
_error_message = STR_483B_CAN_ONLY_BE_POSITIONED; _error_message = STR_483B_CAN_ONLY_BE_POSITIONED;
return false; return false;
@ -1087,7 +1087,7 @@ static bool CheckNewIndustry_OilRig(TileIndex tile)
{ {
if (_game_mode == GM_EDITOR && _ignore_restrictions) return true; if (_game_mode == GM_EDITOR && _ignore_restrictions) return true;
if (TileHeight(tile) == 0 && if (TileHeight(tile) == 0 &&
DistanceFromEdge(TILE_ADDXY(tile, 1, 1)) < _patches.oil_refinery_limit) return true; DistanceFromEdge(TILE_ADDXY(tile, 1, 1)) < _settings.game_creation.oil_refinery_limit) return true;
_error_message = STR_483B_CAN_ONLY_BE_POSITIONED; _error_message = STR_483B_CAN_ONLY_BE_POSITIONED;
return false; return false;
@ -1171,7 +1171,7 @@ static const Town *CheckMultipleIndustryInTown(TileIndex tile, int type)
t = ClosestTownFromTile(tile, (uint)-1); t = ClosestTownFromTile(tile, (uint)-1);
if (_patches.multiple_industry_per_town) return t; if (_settings.economy.multiple_industry_per_town) return t;
FOR_ALL_INDUSTRIES(i) { FOR_ALL_INDUSTRIES(i) {
if (i->type == (byte)type && if (i->type == (byte)type &&
@ -1257,7 +1257,7 @@ static bool CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTileTable
/* It is almost impossible to have a fully flat land in TG, so what we /* 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 * do is that we check if we can make the land flat later on. See
* CheckIfCanLevelIndustryPlatform(). */ * CheckIfCanLevelIndustryPlatform(). */
return !refused_slope || (_patches.land_generator == LG_TERRAGENESIS && _generating_world && !custom_shape && !_ignore_restrictions); return !refused_slope || (_settings.game_creation.land_generator == LG_TERRAGENESIS && _generating_world && !custom_shape && !_ignore_restrictions);
} }
static bool CheckIfIndustryIsAllowed(TileIndex tile, int type, const Town *t) static bool CheckIfIndustryIsAllowed(TileIndex tile, int type, const Town *t)
@ -1387,7 +1387,7 @@ static bool CheckIfFarEnoughFromIndustry(TileIndex tile, int type)
const IndustrySpec *indspec = GetIndustrySpec(type); const IndustrySpec *indspec = GetIndustrySpec(type);
const Industry *i; const Industry *i;
if (_patches.same_industry_close && indspec->IsRawIndustry()) if (_settings.economy.same_industry_close && indspec->IsRawIndustry())
/* Allow primary industries to be placed close to any other industry */ /* Allow primary industries to be placed close to any other industry */
return true; return true;
@ -1401,8 +1401,8 @@ static bool CheckIfFarEnoughFromIndustry(TileIndex tile, int type)
indspec->accepts_cargo[0] == i->accepts_cargo[0] && ( indspec->accepts_cargo[0] == i->accepts_cargo[0] && (
/* at least one of those options must be true */ /* at least one of those options must be true */
_game_mode != GM_EDITOR || // editor must not be stopped _game_mode != GM_EDITOR || // editor must not be stopped
!_patches.same_industry_close || !_settings.economy.same_industry_close ||
!_patches.multiple_industry_per_town)) { !_settings.economy.multiple_industry_per_town)) {
_error_message = STR_INDUSTRY_TOO_CLOSE; _error_message = STR_INDUSTRY_TOO_CLOSE;
return false; return false;
} }
@ -1449,7 +1449,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const Ind
i->production_rate[1] = indspec->production_rate[1]; i->production_rate[1] = indspec->production_rate[1];
/* don't use smooth economy for industries using production related callbacks */ /* don't use smooth economy for industries using production related callbacks */
if (_patches.smooth_economy && if (_settings.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_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 !(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(TileIndex tile, IndustryType type, uint
if (!_check_new_industry_procs[indspec->check_proc](tile)) return NULL; if (!_check_new_industry_procs[indspec->check_proc](tile)) return NULL;
} }
if (!custom_shape_check && _patches.land_generator == LG_TERRAGENESIS && _generating_world && !_ignore_restrictions && !CheckIfCanLevelIndustryPlatform(tile, 0, it, type)) 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 (!CheckIfFarEnoughFromIndustry(tile, type)) return NULL; if (!CheckIfFarEnoughFromIndustry(tile, type)) return NULL;
const Town *t = CheckMultipleIndustryInTown(tile, type); const Town *t = CheckMultipleIndustryInTown(tile, type);
@ -1621,11 +1621,11 @@ CommandCost CmdBuildIndustry(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
/* If the patch for raw-material industries is not on, you cannot build raw-material industries. /* 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) */ * Raw material industries are industries that do not accept cargo (at least for now) */
if (_game_mode != GM_EDITOR && _patches.raw_industry_construction == 0 && indspec->IsRawIndustry()) { if (_game_mode != GM_EDITOR && _settings.construction.raw_industry_construction == 0 && indspec->IsRawIndustry()) {
return CMD_ERROR; return CMD_ERROR;
} }
if (_game_mode != GM_EDITOR && _patches.raw_industry_construction == 2 && indspec->IsRawIndustry()) { if (_game_mode != GM_EDITOR && _settings.construction.raw_industry_construction == 2 && indspec->IsRawIndustry()) {
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
/* Prospecting has a chance to fail, however we cannot guarantee that something can /* 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 * be built on the map, so the chance gets lower when the map is fuller, but there
@ -2031,7 +2031,7 @@ static void ChangeIndustryProduction(Industry *i, bool monthly)
bool standard = true; bool standard = true;
bool suppress_message = false; bool suppress_message = false;
/* don't use smooth economy for industries using production related callbacks */ /* don't use smooth economy for industries using production related callbacks */
bool smooth_economy = _patches.smooth_economy && bool smooth_economy = _settings.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_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 !(HasBit(indspec->callback_flags, CBM_IND_MONTHLYPROD_CHANGE) || HasBit(indspec->callback_flags, CBM_IND_PRODUCTION_CHANGE)); // production change callbacks
byte div = 0; byte div = 0;
@ -2257,7 +2257,7 @@ bool IndustrySpec::IsRawIndustry() const
Money IndustrySpec::GetConstructionCost() const Money IndustrySpec::GetConstructionCost() const
{ {
return (_price.build_industry * return (_price.build_industry *
(_patches.raw_industry_construction == 1 && this->IsRawIndustry() ? (_settings.construction.raw_industry_construction == 1 && this->IsRawIndustry() ?
this->raw_industry_cost_multiplier : this->raw_industry_cost_multiplier :
this->cost_multiplier this->cost_multiplier
)) >> 8; )) >> 8;

View File

@ -131,7 +131,7 @@ class BuildIndustryWindow : public Window {
/* Rule is that editor mode loads all industries. /* Rule is that editor mode loads all industries.
* In game mode, all non raw industries are loaded too * In game mode, all non raw industries are loaded too
* and raw ones are loaded only when setting allows it */ * and raw ones are loaded only when setting allows it */
if (_game_mode != GM_EDITOR && indsp->IsRawIndustry() && _patches.raw_industry_construction == 0) { if (_game_mode != GM_EDITOR && indsp->IsRawIndustry() && _settings.construction.raw_industry_construction == 0) {
/* Unselect if the industry is no longer in the list */ /* Unselect if the industry is no longer in the list */
if (this->selected_type == ind) this->selected_index = -1; if (this->selected_type == ind) this->selected_index = -1;
continue; continue;
@ -198,7 +198,7 @@ public:
if (indsp == NULL) this->enabled[this->selected_index] = _opt.diff.number_industries != 0; if (indsp == NULL) this->enabled[this->selected_index] = _opt.diff.number_industries != 0;
this->widget[DPIW_FUND_WIDGET].data = STR_BUILD_NEW_INDUSTRY; this->widget[DPIW_FUND_WIDGET].data = STR_BUILD_NEW_INDUSTRY;
} else { } else {
this->widget[DPIW_FUND_WIDGET].data = (_patches.raw_industry_construction == 2 && indsp->IsRawIndustry()) ? STR_PROSPECT_NEW_INDUSTRY : STR_FUND_NEW_INDUSTRY; this->widget[DPIW_FUND_WIDGET].data = (_settings.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]); this->SetWidgetDisabledState(DPIW_FUND_WIDGET, !this->enabled[this->selected_index]);
@ -304,7 +304,7 @@ public:
this->SetDirty(); this->SetDirty();
if ((_game_mode != GM_EDITOR && _patches.raw_industry_construction == 2 && indsp != NULL && indsp->IsRawIndustry()) || if ((_game_mode != GM_EDITOR && _settings.construction.raw_industry_construction == 2 && indsp != NULL && indsp->IsRawIndustry()) ||
this->selected_type == INVALID_INDUSTRYTYPE) { this->selected_type == INVALID_INDUSTRYTYPE) {
/* Reset the button state if going to prospecting or "build many industries" */ /* Reset the button state if going to prospecting or "build many industries" */
this->RaiseButtons(); this->RaiseButtons();
@ -325,7 +325,7 @@ public:
GenerateIndustries(); GenerateIndustries();
_generating_world = false; _generating_world = false;
} }
} else if (_game_mode != GM_EDITOR && _patches.raw_industry_construction == 2 && GetIndustrySpec(this->selected_type)->IsRawIndustry()) { } else if (_game_mode != GM_EDITOR && _settings.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)); DoCommandP(0, this->selected_type, InteractiveRandom(), NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY));
this->HandleButtonClick(DPIW_FUND_WIDGET); this->HandleButtonClick(DPIW_FUND_WIDGET);
} else { } else {

View File

@ -821,7 +821,7 @@ void GenerateLandscape(byte mode)
SetGeneratingWorldProgress(GWP_LANDSCAPE, (_opt.landscape == LT_TROPIC) ? 1 + gwp_desert_amount : 1); SetGeneratingWorldProgress(GWP_LANDSCAPE, (_opt.landscape == LT_TROPIC) ? 1 + gwp_desert_amount : 1);
LoadHeightmap(_file_to_saveload.name); LoadHeightmap(_file_to_saveload.name);
IncreaseGeneratingWorldProgress(GWP_LANDSCAPE); IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
} else if (_patches.land_generator == LG_TERRAGENESIS) { } else if (_settings.game_creation.land_generator == LG_TERRAGENESIS) {
SetGeneratingWorldProgress(GWP_LANDSCAPE, (_opt.landscape == LT_TROPIC) ? 3 + gwp_desert_amount : 3); SetGeneratingWorldProgress(GWP_LANDSCAPE, (_opt.landscape == LT_TROPIC) ? 3 + gwp_desert_amount : 3);
GenerateTerrainPerlin(); GenerateTerrainPerlin();
} else { } else {

View File

@ -48,7 +48,7 @@ static int _rename_what = -1;
void CcGiveMoney(bool success, TileIndex tile, uint32 p1, uint32 p2) void CcGiveMoney(bool success, TileIndex tile, uint32 p1, uint32 p2)
{ {
#ifdef ENABLE_NETWORK #ifdef ENABLE_NETWORK
if (!success || !_patches.give_money) return; if (!success || !_settings.economy.give_money) return;
char msg[20]; char msg[20];
/* Inform the player of this action */ /* Inform the player of this action */
@ -344,7 +344,7 @@ struct MainWindow : Window
if (cio == NULL) break; if (cio == NULL) break;
/* Only players actually playing can speak to team. Eg spectators cannot */ /* Only players actually playing can speak to team. Eg spectators cannot */
if (_patches.prefer_teamchat && IsValidPlayer(cio->client_playas)) { if (_settings.gui.prefer_teamchat && IsValidPlayer(cio->client_playas)) {
const NetworkClientInfo *ci; const NetworkClientInfo *ci;
FOR_ALL_ACTIVE_CLIENT_INFOS(ci) { FOR_ALL_ACTIVE_CLIENT_INFOS(ci) {
if (ci->client_playas == cio->client_playas && ci != cio) { if (ci->client_playas == cio->client_playas && ci != cio) {

View File

@ -69,7 +69,7 @@ void InitializeGame(int mode, uint size_x, uint size_y)
_cur_tileloop_tile = 0; _cur_tileloop_tile = 0;
if ((mode & IG_DATE_RESET) == IG_DATE_RESET) { if ((mode & IG_DATE_RESET) == IG_DATE_RESET) {
SetDate(ConvertYMDToDate(_patches.starting_year, 0, 1)); SetDate(ConvertYMDToDate(_settings.game_creation.starting_year, 0, 1));
InitializeOldNames(); InitializeOldNames();
} }

View File

@ -146,7 +146,7 @@ CommandCost CmdIncreaseLoan(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
switch (p2) { switch (p2) {
default: return CMD_ERROR; // Invalid method default: return CMD_ERROR; // Invalid method
case 0: // Take some extra loan case 0: // Take some extra loan
loan = (IsHumanPlayer(_current_player) || _patches.ainew_active) ? LOAN_INTERVAL : LOAN_INTERVAL_OLD_AI; loan = (IsHumanPlayer(_current_player) || _settings.ai.ainew_active) ? LOAN_INTERVAL : LOAN_INTERVAL_OLD_AI;
break; break;
case 1: // Take a loan as big as possible case 1: // Take a loan as big as possible
loan = _economy.max_loan - p->current_loan; loan = _economy.max_loan - p->current_loan;
@ -182,7 +182,7 @@ CommandCost CmdDecreaseLoan(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
switch (p2) { switch (p2) {
default: return CMD_ERROR; // Invalid method default: return CMD_ERROR; // Invalid method
case 0: // Pay back one step case 0: // Pay back one step
loan = min(p->current_loan, (Money)(IsHumanPlayer(_current_player) || _patches.ainew_active) ? LOAN_INTERVAL : LOAN_INTERVAL_OLD_AI); loan = min(p->current_loan, (Money)(IsHumanPlayer(_current_player) || _settings.ai.ainew_active) ? LOAN_INTERVAL : LOAN_INTERVAL_OLD_AI);
break; break;
case 1: // Pay back as much as possible case 1: // Pay back as much as possible
loan = max(min(p->current_loan, p->player_money), (Money)LOAN_INTERVAL); loan = max(min(p->current_loan, p->player_money), (Money)LOAN_INTERVAL);
@ -360,7 +360,7 @@ CommandCost CmdMoneyCheat(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
*/ */
CommandCost CmdGiveMoney(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) CommandCost CmdGiveMoney(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{ {
if (!_patches.give_money) return CMD_ERROR; if (!_settings.economy.give_money) return CMD_ERROR;
const Player *p = GetPlayer(_current_player); const Player *p = GetPlayer(_current_player);
CommandCost amount(EXPENSES_OTHER, min((Money)p1, (Money)20000000LL)); CommandCost amount(EXPENSES_OTHER, min((Money)p1, (Money)20000000LL));
@ -409,7 +409,7 @@ CommandCost CmdChangeDifficultyLevel(TileIndex tile, uint32 flags, uint32 p1, ui
* launch a re-evaluation of the actual values only when setting has changed */ * launch a re-evaluation of the actual values only when setting has changed */
if (p2 == GAME_DIFFICULTY_TOWNCOUNCIL_TOLERANCE && _game_mode == GM_NORMAL) { if (p2 == GAME_DIFFICULTY_TOWNCOUNCIL_TOLERANCE && _game_mode == GM_NORMAL) {
UpdateAirportsNoise(); UpdateAirportsNoise();
if (_patches.station_noise_level) { if (_settings.economy.station_noise_level) {
InvalidateWindowClassesData(WC_TOWN_VIEW, 0); InvalidateWindowClassesData(WC_TOWN_VIEW, 0);
} }
} }

View File

@ -102,7 +102,7 @@ public:
LandInfoWindow(TileIndex tile) : Window(&_land_info_desc) { LandInfoWindow(TileIndex tile) : Window(&_land_info_desc) {
Player *p = GetPlayer(IsValidPlayer(_local_player) ? _local_player : PLAYER_FIRST); Player *p = GetPlayer(IsValidPlayer(_local_player) ? _local_player : PLAYER_FIRST);
Town *t = ClosestTownFromTile(tile, _patches.dist_local_authority); Town *t = ClosestTownFromTile(tile, _settings.economy.dist_local_authority);
Money old_money = p->player_money; Money old_money = p->player_money;
p->player_money = INT64_MAX; p->player_money = INT64_MAX;
@ -396,7 +396,7 @@ public:
Window(pt.x, pt.y, width, height, WC_ERRMSG, widget), Window(pt.x, pt.y, width, height, WC_ERRMSG, widget),
show_player_face(show_player_face) show_player_face(show_player_face)
{ {
this->duration = _patches.errmsg_duration; this->duration = _settings.gui.errmsg_duration;
CopyOutDParam(this->decode_params, 0, lengthof(this->decode_params)); CopyOutDParam(this->decode_params, 0, lengthof(this->decode_params));
this->message_1 = msg1; this->message_1 = msg1;
this->message_2 = msg2; this->message_2 = msg2;
@ -465,7 +465,7 @@ void ShowErrorMessage(StringID msg_1, StringID msg_2, int x, int y)
{ {
DeleteWindowById(WC_ERRMSG, 0); DeleteWindowById(WC_ERRMSG, 0);
if (!_patches.errmsg_duration) return; if (!_settings.gui.errmsg_duration) return;
if (msg_2 == STR_NULL) msg_2 = STR_EMPTY; if (msg_2 == STR_NULL) msg_2 = STR_EMPTY;
@ -620,7 +620,7 @@ void GuiShowTooltipsWithArgs(StringID str, uint paramcount, const uint64 params[
DeleteWindowById(WC_TOOLTIPS, 0); DeleteWindowById(WC_TOOLTIPS, 0);
/* We only show measurement tooltips with patch setting on */ /* We only show measurement tooltips with patch setting on */
if (str == STR_NULL || (paramcount != 0 && !_patches.measure_tooltip)) return; if (str == STR_NULL || (paramcount != 0 && !_settings.gui.measure_tooltip)) return;
for (uint i = 0; i != paramcount; i++) SetDParam(i, params[i]); for (uint i = 0; i != paramcount; i++) SetDParam(i, params[i]);
char buffer[512]; char buffer[512];

View File

@ -1009,7 +1009,7 @@ static void NetworkInitGameInfo()
_network_game_info.spectators_on = 0; _network_game_info.spectators_on = 0;
_network_game_info.game_date = _date; _network_game_info.game_date = _date;
_network_game_info.start_date = ConvertYMDToDate(_patches.starting_year, 0, 1); _network_game_info.start_date = ConvertYMDToDate(_settings.game_creation.starting_year, 0, 1);
_network_game_info.map_width = MapSizeX(); _network_game_info.map_width = MapSizeX();
_network_game_info.map_height = MapSizeY(); _network_game_info.map_height = MapSizeY();
_network_game_info.map_set = _opt.landscape; _network_game_info.map_set = _opt.landscape;

View File

@ -83,7 +83,7 @@ void HashCurrentCompanyPassword()
{ {
if (StrEmpty(_network_player_info[_local_player].password)) return; if (StrEmpty(_network_player_info[_local_player].password)) return;
_password_game_seed = _patches.generation_seed; _password_game_seed = _settings.game_creation.generation_seed;
ttd_strlcpy(_password_server_unique_id, _network_unique_id, sizeof(_password_server_unique_id)); 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); const char *new_pw = GenerateCompanyPasswordHash(_network_player_info[_local_player].password);

View File

@ -1342,7 +1342,7 @@ struct NetworkClientListPopupWindow : Window {
if (_network_own_client_index != ci->client_index) { 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 */ /* 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) && _patches.give_money) { if (IsValidPlayer(_network_playas) && IsValidPlayer(ci->client_playas) && _settings.economy.give_money) {
GetString(this->action[i], STR_NETWORK_CLIENTLIST_GIVE_MONEY, lastof(this->action[i])); GetString(this->action[i], STR_NETWORK_CLIENTLIST_GIVE_MONEY, lastof(this->action[i]));
this->proc[i++] = &ClientList_GiveMoney; this->proc[i++] = &ClientList_GiveMoney;
} }

View File

@ -229,7 +229,7 @@ DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_NEED_PASSWORD)(NetworkTCPSocketHandl
Packet *p = NetworkSend_Init(PACKET_SERVER_NEED_PASSWORD); Packet *p = NetworkSend_Init(PACKET_SERVER_NEED_PASSWORD);
p->Send_uint8(type); p->Send_uint8(type);
p->Send_uint32(_patches.generation_seed); p->Send_uint32(_settings.game_creation.generation_seed);
p->Send_string(_network_unique_id); p->Send_string(_network_unique_id);
cs->Send_Packet(p); cs->Send_Packet(p);
} }
@ -254,7 +254,7 @@ DEF_SERVER_SEND_COMMAND(PACKET_SERVER_WELCOME)
p = NetworkSend_Init(PACKET_SERVER_WELCOME); p = NetworkSend_Init(PACKET_SERVER_WELCOME);
p->Send_uint16(cs->index); p->Send_uint16(cs->index);
p->Send_uint32(_patches.generation_seed); p->Send_uint32(_settings.game_creation.generation_seed);
p->Send_string(_network_unique_id); p->Send_string(_network_unique_id);
cs->Send_Packet(p); cs->Send_Packet(p);

View File

@ -326,7 +326,7 @@ static Engine *GetNewEngine(const GRFFile *file, VehicleType type, uint16 intern
/* Hack for add-on GRFs that need to modify another GRF's engines. This lets /* Hack for add-on GRFs that need to modify another GRF's engines. This lets
* them use the same engine slots. */ * them use the same engine slots. */
const GRFFile *grf_match = NULL; const GRFFile *grf_match = NULL;
if (_patches.dynamic_engines) { if (_settings.vehicle.dynamic_engines) {
uint32 override = _grf_id_overrides[file->grfid]; uint32 override = _grf_id_overrides[file->grfid];
if (override != 0) { if (override != 0) {
grf_match = GetFileByGRFID(override); grf_match = GetFileByGRFID(override);
@ -341,7 +341,7 @@ static Engine *GetNewEngine(const GRFFile *file, VehicleType type, uint16 intern
/* Check if this vehicle is already defined... */ /* Check if this vehicle is already defined... */
Engine *e = NULL; Engine *e = NULL;
FOR_ALL_ENGINES(e) { FOR_ALL_ENGINES(e) {
if (_patches.dynamic_engines && e->grffile != NULL && e->grffile != file && e->grffile != grf_match) continue; if (_settings.vehicle.dynamic_engines && e->grffile != NULL && e->grffile != file && e->grffile != grf_match) continue;
if (e->type != type) continue; if (e->type != type) continue;
if (e->internal_id != internal_id) continue; if (e->internal_id != internal_id) continue;
@ -377,14 +377,14 @@ EngineID GetNewEngineID(const GRFFile *file, VehicleType type, uint16 internal_i
extern uint32 GetNewGRFOverride(uint32 grfid); extern uint32 GetNewGRFOverride(uint32 grfid);
const GRFFile *grf_match = NULL; const GRFFile *grf_match = NULL;
if (_patches.dynamic_engines) { if (_settings.vehicle.dynamic_engines) {
uint32 override = _grf_id_overrides[file->grfid]; uint32 override = _grf_id_overrides[file->grfid];
if (override != 0) grf_match = GetFileByGRFID(override); if (override != 0) grf_match = GetFileByGRFID(override);
} }
const Engine *e = NULL; const Engine *e = NULL;
FOR_ALL_ENGINES(e) { FOR_ALL_ENGINES(e) {
if (_patches.dynamic_engines && e->grffile != file && (grf_match == NULL || e->grffile != grf_match)) continue; if (_settings.vehicle.dynamic_engines && e->grffile != file && (grf_match == NULL || e->grffile != grf_match)) continue;
if (e->type != type) continue; if (e->type != type) continue;
if (e->internal_id != internal_id) continue; if (e->internal_id != internal_id) continue;
@ -3592,7 +3592,7 @@ bool GetGlobalVariable(byte param, uint32 *value)
case 0x0F: // Rail track type cost factors case 0x0F: // Rail track type cost factors
*value = 0; *value = 0;
SB(*value, 0, 8, _railtype_cost_multiplier[0]); // normal rail SB(*value, 0, 8, _railtype_cost_multiplier[0]); // normal rail
if (_patches.disable_elrails) { if (_settings.vehicle.disable_elrails) {
/* skip elrail multiplier - disabled */ /* skip elrail multiplier - disabled */
SB(*value, 8, 8, _railtype_cost_multiplier[2]); // monorail SB(*value, 8, 8, _railtype_cost_multiplier[2]); // monorail
} else { } else {
@ -4188,10 +4188,10 @@ static uint32 GetPatchVariable(uint8 param)
{ {
switch (param) { switch (param) {
/* start year - 1920 */ /* start year - 1920 */
case 0x0B: return max(_patches.starting_year, ORIGINAL_BASE_YEAR) - ORIGINAL_BASE_YEAR; case 0x0B: return max(_settings.game_creation.starting_year, ORIGINAL_BASE_YEAR) - ORIGINAL_BASE_YEAR;
/* freight trains weight factor */ /* freight trains weight factor */
case 0x0E: return _patches.freight_trains; case 0x0E: return _settings.vehicle.freight_trains;
/* empty wagon speed increase */ /* empty wagon speed increase */
case 0x0F: return 0; case 0x0F: return 0;
@ -4200,7 +4200,7 @@ static uint32 GetPatchVariable(uint8 param)
* the following is good for 1x, 2x and 4x (most common?) and... * the following is good for 1x, 2x and 4x (most common?) and...
* well not really for 3x. */ * well not really for 3x. */
case 0x10: case 0x10:
switch (_patches.plane_speed) { switch (_settings.vehicle.plane_speed) {
default: default:
case 4: return 1; case 4: return 1;
case 3: return 2; case 3: return 2;
@ -4382,7 +4382,7 @@ static void ParamSet(byte *buf, size_t len)
case 0x01: // Road Vehicles case 0x01: // Road Vehicles
case 0x02: // Ships case 0x02: // Ships
case 0x03: // Aircraft case 0x03: // Aircraft
if (!_patches.dynamic_engines) { if (!_settings.vehicle.dynamic_engines) {
src1 = PerformGRM(&_grm_engines[_engine_offsets[feature]], _engine_counts[feature], count, op, target, "vehicles"); src1 = PerformGRM(&_grm_engines[_engine_offsets[feature]], _engine_counts[feature], count, op, target, "vehicles");
if (_skip_sprites == -1) return; if (_skip_sprites == -1) return;
} else { } else {
@ -4544,7 +4544,7 @@ static void ParamSet(byte *buf, size_t len)
case 0x8F: // Rail track type cost factors case 0x8F: // Rail track type cost factors
_railtype_cost_multiplier[0] = GB(res, 0, 8); _railtype_cost_multiplier[0] = GB(res, 0, 8);
if (_patches.disable_elrails) { if (_settings.vehicle.disable_elrails) {
_railtype_cost_multiplier[1] = GB(res, 0, 8); _railtype_cost_multiplier[1] = GB(res, 0, 8);
_railtype_cost_multiplier[2] = GB(res, 8, 8); _railtype_cost_multiplier[2] = GB(res, 8, 8);
} else { } else {
@ -5079,84 +5079,84 @@ static void GRFUnsafe(byte *buf, size_t len)
static void InitializeGRFSpecial() static void InitializeGRFSpecial()
{ {
_ttdpatch_flags[0] = ((_patches.always_small_airport ? 1 : 0) << 0x0C) // keepsmallairport _ttdpatch_flags[0] = ((_settings.station.always_small_airport ? 1 : 0) << 0x0C) // keepsmallairport
| (1 << 0x0D) // newairports | (1 << 0x0D) // newairports
| (1 << 0x0E) // largestations | (1 << 0x0E) // largestations
| ((_patches.longbridges ? 1 : 0) << 0x0F) // longbridges | ((_settings.construction.longbridges ? 1 : 0) << 0x0F) // longbridges
| (0 << 0x10) // loadtime | (0 << 0x10) // loadtime
| (1 << 0x12) // presignals | (1 << 0x12) // presignals
| (1 << 0x13) // extpresignals | (1 << 0x13) // extpresignals
| ((_patches.never_expire_vehicles ? 1 : 0) << 0x16) // enginespersist | ((_settings.vehicle.never_expire_vehicles ? 1 : 0) << 0x16) // enginespersist
| (1 << 0x1B) // multihead | (1 << 0x1B) // multihead
| (1 << 0x1D) // lowmemory | (1 << 0x1D) // lowmemory
| (1 << 0x1E); // generalfixes | (1 << 0x1E); // generalfixes
_ttdpatch_flags[1] = ((_patches.station_noise_level ? 1 : 0) << 0x07) // moreairports - based on units of noise _ttdpatch_flags[1] = ((_settings.economy.station_noise_level ? 1 : 0) << 0x07) // moreairports - based on units of noise
| ((_patches.mammoth_trains ? 1 : 0) << 0x08) // mammothtrains | ((_settings.vehicle.mammoth_trains ? 1 : 0) << 0x08) // mammothtrains
| (1 << 0x09) // trainrefit | (1 << 0x09) // trainrefit
| (0 << 0x0B) // subsidiaries | (0 << 0x0B) // subsidiaries
| ((_patches.gradual_loading ? 1 : 0) << 0x0C) // gradualloading | ((_settings.order.gradual_loading ? 1 : 0) << 0x0C) // gradualloading
| (1 << 0x12) // unifiedmaglevmode - set bit 0 mode. Not revelant to OTTD | (1 << 0x12) // unifiedmaglevmode - set bit 0 mode. Not revelant to OTTD
| (1 << 0x13) // unifiedmaglevmode - set bit 1 mode | (1 << 0x13) // unifiedmaglevmode - set bit 1 mode
| (1 << 0x14) // bridgespeedlimits | (1 << 0x14) // bridgespeedlimits
| (1 << 0x16) // eternalgame | (1 << 0x16) // eternalgame
| (1 << 0x17) // newtrains | (1 << 0x17) // newtrains
| (1 << 0x18) // newrvs | (1 << 0x18) // newrvs
| (1 << 0x19) // newships | (1 << 0x19) // newships
| (1 << 0x1A) // newplanes | (1 << 0x1A) // newplanes
| ((_patches.signal_side ? 1 : 0) << 0x1B) // signalsontrafficside | ((_settings.construction.signal_side ? 1 : 0) << 0x1B) // signalsontrafficside
| ((_patches.disable_elrails ? 0 : 1) << 0x1C); // electrifiedrailway | ((_settings.vehicle.disable_elrails ? 0 : 1) << 0x1C); // electrifiedrailway
_ttdpatch_flags[2] = (1 << 0x01) // loadallgraphics - obsolote _ttdpatch_flags[2] = (1 << 0x01) // loadallgraphics - obsolote
| (1 << 0x03) // semaphores | (1 << 0x03) // semaphores
| (0 << 0x0B) // enhancedgui | (0 << 0x0B) // enhancedgui
| (0 << 0x0C) // newagerating | (0 << 0x0C) // newagerating
| ((_patches.build_on_slopes ? 1 : 0) << 0x0D) // buildonslopes | ((_settings.construction.build_on_slopes ? 1 : 0) << 0x0D) // buildonslopes
| (1 << 0x0E) // fullloadany | (1 << 0x0E) // fullloadany
| (1 << 0x0F) // planespeed | (1 << 0x0F) // planespeed
| (0 << 0x10) // moreindustriesperclimate - obsolete | (0 << 0x10) // moreindustriesperclimate - obsolete
| (0 << 0x11) // moretoylandfeatures | (0 << 0x11) // moretoylandfeatures
| (1 << 0x12) // newstations | (1 << 0x12) // newstations
| (1 << 0x13) // tracktypecostdiff | (1 << 0x13) // tracktypecostdiff
| (1 << 0x14) // manualconvert | (1 << 0x14) // manualconvert
| ((_patches.build_on_slopes ? 1 : 0) << 0x15) // buildoncoasts | ((_settings.construction.build_on_slopes ? 1 : 0) << 0x15) // buildoncoasts
| (1 << 0x16) // canals | (1 << 0x16) // canals
| (1 << 0x17) // newstartyear | (1 << 0x17) // newstartyear
| ((_patches.freight_trains > 1 ? 1 : 0) << 0x18) // freighttrains | ((_settings.vehicle.freight_trains > 1 ? 1 : 0) << 0x18) // freighttrains
| (1 << 0x19) // newhouses | (1 << 0x19) // newhouses
| (1 << 0x1A) // newbridges | (1 << 0x1A) // newbridges
| (1 << 0x1B) // newtownnames | (1 << 0x1B) // newtownnames
| (1 << 0x1C) // moreanimation | (1 << 0x1C) // moreanimation
| ((_patches.wagon_speed_limits ? 1 : 0) << 0x1D) // wagonspeedlimits | ((_settings.vehicle.wagon_speed_limits ? 1 : 0) << 0x1D) // wagonspeedlimits
| (1 << 0x1E) // newshistory | (1 << 0x1E) // newshistory
| (0 << 0x1F); // custombridgeheads | (0 << 0x1F); // custombridgeheads
_ttdpatch_flags[3] = (0 << 0x00) // newcargodistribution _ttdpatch_flags[3] = (0 << 0x00) // newcargodistribution
| (1 << 0x01) // windowsnap | (1 << 0x01) // windowsnap
| (0 << 0x02) // townbuildnoroad | (0 << 0x02) // townbuildnoroad
| (0 << 0x03) // pathbasedsignalling. To enable if ever pbs is back | (0 << 0x03) // pathbasedsignalling. To enable if ever pbs is back
| (0 << 0x04) // aichoosechance | (0 << 0x04) // aichoosechance
| (1 << 0x05) // resolutionwidth | (1 << 0x05) // resolutionwidth
| (1 << 0x06) // resolutionheight | (1 << 0x06) // resolutionheight
| (1 << 0x07) // newindustries | (1 << 0x07) // newindustries
| ((_patches.improved_load ? 1 : 0) << 0x08) // fifoloading | ((_settings.order.improved_load ? 1 : 0) << 0x08) // fifoloading
| (0 << 0x09) // townroadbranchprob | (0 << 0x09) // townroadbranchprob
| (0 << 0x0A) // tempsnowline | (0 << 0x0A) // tempsnowline
| (1 << 0x0B) // newcargo | (1 << 0x0B) // newcargo
| (1 << 0x0C) // enhancemultiplayer | (1 << 0x0C) // enhancemultiplayer
| (1 << 0x0D) // onewayroads | (1 << 0x0D) // onewayroads
| ((_patches.nonuniform_stations ? 1 : 0) << 0x0E) // irregularstations | ((_settings.station.nonuniform_stations ? 1 : 0) << 0x0E) // irregularstations
| (1 << 0x0F) // statistics | (1 << 0x0F) // statistics
| (1 << 0x10) // newsounds | (1 << 0x10) // newsounds
| (1 << 0x11) // autoreplace | (1 << 0x11) // autoreplace
| (1 << 0x12) // autoslope | (1 << 0x12) // autoslope
| (0 << 0x13) // followvehicle | (0 << 0x13) // followvehicle
| (1 << 0x14) // trams | (1 << 0x14) // trams
| (0 << 0x15) // enhancetunnels | (0 << 0x15) // enhancetunnels
| (1 << 0x16) // shortrvs | (1 << 0x16) // shortrvs
| (1 << 0x17) // articulatedrvs | (1 << 0x17) // articulatedrvs
| ((_patches.dynamic_engines ? 1 : 0) << 0x18) // dynamic engines | ((_settings.vehicle.dynamic_engines ? 1 : 0) << 0x18) // dynamic engines
| (1 << 0x1E); // variablerunningcosts | (1 << 0x1E); // variablerunningcosts
} }
static void ResetCustomStations() static void ResetCustomStations()

View File

@ -1123,7 +1123,7 @@ void CommitRailVehListOrderChanges()
/* Populate map with current list positions */ /* Populate map with current list positions */
Engine *e; Engine *e;
FOR_ALL_ENGINES_OF_TYPE(e, VEH_TRAIN) { FOR_ALL_ENGINES_OF_TYPE(e, VEH_TRAIN) {
if (!_patches.dynamic_engines || e->grffile == source_e->grffile) { if (!_settings.vehicle.dynamic_engines || e->grffile == source_e->grffile) {
if (e->internal_id == target) target_e = e; if (e->internal_id == target) target_e = e;
lptr_map[e->list_position] = e; lptr_map[e->list_position] = e;
} }

View File

@ -21,7 +21,7 @@ uint32 TownGetVariable(byte variable, byte parameter, bool *available, const Tow
switch (variable) { switch (variable) {
/* Larger towns */ /* Larger towns */
case 0x40: case 0x40:
if (_patches.larger_towns == 0) return 2; if (_settings.economy.larger_towns == 0) return 2;
if (t->larger_town) return 1; if (t->larger_town) return 1;
return 0; return 0;

View File

@ -398,7 +398,7 @@ void AddNewsItem(StringID string, NewsSubtype subtype, uint data_a, uint data_b)
ni->flags = _news_subtype_data[subtype].flags; ni->flags = _news_subtype_data[subtype].flags;
/* show this news message in color? */ /* show this news message in color? */
if (_cur_year >= _patches.colored_news_year) ni->flags |= NF_INCOLOR; if (_cur_year >= _settings.gui.colored_news_year) ni->flags |= NF_INCOLOR;
ni->data_a = data_a; ni->data_a = data_a;
ni->data_b = data_b; ni->data_b = data_b;

View File

@ -213,7 +213,7 @@ static uint NPFSlopeCost(AyStarNode* current)
if (z2 - z1 > 1) { if (z2 - z1 > 1) {
/* Slope up */ /* Slope up */
return _patches.npf_rail_slope_penalty; return _settings.pf.npf.npf_rail_slope_penalty;
} }
return 0; return 0;
/* Should we give a bonus for slope down? Probably not, we /* Should we give a bonus for slope down? Probably not, we
@ -260,10 +260,10 @@ static int32 NPFWaterPathCost(AyStar* as, AyStarNode* current, OpenListNode* par
cost = _trackdir_length[trackdir]; // Should be different for diagonal tracks cost = _trackdir_length[trackdir]; // Should be different for diagonal tracks
if (IsBuoyTile(current->tile) && IsDiagonalTrackdir(trackdir)) if (IsBuoyTile(current->tile) && IsDiagonalTrackdir(trackdir))
cost += _patches.npf_buoy_penalty; // A small penalty for going over buoys cost += _settings.pf.npf.npf_buoy_penalty; // A small penalty for going over buoys
if (current->direction != NextTrackdir((Trackdir)parent->path.node.direction)) if (current->direction != NextTrackdir((Trackdir)parent->path.node.direction))
cost += _patches.npf_water_curve_penalty; cost += _settings.pf.npf.npf_water_curve_penalty;
/* @todo More penalties? */ /* @todo More penalties? */
@ -285,13 +285,13 @@ static int32 NPFRoadPathCost(AyStar* as, AyStarNode* current, OpenListNode* pare
case MP_ROAD: case MP_ROAD:
cost = NPF_TILE_LENGTH; cost = NPF_TILE_LENGTH;
/* Increase the cost for level crossings */ /* Increase the cost for level crossings */
if (IsLevelCrossing(tile)) cost += _patches.npf_crossing_penalty; if (IsLevelCrossing(tile)) cost += _settings.pf.npf.npf_crossing_penalty;
break; break;
case MP_STATION: case MP_STATION:
cost = NPF_TILE_LENGTH; cost = NPF_TILE_LENGTH;
/* Increase the cost for drive-through road stops */ /* Increase the cost for drive-through road stops */
if (IsDriveThroughStopTile(tile)) cost += _patches.npf_road_drive_through_penalty; if (IsDriveThroughStopTile(tile)) cost += _settings.pf.npf.npf_road_drive_through_penalty;
break; break;
default: default:
@ -306,7 +306,7 @@ static int32 NPFRoadPathCost(AyStar* as, AyStarNode* current, OpenListNode* pare
/* Check for turns. Road vehicles only really drive diagonal, turns are /* Check for turns. Road vehicles only really drive diagonal, turns are
* represented by non-diagonal tracks */ * represented by non-diagonal tracks */
if (!IsDiagonalTrackdir((Trackdir)current->direction)) if (!IsDiagonalTrackdir((Trackdir)current->direction))
cost += _patches.npf_road_curve_penalty; cost += _settings.pf.npf.npf_road_curve_penalty;
NPFMarkTile(tile); NPFMarkTile(tile);
DEBUG(npf, 4, "Calculating G for: (%d, %d). Result: %d", TileX(current->tile), TileY(current->tile), cost); 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, AyStarNode* current, OpenListNode* pare
* give any station tile a penalty, because every possible route will get * 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 * this penalty exactly once, on its end tile (if it's a station) and it
* will therefore not make a difference. */ * will therefore not make a difference. */
cost = NPF_TILE_LENGTH + _patches.npf_rail_station_penalty; cost = NPF_TILE_LENGTH + _settings.pf.npf.npf_rail_station_penalty;
break; break;
default: default:
@ -366,9 +366,9 @@ static int32 NPFRailPathCost(AyStar* as, AyStarNode* current, OpenListNode* pare
SignalType sigtype = GetSignalType(tile, TrackdirToTrack(trackdir)); SignalType sigtype = GetSignalType(tile, TrackdirToTrack(trackdir));
if (sigtype == SIGTYPE_EXIT || sigtype == SIGTYPE_COMBO) { if (sigtype == SIGTYPE_EXIT || sigtype == SIGTYPE_COMBO) {
/* Penalise exit and combo signals differently (heavier) */ /* Penalise exit and combo signals differently (heavier) */
cost += _patches.npf_rail_firstred_exit_penalty; cost += _settings.pf.npf.npf_rail_firstred_exit_penalty;
} else { } else {
cost += _patches.npf_rail_firstred_penalty; cost += _settings.pf.npf.npf_rail_firstred_penalty;
} }
} }
/* Record the state of this signal */ /* Record the state of this signal */
@ -386,14 +386,14 @@ static int32 NPFRailPathCost(AyStar* as, AyStarNode* current, OpenListNode* pare
* of course... */ * of course... */
new_node.path.node = *current; new_node.path.node = *current;
if (as->EndNodeCheck(as, &new_node) == AYSTAR_FOUND_END_NODE && NPFGetFlag(current, NPF_FLAG_LAST_SIGNAL_RED)) if (as->EndNodeCheck(as, &new_node) == AYSTAR_FOUND_END_NODE && NPFGetFlag(current, NPF_FLAG_LAST_SIGNAL_RED))
cost += _patches.npf_rail_lastred_penalty; cost += _settings.pf.npf.npf_rail_lastred_penalty;
/* Check for slope */ /* Check for slope */
cost += NPFSlopeCost(current); cost += NPFSlopeCost(current);
/* Check for turns */ /* Check for turns */
if (current->direction != NextTrackdir((Trackdir)parent->path.node.direction)) if (current->direction != NextTrackdir((Trackdir)parent->path.node.direction))
cost += _patches.npf_rail_curve_penalty; cost += _settings.pf.npf.npf_rail_curve_penalty;
/*TODO, with realistic acceleration, also the amount of straight track between /*TODO, with realistic acceleration, also the amount of straight track between
* curves should be taken into account, as this affects the speed limit. */ * curves should be taken into account, as this affects the speed limit. */
@ -402,7 +402,7 @@ static int32 NPFRailPathCost(AyStar* as, AyStarNode* current, OpenListNode* pare
/* Penalise any depot tile that is not the last tile in the path. This /* 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 * _should_ penalise every occurence of reversing in a depot (and only
* that) */ * that) */
cost += _patches.npf_rail_depot_reverse_penalty; cost += _settings.pf.npf.npf_rail_depot_reverse_penalty;
} }
/* Check for occupied track */ /* Check for occupied track */
@ -634,7 +634,7 @@ static TrackdirBits GetDriveableTrackdirBits(TileIndex dst_tile, Trackdir src_tr
trackdirbits &= TrackdirReachesTrackdirs(src_trackdir); trackdirbits &= TrackdirReachesTrackdirs(src_trackdir);
/* Filter out trackdirs that would make 90 deg turns for trains */ /* Filter out trackdirs that would make 90 deg turns for trains */
if (_patches.forbid_90_deg && (type == TRANSPORT_RAIL || type == TRANSPORT_WATER)) trackdirbits &= ~TrackdirCrossesTrackdirs(src_trackdir); if (_settings.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); 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; //_npf_aystar.max_search_nodes = 0;
/* We will limit the number of nodes for now, until we have a better /* We will limit the number of nodes for now, until we have a better
* solution to really fix performance */ * solution to really fix performance */
_npf_aystar.max_search_nodes = _patches.npf_max_search_nodes; _npf_aystar.max_search_nodes = _settings.pf.npf.npf_max_search_nodes;
} }
void NPFFillWithOrderData(NPFFindStationOrTileData* fstd, Vehicle* v) void NPFFillWithOrderData(NPFFindStationOrTileData* fstd, Vehicle* v)

View File

@ -485,8 +485,8 @@ int ttd_main(int argc, char *argv[])
if (!StrEmpty(videodriver)) ttd_strlcpy(_ini_videodriver, videodriver, sizeof(_ini_videodriver)); if (!StrEmpty(videodriver)) ttd_strlcpy(_ini_videodriver, videodriver, sizeof(_ini_videodriver));
if (!StrEmpty(blitter)) ttd_strlcpy(_ini_blitter, blitter, sizeof(_ini_blitter)); if (!StrEmpty(blitter)) ttd_strlcpy(_ini_blitter, blitter, sizeof(_ini_blitter));
if (resolution[0] != 0) { _cur_resolution[0] = resolution[0]; _cur_resolution[1] = resolution[1]; } if (resolution[0] != 0) { _cur_resolution[0] = resolution[0]; _cur_resolution[1] = resolution[1]; }
if (startyear != INVALID_YEAR) _patches_newgame.starting_year = startyear; if (startyear != INVALID_YEAR) _settings_newgame.game_creation.starting_year = startyear;
if (generation_seed != GENERATE_NEW_SEED) _patches_newgame.generation_seed = generation_seed; if (generation_seed != GENERATE_NEW_SEED) _settings_newgame.game_creation.generation_seed = generation_seed;
/* The width and height must be at least 1 pixel, this /* The width and height must be at least 1 pixel, this
* way all internal drawing routines work correctly. */ * way all internal drawing routines work correctly. */
@ -652,7 +652,7 @@ void HandleExitGameRequest()
{ {
if (_game_mode == GM_MENU) { // do not ask to quit on the main screen if (_game_mode == GM_MENU) { // do not ask to quit on the main screen
_exit_game = true; _exit_game = true;
} else if (_patches.autosave_on_exit) { } else if (_settings.gui.autosave_on_exit) {
DoExitSave(); DoExitSave();
_exit_game = true; _exit_game = true;
} else { } else {
@ -684,9 +684,9 @@ static void MakeNewGameDone()
SetLocalPlayer(PLAYER_FIRST); SetLocalPlayer(PLAYER_FIRST);
_current_player = _local_player; _current_player = _local_player;
DoCommandP(0, (_patches.autorenew << 15 ) | (_patches.autorenew_months << 16) | 4, _patches.autorenew_money, NULL, CMD_SET_AUTOREPLACE); DoCommandP(0, (_settings.gui.autorenew << 15 ) | (_settings.gui.autorenew_months << 16) | 4, _settings.gui.autorenew_money, NULL, CMD_SET_AUTOREPLACE);
SettingsDisableElrail(_patches.disable_elrails); SettingsDisableElrail(_settings.vehicle.disable_elrails);
InitializeRailGUI(); InitializeRailGUI();
#ifdef ENABLE_NETWORK #ifdef ENABLE_NETWORK
@ -711,7 +711,7 @@ static void MakeNewGame(bool from_heightmap)
_industry_mngr.ResetMapping(); _industry_mngr.ResetMapping();
GenerateWorldSetCallback(&MakeNewGameDone); GenerateWorldSetCallback(&MakeNewGameDone);
GenerateWorld(from_heightmap ? GW_HEIGHTMAP : GW_NEWGAME, 1 << _patches.map_x, 1 << _patches.map_y); GenerateWorld(from_heightmap ? GW_HEIGHTMAP : GW_NEWGAME, 1 << _settings.game_creation.map_x, 1 << _settings.game_creation.map_y);
} }
static void MakeNewEditorWorldDone() static void MakeNewEditorWorldDone()
@ -728,7 +728,7 @@ static void MakeNewEditorWorld()
ResetGRFConfig(true); ResetGRFConfig(true);
GenerateWorldSetCallback(&MakeNewEditorWorldDone); GenerateWorldSetCallback(&MakeNewEditorWorldDone);
GenerateWorld(GW_EMPTY, 1 << _patches.map_x, 1 << _patches.map_y); GenerateWorld(GW_EMPTY, 1 << _settings.game_creation.map_x, 1 << _settings.game_creation.map_y);
} }
void StartupPlayers(); void StartupPlayers();
@ -778,7 +778,7 @@ static void StartScenario()
SetLocalPlayer(PLAYER_FIRST); SetLocalPlayer(PLAYER_FIRST);
_current_player = _local_player; _current_player = _local_player;
DoCommandP(0, (_patches.autorenew << 15 ) | (_patches.autorenew_months << 16) | 4, _patches.autorenew_money, NULL, CMD_SET_AUTOREPLACE); DoCommandP(0, (_settings.gui.autorenew << 15 ) | (_settings.gui.autorenew_months << 16) | 4, _settings.gui.autorenew_money, NULL, CMD_SET_AUTOREPLACE);
MarkWholeScreenDirty(); MarkWholeScreenDirty();
} }
@ -837,7 +837,7 @@ void SwitchMode(int new_mode)
/* check if we should reload the config */ /* check if we should reload the config */
if (_network_reload_cfg) { if (_network_reload_cfg) {
LoadFromConfig(); LoadFromConfig();
_patches = _patches_newgame; _settings = _settings_newgame;
_opt = _opt_newgame; _opt = _opt_newgame;
ResetGRFConfig(false); ResetGRFConfig(false);
} }
@ -911,14 +911,14 @@ void SwitchMode(int new_mode)
case SM_LOAD_HEIGHTMAP: /* Load heightmap from scenario editor */ case SM_LOAD_HEIGHTMAP: /* Load heightmap from scenario editor */
SetLocalPlayer(OWNER_NONE); SetLocalPlayer(OWNER_NONE);
GenerateWorld(GW_HEIGHTMAP, 1 << _patches.map_x, 1 << _patches.map_y); GenerateWorld(GW_HEIGHTMAP, 1 << _settings.game_creation.map_x, 1 << _settings.game_creation.map_y);
MarkWholeScreenDirty(); MarkWholeScreenDirty();
break; break;
case SM_LOAD_SCENARIO: { /* Load scenario from scenario editor */ case SM_LOAD_SCENARIO: { /* Load scenario from scenario editor */
if (SafeSaveOrLoad(_file_to_saveload.name, _file_to_saveload.mode, GM_EDITOR, NO_DIRECTORY)) { if (SafeSaveOrLoad(_file_to_saveload.name, _file_to_saveload.mode, GM_EDITOR, NO_DIRECTORY)) {
SetLocalPlayer(OWNER_NONE); SetLocalPlayer(OWNER_NONE);
_patches_newgame.starting_year = _cur_year; _settings_newgame.game_creation.starting_year = _cur_year;
} else { } else {
SetDParamStr(0, GetSaveLoadErrorString()); SetDParamStr(0, GetSaveLoadErrorString());
ShowErrorMessage(INVALID_STRING_ID, STR_012D, 0, 0); ShowErrorMessage(INVALID_STRING_ID, STR_012D, 0, 0);
@ -944,7 +944,7 @@ void SwitchMode(int new_mode)
case SM_GENRANDLAND: /* Generate random land within scenario editor */ case SM_GENRANDLAND: /* Generate random land within scenario editor */
SetLocalPlayer(OWNER_NONE); SetLocalPlayer(OWNER_NONE);
GenerateWorld(GW_RANDOM, 1 << _patches.map_x, 1 << _patches.map_y); GenerateWorld(GW_RANDOM, 1 << _settings.game_creation.map_x, 1 << _settings.game_creation.map_y);
/* XXX: set date */ /* XXX: set date */
MarkWholeScreenDirty(); MarkWholeScreenDirty();
break; break;
@ -1060,16 +1060,16 @@ static void DoAutosave()
if (_networking) return; if (_networking) return;
#endif /* PSP */ #endif /* PSP */
if (_patches.keep_all_autosave && _local_player != PLAYER_SPECTATOR) { if (_settings.gui.keep_all_autosave && _local_player != PLAYER_SPECTATOR) {
SetDParam(0, _local_player); SetDParam(0, _local_player);
SetDParam(1, _date); SetDParam(1, _date);
GetString(buf, STR_4004, lastof(buf)); GetString(buf, STR_4004, lastof(buf));
ttd_strlcat(buf, ".sav", lengthof(buf)); ttd_strlcat(buf, ".sav", lengthof(buf));
} else { } else {
/* generate a savegame name and number according to _patches.max_num_autosaves */ /* generate a savegame name and number according to _settings.gui.max_num_autosaves */
snprintf(buf, sizeof(buf), "autosave%d.sav", _autosave_ctr); snprintf(buf, sizeof(buf), "autosave%d.sav", _autosave_ctr);
if (++_autosave_ctr >= _patches.max_num_autosaves) _autosave_ctr = 0; if (++_autosave_ctr >= _settings.gui.max_num_autosaves) _autosave_ctr = 0;
} }
DEBUG(sl, 2, "Autosaving to '%s'", buf); DEBUG(sl, 2, "Autosaving to '%s'", buf);
@ -1428,7 +1428,7 @@ bool AfterLoadGame()
SetDate(_date); SetDate(_date);
/* Force dynamic engines off when loading older savegames */ /* Force dynamic engines off when loading older savegames */
if (CheckSavegameVersion(95)) _patches.dynamic_engines = 0; if (CheckSavegameVersion(95)) _settings.vehicle.dynamic_engines = 0;
/* Load the sprites */ /* Load the sprites */
GfxLoadSprites(); GfxLoadSprites();
@ -1635,9 +1635,9 @@ bool AfterLoadGame()
*/ */
if (!_network_dedicated && IsValidPlayer(PLAYER_FIRST)) { if (!_network_dedicated && IsValidPlayer(PLAYER_FIRST)) {
p = GetPlayer(PLAYER_FIRST); p = GetPlayer(PLAYER_FIRST);
p->engine_renew = _patches.autorenew; p->engine_renew = _settings.gui.autorenew;
p->engine_renew_months = _patches.autorenew_months; p->engine_renew_months = _settings.gui.autorenew_months;
p->engine_renew_money = _patches.autorenew_money; p->engine_renew_money = _settings.gui.autorenew_money;
} }
} }
@ -2022,9 +2022,9 @@ bool AfterLoadGame()
/* from version 38 we have optional elrails, since we cannot know the /* from version 38 we have optional elrails, since we cannot know the
* preference of a user, let elrails enabled; it can be disabled manually */ * preference of a user, let elrails enabled; it can be disabled manually */
if (CheckSavegameVersion(38)) _patches.disable_elrails = false; if (CheckSavegameVersion(38)) _settings.vehicle.disable_elrails = false;
/* do the same as when elrails were enabled/disabled manually just now */ /* do the same as when elrails were enabled/disabled manually just now */
SettingsDisableElrail(_patches.disable_elrails); SettingsDisableElrail(_settings.vehicle.disable_elrails);
InitializeRailGUI(); InitializeRailGUI();
/* From version 53, the map array was changed for house tiles to allow /* From version 53, the map array was changed for house tiles to allow
@ -2189,7 +2189,7 @@ bool AfterLoadGame()
Town *t; Town *t;
FOR_ALL_TOWNS(t) { FOR_ALL_TOWNS(t) {
if (_patches.larger_towns != 0 && (t->index % _patches.larger_towns) == 0) { if (_settings.economy.larger_towns != 0 && (t->index % _settings.economy.larger_towns) == 0) {
t->larger_town = true; t->larger_town = true;
} }
} }
@ -2464,22 +2464,22 @@ bool AfterLoadGame()
} }
/* Convert old PF settings to new */ /* Convert old PF settings to new */
if (_patches.yapf.rail_use_yapf || CheckSavegameVersion(28)) { if (_settings.pf.yapf.rail_use_yapf || CheckSavegameVersion(28)) {
_patches.pathfinder_for_trains = VPF_YAPF; _settings.pf.pathfinder_for_trains = VPF_YAPF;
} else { } else {
_patches.pathfinder_for_trains = (_patches.new_pathfinding_all ? VPF_NPF : VPF_NTP); _settings.pf.pathfinder_for_trains = (_settings.pf.new_pathfinding_all ? VPF_NPF : VPF_NTP);
} }
if (_patches.yapf.road_use_yapf || CheckSavegameVersion(28)) { if (_settings.pf.yapf.road_use_yapf || CheckSavegameVersion(28)) {
_patches.pathfinder_for_roadvehs = VPF_YAPF; _settings.pf.pathfinder_for_roadvehs = VPF_YAPF;
} else { } else {
_patches.pathfinder_for_roadvehs = (_patches.new_pathfinding_all ? VPF_NPF : VPF_OPF); _settings.pf.pathfinder_for_roadvehs = (_settings.pf.new_pathfinding_all ? VPF_NPF : VPF_OPF);
} }
if (_patches.yapf.ship_use_yapf) { if (_settings.pf.yapf.ship_use_yapf) {
_patches.pathfinder_for_ships = VPF_YAPF; _settings.pf.pathfinder_for_ships = VPF_YAPF;
} else { } else {
_patches.pathfinder_for_ships = (_patches.new_pathfinding_all ? VPF_NPF : VPF_OPF); _settings.pf.pathfinder_for_ships = (_settings.pf.new_pathfinding_all ? VPF_NPF : VPF_OPF);
} }
} }

View File

@ -153,7 +153,7 @@ Order::Order(uint32 packed)
void Order::ConvertFromOldSavegame() void Order::ConvertFromOldSavegame()
{ {
/* First handle non-stop, because those bits are going to be reused. */ /* First handle non-stop, because those bits are going to be reused. */
if (_patches.sg_new_nonstop) { if (_settings.gui.sg_new_nonstop) {
this->SetNonStopType((this->flags & 0x08) ? ONSF_NO_STOP_AT_ANY_STATION : ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS); this->SetNonStopType((this->flags & 0x08) ? ONSF_NO_STOP_AT_ANY_STATION : ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
} else { } else {
this->SetNonStopType((this->flags & 0x08) ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE); this->SetNonStopType((this->flags & 0x08) ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE);
@ -171,7 +171,7 @@ void Order::ConvertFromOldSavegame()
if ((this->flags & 4) == 0) { if ((this->flags & 4) == 0) {
this->SetLoadType(OLF_LOAD_IF_POSSIBLE); this->SetLoadType(OLF_LOAD_IF_POSSIBLE);
} else { } else {
this->SetLoadType(_patches.sg_full_load_any ? OLF_FULL_LOAD_ANY : OLFB_FULL_LOAD); this->SetLoadType(_settings.gui.sg_full_load_any ? OLF_FULL_LOAD_ANY : OLFB_FULL_LOAD);
} }
} else { } else {
this->SetDepotActionType(((this->flags & 6) == 4) ? ODATFB_HALT : ODATF_SERVICE_ONLY); this->SetDepotActionType(((this->flags & 6) == 4) ? ODATFB_HALT : ODATF_SERVICE_ONLY);
@ -451,7 +451,7 @@ CommandCost CmdInsertOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (!HasOrderPoolFree(1)) return_cmd_error(STR_8831_NO_MORE_SPACE_FOR_ORDERS); if (!HasOrderPoolFree(1)) return_cmd_error(STR_8831_NO_MORE_SPACE_FOR_ORDERS);
if (v->type == VEH_SHIP && IsHumanPlayer(v->owner) && _patches.pathfinder_for_ships != VPF_NPF) { if (v->type == VEH_SHIP && IsHumanPlayer(v->owner) && _settings.pf.pathfinder_for_ships != VPF_NPF) {
/* Make sure the new destination is not too far away from the previous */ /* Make sure the new destination is not too far away from the previous */
const Order *prev = NULL; const Order *prev = NULL;
uint n = 0; uint n = 0;
@ -1273,7 +1273,7 @@ void RestoreVehicleOrders(const Vehicle *v, const BackuppedOrders *bak)
} }
/* Copy timetable if enabled */ /* Copy timetable if enabled */
if (_patches.timetabling && !DoCommandP(0, v->index | (i << 16) | (1 << 25), if (_settings.order.timetabling && !DoCommandP(0, v->index | (i << 16) | (1 << 25),
bak->order[i].wait_time << 16 | bak->order[i].travel_time, NULL, bak->order[i].wait_time << 16 | bak->order[i].travel_time, NULL,
CMD_CHANGE_TIMETABLE | CMD_NO_TEST_IF_IN_NETWORK)) { CMD_CHANGE_TIMETABLE | CMD_NO_TEST_IF_IN_NETWORK)) {
break; break;
@ -1386,13 +1386,13 @@ static TileIndex GetStationTileForVehicle(const Vehicle* v, const Station* st)
void CheckOrders(const Vehicle* v) void CheckOrders(const Vehicle* v)
{ {
/* Does the user wants us to check things? */ /* Does the user wants us to check things? */
if (_patches.order_review_system == 0) return; if (_settings.gui.order_review_system == 0) return;
/* Do nothing for crashed vehicles */ /* Do nothing for crashed vehicles */
if (v->vehstatus & VS_CRASHED) return; if (v->vehstatus & VS_CRASHED) return;
/* Do nothing for stopped vehicles if setting is '1' */ /* Do nothing for stopped vehicles if setting is '1' */
if (_patches.order_review_system == 1 && v->vehstatus & VS_STOPPED) if (_settings.gui.order_review_system == 1 && v->vehstatus & VS_STOPPED)
return; return;
/* do nothing we we're not the first vehicle in a share-chain */ /* do nothing we we're not the first vehicle in a share-chain */
@ -1571,7 +1571,7 @@ void DeleteVehicleOrders(Vehicle *v)
Date GetServiceIntervalClamped(uint index) Date GetServiceIntervalClamped(uint index)
{ {
return (_patches.servint_ispercent) ? Clamp(index, MIN_SERVINT_PERCENT, MAX_SERVINT_PERCENT) : Clamp(index, MIN_SERVINT_DAYS, MAX_SERVINT_DAYS); return (_settings.vehicle.servint_ispercent) ? Clamp(index, MIN_SERVINT_PERCENT, MAX_SERVINT_PERCENT) : Clamp(index, MIN_SERVINT_DAYS, MAX_SERVINT_DAYS);
} }
/** /**

View File

@ -265,13 +265,13 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
order.index = 0; order.index = 0;
/* check depot first */ /* check depot first */
if (_patches.gotodepot) { if (_settings.order.gotodepot) {
switch (GetTileType(tile)) { switch (GetTileType(tile)) {
case MP_RAILWAY: case MP_RAILWAY:
if (v->type == VEH_TRAIN && IsTileOwner(tile, _local_player)) { if (v->type == VEH_TRAIN && IsTileOwner(tile, _local_player)) {
if (IsRailDepot(tile)) { if (IsRailDepot(tile)) {
order.MakeGoToDepot(GetDepotByTile(tile)->index, ODTFB_PART_OF_ORDERS); order.MakeGoToDepot(GetDepotByTile(tile)->index, ODTFB_PART_OF_ORDERS);
if (_patches.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS); if (_settings.gui.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
return order; return order;
} }
} }
@ -280,7 +280,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
case MP_ROAD: case MP_ROAD:
if (IsRoadDepot(tile) && v->type == VEH_ROAD && IsTileOwner(tile, _local_player)) { if (IsRoadDepot(tile) && v->type == VEH_ROAD && IsTileOwner(tile, _local_player)) {
order.MakeGoToDepot(GetDepotByTile(tile)->index, ODTFB_PART_OF_ORDERS); order.MakeGoToDepot(GetDepotByTile(tile)->index, ODTFB_PART_OF_ORDERS);
if (_patches.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS); if (_settings.gui.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
return order; return order;
} }
break; break;
@ -313,7 +313,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
IsTileOwner(tile, _local_player) && IsTileOwner(tile, _local_player) &&
IsRailWaypoint(tile)) { IsRailWaypoint(tile)) {
order.MakeGoToWaypoint(GetWaypointByTile(tile)->index); order.MakeGoToWaypoint(GetWaypointByTile(tile)->index);
if (_patches.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS); if (_settings.gui.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
return order; return order;
} }
@ -330,7 +330,7 @@ static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
(facil = FACIL_TRUCK_STOP, 1); (facil = FACIL_TRUCK_STOP, 1);
if (st->facilities & facil) { if (st->facilities & facil) {
order.MakeGoToStation(st_index); order.MakeGoToStation(st_index);
if (_patches.new_nonstop && (v->type == VEH_TRAIN || v->type == VEH_ROAD)) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS); if (_settings.gui.new_nonstop && (v->type == VEH_TRAIN || v->type == VEH_ROAD)) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
return order; return order;
} }
} }
@ -611,7 +611,7 @@ public:
this->resize.step_height = 10; this->resize.step_height = 10;
this->selected_order = -1; this->selected_order = -1;
this->vehicle = v; this->vehicle = v;
if (_patches.timetabling) { if (_settings.order.timetabling) {
this->widget[ORDER_WIDGET_CAPTION].right -= 61; this->widget[ORDER_WIDGET_CAPTION].right -= 61;
} else { } else {
this->HideWidget(ORDER_WIDGET_TIMETABLE_VIEW); this->HideWidget(ORDER_WIDGET_TIMETABLE_VIEW);

View File

@ -778,7 +778,7 @@ void NewTrainPathfind(TileIndex tile, TileIndex dest, RailTypes railtypes, DiagD
tpf->enum_proc = enum_proc; tpf->enum_proc = enum_proc;
tpf->tracktype = TRANSPORT_RAIL; tpf->tracktype = TRANSPORT_RAIL;
tpf->railtypes = railtypes; tpf->railtypes = railtypes;
tpf->maxlength = min(_patches.pf_maxlength * 3, 10000); tpf->maxlength = min(_settings.pf.opf.pf_maxlength * 3, 10000);
tpf->nstack = 0; tpf->nstack = 0;
tpf->new_link = tpf->links; tpf->new_link = tpf->links;
tpf->num_links_left = lengthof(tpf->links); tpf->num_links_left = lengthof(tpf->links);

View File

@ -1191,7 +1191,7 @@ struct PlayerCompanyWindow : Window
this->SetWidgetHiddenState(PCW_WIDGET_COMPANY_PASSWORD, !local || !_networking); this->SetWidgetHiddenState(PCW_WIDGET_COMPANY_PASSWORD, !local || !_networking);
if (!local) { if (!local) {
if (_patches.allow_shares) { // Shares are allowed if (_settings.economy.allow_shares) { // Shares are allowed
/* If all shares are owned by someone (none by nobody), disable buy button */ /* If all shares are owned by someone (none by nobody), disable buy button */
this->SetWidgetDisabledState(PCW_WIDGET_BUY_SHARE, GetAmountOwnedBy(p, PLAYER_SPECTATOR) == 0 || 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! */ /* Only 25% left to buy. If the player is human, disable buying it up.. TODO issues! */
@ -1545,7 +1545,7 @@ struct HighScoreWindow : EndGameHighScoreBaseWindow
this->SetupHighScoreEndWindow(&x, &y); this->SetupHighScoreEndWindow(&x, &y);
SetDParam(0, _patches.ending_year); SetDParam(0, _settings.gui.ending_year);
SetDParam(1, this->window_number + STR_6801_EASY); 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); DrawStringMultiCenter(x + (640 / 2), y + 62, !_networking ? STR_0211_TOP_COMPANIES_WHO_REACHED : STR_TOP_COMPANIES_NETWORK_GAME, 500);

View File

@ -65,9 +65,9 @@ void SetLocalPlayer(PlayerID new_player)
/* Do not update the patches if we are in the intro GUI */ /* Do not update the patches if we are in the intro GUI */
if (IsValidPlayer(new_player) && _game_mode != GM_MENU) { if (IsValidPlayer(new_player) && _game_mode != GM_MENU) {
const Player *p = GetPlayer(new_player); const Player *p = GetPlayer(new_player);
_patches.autorenew = p->engine_renew; _settings.gui.autorenew = p->engine_renew;
_patches.autorenew_months = p->engine_renew_months; _settings.gui.autorenew_months = p->engine_renew_months;
_patches.autorenew_money = p->engine_renew_money; _settings.gui.autorenew_money = p->engine_renew_money;
InvalidateWindow(WC_GAME_OPTIONS, 0); InvalidateWindow(WC_GAME_OPTIONS, 0);
} }
} }
@ -541,9 +541,9 @@ Player *DoStartupNewPlayer(bool is_ai)
/* Engine renewal settings */ /* Engine renewal settings */
p->engine_renew_list = NULL; p->engine_renew_list = NULL;
p->renew_keep_length = false; p->renew_keep_length = false;
p->engine_renew = _patches_newgame.autorenew; p->engine_renew = _settings_newgame.gui.autorenew;
p->engine_renew_months = _patches_newgame.autorenew_months; p->engine_renew_months = _settings_newgame.gui.autorenew_months;
p->engine_renew_money = _patches_newgame.autorenew_money; p->engine_renew_money = _settings_newgame.gui.autorenew_money;
GeneratePresidentName(p); GeneratePresidentName(p);
@ -630,7 +630,7 @@ void PlayersYearlyLoop()
} }
} }
if (_patches.show_finances && _local_player != PLAYER_SPECTATOR) { if (_settings.gui.show_finances && _local_player != PLAYER_SPECTATOR) {
ShowPlayerFinances(_local_player); ShowPlayerFinances(_local_player);
p = GetPlayer(_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) { 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 tile, uint32 flags, uint32 p1, uint32 p2
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
p->engine_renew = HasBit(p2, 0); p->engine_renew = HasBit(p2, 0);
if (IsLocalPlayer()) { if (IsLocalPlayer()) {
_patches.autorenew = p->engine_renew; _settings.gui.autorenew = p->engine_renew;
InvalidateWindow(WC_GAME_OPTIONS, 0); InvalidateWindow(WC_GAME_OPTIONS, 0);
} }
} }
@ -708,7 +708,7 @@ CommandCost CmdSetAutoReplace(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
p->engine_renew_months = (int16)p2; p->engine_renew_months = (int16)p2;
if (IsLocalPlayer()) { if (IsLocalPlayer()) {
_patches.autorenew_months = p->engine_renew_months; _settings.gui.autorenew_months = p->engine_renew_months;
InvalidateWindow(WC_GAME_OPTIONS, 0); InvalidateWindow(WC_GAME_OPTIONS, 0);
} }
} }
@ -721,7 +721,7 @@ CommandCost CmdSetAutoReplace(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
p->engine_renew_money = p2; p->engine_renew_money = p2;
if (IsLocalPlayer()) { if (IsLocalPlayer()) {
_patches.autorenew_money = p->engine_renew_money; _settings.gui.autorenew_money = p->engine_renew_money;
InvalidateWindow(WC_GAME_OPTIONS, 0); InvalidateWindow(WC_GAME_OPTIONS, 0);
} }
} }
@ -771,9 +771,9 @@ CommandCost CmdSetAutoReplace(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
p->engine_renew_money = p2; p->engine_renew_money = p2;
if (IsLocalPlayer()) { if (IsLocalPlayer()) {
_patches.autorenew = p->engine_renew; _settings.gui.autorenew = p->engine_renew;
_patches.autorenew_months = p->engine_renew_months; _settings.gui.autorenew_months = p->engine_renew_months;
_patches.autorenew_money = p->engine_renew_money; _settings.gui.autorenew_money = p->engine_renew_money;
InvalidateWindow(WC_GAME_OPTIONS, 0); InvalidateWindow(WC_GAME_OPTIONS, 0);
} }
} }
@ -876,8 +876,8 @@ CommandCost CmdPlayerCtrl(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
/* Now that we have a new player, broadcast its autorenew settings to /* Now that we have a new player, broadcast its autorenew settings to
* all clients so everything is in sync */ * all clients so everything is in sync */
DoCommand(0, DoCommand(0,
(_patches.autorenew << 15 ) | (_patches.autorenew_months << 16) | 4, (_settings.gui.autorenew << 15 ) | (_settings.gui.autorenew_months << 16) | 4,
_patches.autorenew_money, _settings.gui.autorenew_money,
DC_EXEC, DC_EXEC,
CMD_SET_AUTOREPLACE CMD_SET_AUTOREPLACE
); );
@ -1122,7 +1122,7 @@ void LoadFromHighScore()
} }
/* Initialize end of game variable (when to show highscore chart) */ /* Initialize end of game variable (when to show highscore chart) */
_patches.ending_year = 2051; _settings.gui.ending_year = 2051;
} }
/* Save/load of players */ /* Save/load of players */

View File

@ -292,7 +292,7 @@ static CommandCost CheckRailSlope(Slope tileh, TrackBits rail_bits, TrackBits ex
/* check track/slope combination */ /* check track/slope combination */
if ((f_new == FOUNDATION_INVALID) || if ((f_new == FOUNDATION_INVALID) ||
((f_new != FOUNDATION_NONE) && (!_patches.build_on_slopes || _is_old_ai_player)) ((f_new != FOUNDATION_NONE) && (!_settings.construction.build_on_slopes || _is_old_ai_player))
) return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION); ) return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
Foundation f_old = GetRailFoundation(tileh, existing); Foundation f_old = GetRailFoundation(tileh, existing);
@ -756,7 +756,7 @@ CommandCost CmdBuildTrainDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p
if (tileh != SLOPE_FLAT && ( if (tileh != SLOPE_FLAT && (
_is_old_ai_player || _is_old_ai_player ||
!_patches.build_on_slopes || !_settings.construction.build_on_slopes ||
IsSteepSlope(tileh) || IsSteepSlope(tileh) ||
!CanBuildDepotByTileh(dir, tileh) !CanBuildDepotByTileh(dir, tileh)
)) { )) {
@ -1224,7 +1224,7 @@ CommandCost CmdConvertRail(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
RailType type = GetRailType(tile); RailType type = GetRailType(tile);
/* Converting to the same type or converting 'hidden' elrail -> rail */ /* Converting to the same type or converting 'hidden' elrail -> rail */
if (type == totype || (_patches.disable_elrails && totype == RAILTYPE_RAIL && type == RAILTYPE_ELECTRIC)) continue; if (type == totype || (_settings.vehicle.disable_elrails && totype == RAILTYPE_RAIL && type == RAILTYPE_ELECTRIC)) continue;
/* Trying to convert other's rail */ /* Trying to convert other's rail */
if (!CheckTileOwnership(tile)) continue; if (!CheckTileOwnership(tile)) continue;
@ -1420,7 +1420,7 @@ static uint GetSaveSlopeZ(uint x, uint y, Track track)
static void DrawSingleSignal(TileIndex tile, Track track, byte condition, uint image, uint pos) static void DrawSingleSignal(TileIndex tile, Track track, byte condition, uint image, uint pos)
{ {
bool side = (_opt.road_side != 0) && _patches.signal_side; bool side = (_opt.road_side != 0) && _settings.construction.signal_side;
static const Point SignalPositions[2][12] = { static const Point SignalPositions[2][12] = {
{ /* Signals on the left side */ { /* Signals on the left side */
/* LEFT LEFT RIGHT RIGHT UPPER UPPER */ /* LEFT LEFT RIGHT RIGHT UPPER UPPER */
@ -2329,7 +2329,7 @@ static VehicleEnterTileStatus VehicleEnter_Track(Vehicle *v, TileIndex tile, int
*/ */
static CommandCost TestAutoslopeOnRailTile(TileIndex tile, uint flags, uint z_old, Slope tileh_old, uint z_new, Slope tileh_new, TrackBits rail_bits) static CommandCost TestAutoslopeOnRailTile(TileIndex tile, uint flags, uint z_old, Slope tileh_old, uint z_new, Slope tileh_new, TrackBits rail_bits)
{ {
if (!_patches.build_on_slopes || !AutoslopeEnabled()) return CMD_ERROR; if (!_settings.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() ? */ /* 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; if (CmdFailed(CheckRailSlope(tileh_new, rail_bits, TRACK_BIT_NONE, tile))) return CMD_ERROR;
@ -2405,7 +2405,7 @@ static CommandCost TerraformTile_Track(TileIndex tile, uint32 flags, uint z_new,
/* allow terraforming */ /* allow terraforming */
return CommandCost(EXPENSES_CONSTRUCTION, was_water ? _price.clear_water : (Money)0); return CommandCost(EXPENSES_CONSTRUCTION, was_water ? _price.clear_water : (Money)0);
} else { } else {
if (_patches.build_on_slopes && AutoslopeEnabled()) { if (_settings.construction.build_on_slopes && AutoslopeEnabled()) {
switch (GetRailTileType(tile)) { switch (GetRailTileType(tile)) {
case RAIL_TILE_WAYPOINT: { case RAIL_TILE_WAYPOINT: {
CommandCost cost = TestAutoslopeOnRailTile(tile, flags, z_old, tileh_old, z_new, tileh_new, GetRailWaypointBits(tile)); CommandCost cost = TestAutoslopeOnRailTile(tile, flags, z_old, tileh_old, z_new, tileh_new, GetRailWaypointBits(tile));

View File

@ -182,7 +182,7 @@ static void PlaceRail_Station(TileIndex tile)
VpSetPlaceSizingLimit(-1); VpSetPlaceSizingLimit(-1);
} else if (_railstation.dragdrop) { } else if (_railstation.dragdrop) {
VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED, DDSP_BUILD_STATION); VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED, DDSP_BUILD_STATION);
VpSetPlaceSizingLimit(_patches.station_spread); VpSetPlaceSizingLimit(_settings.station.station_spread);
} else { } else {
DoCommandP(tile, DoCommandP(tile,
_railstation.orientation | (_railstation.numtracks << 8) | (_railstation.platlength << 16) | (_ctrl_pressed << 24), _railstation.orientation | (_railstation.numtracks << 8) | (_railstation.platlength << 16) | (_ctrl_pressed << 24),
@ -227,7 +227,7 @@ static void GenericPlaceSignals(TileIndex tile)
SB(p1, 7, 1, _convert_signal_button); SB(p1, 7, 1, _convert_signal_button);
} else { } else {
SB(p1, 3, 1, _ctrl_pressed); SB(p1, 3, 1, _ctrl_pressed);
SB(p1, 4, 1, (_cur_year < _patches.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC)); SB(p1, 4, 1, (_cur_year < _settings.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC));
SB(p1, 5, 2, SIGTYPE_NORMAL); SB(p1, 5, 2, SIGTYPE_NORMAL);
SB(p1, 7, 1, 0); SB(p1, 7, 1, 0);
} }
@ -429,7 +429,7 @@ static void BuildRailClick_Station(Window *w)
*/ */
static void BuildRailClick_AutoSignals(Window *w) static void BuildRailClick_AutoSignals(Window *w)
{ {
if (_patches.enable_signal_gui != _ctrl_pressed) { if (_settings.gui.enable_signal_gui != _ctrl_pressed) {
if (HandlePlacePushButton(w, RTW_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, VHM_RECT, PlaceRail_AutoSignals)) ShowSignalBuilder(w); if (HandlePlacePushButton(w, RTW_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, VHM_RECT, PlaceRail_AutoSignals)) ShowSignalBuilder(w);
} else { } else {
HandlePlacePushButton(w, RTW_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, VHM_RECT, PlaceRail_AutoSignals); HandlePlacePushButton(w, RTW_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, VHM_RECT, PlaceRail_AutoSignals);
@ -484,7 +484,7 @@ static void BuildRailClick_Remove(Window *w)
if (_railstation.orientation == 0) Swap(x, y); if (_railstation.orientation == 0) Swap(x, y);
SetTileSelectSize(x, y); SetTileSelectSize(x, y);
} else { } else {
VpSetPlaceSizingLimit(_patches.station_spread); VpSetPlaceSizingLimit(_settings.station.station_spread);
} }
} }
} }
@ -547,15 +547,15 @@ static void HandleAutoSignalPlacement()
SB(p2, 3, 1, 0); SB(p2, 3, 1, 0);
SB(p2, 4, 1, _cur_signal_variant); SB(p2, 4, 1, _cur_signal_variant);
SB(p2, 6, 1, _ctrl_pressed); SB(p2, 6, 1, _ctrl_pressed);
SB(p2, 24, 8, _patches.drag_signals_density); SB(p2, 24, 8, _settings.gui.drag_signals_density);
} else { } else {
SB(p2, 3, 1, 0); SB(p2, 3, 1, 0);
SB(p2, 4, 1, (_cur_year < _patches.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC)); SB(p2, 4, 1, (_cur_year < _settings.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC));
SB(p2, 6, 1, _ctrl_pressed); SB(p2, 6, 1, _ctrl_pressed);
SB(p2, 24, 8, _patches.drag_signals_density); SB(p2, 24, 8, _settings.gui.drag_signals_density);
} }
/* _patches.drag_signals_density is given as a parameter such that each user /* _settings.gui.drag_signals_density is given as a parameter such that each user
* in a network game can specify his/her own signal density */ * in a network game can specify his/her own signal density */
DoCommandP( DoCommandP(
TileVirtXY(thd->selstart.x, thd->selstart.y), TileVirtXY(thd->selstart.x, thd->selstart.y),
@ -617,12 +617,12 @@ struct BuildRailToolbarWindow : Window {
this->DisableWidget(RTW_REMOVE); this->DisableWidget(RTW_REMOVE);
this->FindWindowPlacementAndResize(desc); this->FindWindowPlacementAndResize(desc);
if (_patches.link_terraform_toolbar) ShowTerraformToolbar(this); if (_settings.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
} }
~BuildRailToolbarWindow() ~BuildRailToolbarWindow()
{ {
if (_patches.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0); if (_settings.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
} }
void UpdateRemoveWidgetStatus(int clicked_widget) void UpdateRemoveWidgetStatus(int clicked_widget)
@ -1008,13 +1008,13 @@ public:
SetTileSelectSize(x, y); SetTileSelectSize(x, y);
} }
int rad = (_patches.modified_catchment) ? CA_TRAIN : CA_UNMODIFIED; int rad = (_settings.station.modified_catchment) ? CA_TRAIN : CA_UNMODIFIED;
if (_station_show_coverage) if (_station_show_coverage)
SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad); SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
for (uint bits = 0; bits < 7; bits++) { for (uint bits = 0; bits < 7; bits++) {
bool disable = bits >= _patches.station_spread; bool disable = bits >= _settings.station.station_spread;
if (statspec == NULL) { if (statspec == NULL) {
this->SetWidgetDisabledState(bits + BRSW_PLATFORM_NUM_1, disable); this->SetWidgetDisabledState(bits + BRSW_PLATFORM_NUM_1, disable);
this->SetWidgetDisabledState(bits + BRSW_PLATFORM_LEN_1, disable); this->SetWidgetDisabledState(bits + BRSW_PLATFORM_LEN_1, disable);
@ -1390,8 +1390,8 @@ public:
this->SetWidgetLoweredState(BSW_CONVERT, _convert_signal_button); this->SetWidgetLoweredState(BSW_CONVERT, _convert_signal_button);
this->SetWidgetDisabledState(BSW_DRAG_SIGNALS_DENSITY_DECREASE, _patches.drag_signals_density == 1); this->SetWidgetDisabledState(BSW_DRAG_SIGNALS_DENSITY_DECREASE, _settings.gui.drag_signals_density == 1);
this->SetWidgetDisabledState(BSW_DRAG_SIGNALS_DENSITY_INCREASE, _patches.drag_signals_density == 20); this->SetWidgetDisabledState(BSW_DRAG_SIGNALS_DENSITY_INCREASE, _settings.gui.drag_signals_density == 20);
this->DrawWidgets(); this->DrawWidgets();
@ -1406,7 +1406,7 @@ public:
this->DrawSignalSprite(BSW_ELECTRIC_COMBO, SPR_IMG_SIGNAL_ELECTRIC_COMBO, -2, 6); this->DrawSignalSprite(BSW_ELECTRIC_COMBO, SPR_IMG_SIGNAL_ELECTRIC_COMBO, -2, 6);
/* Draw dragging signal density value in the BSW_DRAG_SIGNALS_DENSITY widget */ /* Draw dragging signal density value in the BSW_DRAG_SIGNALS_DENSITY widget */
SetDParam(0, _patches.drag_signals_density); SetDParam(0, _settings.gui.drag_signals_density);
DrawStringCentered(this->widget[BSW_DRAG_SIGNALS_DENSITY].left + (this->widget[BSW_DRAG_SIGNALS_DENSITY].right - 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].left) / 2 + 1,
this->widget[BSW_DRAG_SIGNALS_DENSITY].top + 2, STR_JUST_INT, TC_ORANGE); this->widget[BSW_DRAG_SIGNALS_DENSITY].top + 2, STR_JUST_INT, TC_ORANGE);
@ -1434,15 +1434,15 @@ public:
break; break;
case BSW_DRAG_SIGNALS_DENSITY_DECREASE: case BSW_DRAG_SIGNALS_DENSITY_DECREASE:
if (_patches.drag_signals_density > 1) { if (_settings.gui.drag_signals_density > 1) {
_patches.drag_signals_density--; _settings.gui.drag_signals_density--;
SetWindowDirty(FindWindowById(WC_GAME_OPTIONS, 0)); SetWindowDirty(FindWindowById(WC_GAME_OPTIONS, 0));
} }
break; break;
case BSW_DRAG_SIGNALS_DENSITY_INCREASE: case BSW_DRAG_SIGNALS_DENSITY_INCREASE:
if (_patches.drag_signals_density < 20) { if (_settings.gui.drag_signals_density < 20) {
_patches.drag_signals_density++; _settings.gui.drag_signals_density++;
SetWindowDirty(FindWindowById(WC_GAME_OPTIONS, 0)); SetWindowDirty(FindWindowById(WC_GAME_OPTIONS, 0));
} }
break; break;
@ -1701,7 +1701,7 @@ static void SetDefaultRailGui()
if (_local_player == PLAYER_SPECTATOR || !IsValidPlayer(_local_player)) return; if (_local_player == PLAYER_SPECTATOR || !IsValidPlayer(_local_player)) return;
extern RailType _last_built_railtype; extern RailType _last_built_railtype;
RailType rt = (RailType)_patches.default_rail_type; RailType rt = (RailType)_settings.gui.default_rail_type;
if (rt >= RAILTYPE_END) { if (rt >= RAILTYPE_END) {
if (rt == RAILTYPE_END + 2) { if (rt == RAILTYPE_END + 2) {
/* Find the most used rail type */ /* Find the most used rail type */
@ -1753,7 +1753,7 @@ static void SetDefaultRailGui()
*/ */
int32 ResetSignalVariant(int32 = 0) int32 ResetSignalVariant(int32 = 0)
{ {
SignalVariant new_variant = (_cur_year < _patches.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC); SignalVariant new_variant = (_cur_year < _settings.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC);
if (new_variant != _cur_signal_variant) { if (new_variant != _cur_signal_variant) {
Window *w = FindWindowById(WC_BUILD_SIGNAL, 0); Window *w = FindWindowById(WC_BUILD_SIGNAL, 0);

View File

@ -182,7 +182,7 @@ bool CheckAllowRemoveRoad(TileIndex tile, RoadBits remove, Owner owner, RoadType
* then allow it */ * then allow it */
if (KillFirstBit(n) != ROAD_NONE && (n & remove) != ROAD_NONE) { if (KillFirstBit(n) != ROAD_NONE && (n & remove) != ROAD_NONE) {
/* you can remove all kind of roads with extra dynamite */ /* you can remove all kind of roads with extra dynamite */
if (!_patches.extra_dynamite) { if (!_settings.construction.extra_dynamite) {
SetDParam(0, t->index); SetDParam(0, t->index);
_error_message = STR_2009_LOCAL_AUTHORITY_REFUSES; _error_message = STR_2009_LOCAL_AUTHORITY_REFUSES;
return false; return false;
@ -279,7 +279,7 @@ static CommandCost RemoveRoad(TileIndex tile, uint32 flags, RoadBits pieces, Roa
* @li if build on slopes is disabled */ * @li if build on slopes is disabled */
if (IsSteepSlope(tileh) || (IsStraightRoad(other) && if (IsSteepSlope(tileh) || (IsStraightRoad(other) &&
(other & _invalid_tileh_slopes_road[0][tileh & SLOPE_ELEVATED]) != ROAD_NONE) || (other & _invalid_tileh_slopes_road[0][tileh & SLOPE_ELEVATED]) != ROAD_NONE) ||
(tileh != SLOPE_FLAT && !_patches.build_on_slopes)) { (tileh != SLOPE_FLAT && !_settings.construction.build_on_slopes)) {
pieces |= MirrorRoadBits(pieces); pieces |= MirrorRoadBits(pieces);
} }
@ -419,7 +419,7 @@ static CommandCost CheckRoadSlope(Slope tileh, RoadBits *pieces, RoadBits existi
RoadBits type_bits = existing | *pieces; RoadBits type_bits = existing | *pieces;
/* Roads on slopes */ /* Roads on slopes */
if (_patches.build_on_slopes && (_invalid_tileh_slopes_road[0][tileh] & (other | type_bits)) == ROAD_NONE) { if (_settings.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 we add leveling we've got to pay for it */
if ((other | existing) == ROAD_NONE) return CommandCost(EXPENSES_CONSTRUCTION, _price.terraform); if ((other | existing) == ROAD_NONE) return CommandCost(EXPENSES_CONSTRUCTION, _price.terraform);
@ -439,7 +439,7 @@ static CommandCost CheckRoadSlope(Slope tileh, RoadBits *pieces, RoadBits existi
if (IsSlopeWithOneCornerRaised(tileh)) { if (IsSlopeWithOneCornerRaised(tileh)) {
/* Prevent build on slopes if it isn't allowed */ /* Prevent build on slopes if it isn't allowed */
if (_patches.build_on_slopes) { if (_settings.construction.build_on_slopes) {
/* If we add foundation we've got to pay for it */ /* If we add foundation we've got to pay for it */
if ((other | existing) == ROAD_NONE) return CommandCost(EXPENSES_CONSTRUCTION, _price.terraform); 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); CommandCost ret = CheckRoadSlope(tileh, &pieces, existing, other_bits);
/* Return an error if we need to build a foundation (ret != 0) but the /* Return an error if we need to build a foundation (ret != 0) but the
* current patch-setting is turned off (or stupid AI@work) */ * current patch-setting is turned off (or stupid AI@work) */
if (CmdFailed(ret) || (ret.GetCost() != 0 && !_patches.build_on_slopes)) { if (CmdFailed(ret) || (ret.GetCost() != 0 && !_settings.construction.build_on_slopes)) {
return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION); return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
} }
cost.AddCost(ret); cost.AddCost(ret);
@ -849,7 +849,7 @@ CommandCost CmdBuildRoadDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
Slope tileh = GetTileSlope(tile, NULL); Slope tileh = GetTileSlope(tile, NULL);
if (tileh != SLOPE_FLAT && ( if (tileh != SLOPE_FLAT && (
!_patches.build_on_slopes || !_settings.construction.build_on_slopes ||
IsSteepSlope(tileh) || IsSteepSlope(tileh) ||
!CanBuildDepotByTileh(dir, tileh) !CanBuildDepotByTileh(dir, tileh)
)) { )) {
@ -1359,7 +1359,7 @@ static void TileLoop_Road(TileIndex tile)
} else if (IncreaseRoadWorksCounter(tile)) { } else if (IncreaseRoadWorksCounter(tile)) {
TerminateRoadWorks(tile); TerminateRoadWorks(tile);
if (_patches.mod_road_rebuild) { if (_settings.economy.mod_road_rebuild) {
/* Generate a nicer town surface */ /* Generate a nicer town surface */
const RoadBits old_rb = GetAnyRoadBits(tile, ROADTYPE_ROAD); const RoadBits old_rb = GetAnyRoadBits(tile, ROADTYPE_ROAD);
const RoadBits new_rb = CleanUpRoadBits(tile, old_rb); const RoadBits new_rb = CleanUpRoadBits(tile, old_rb);
@ -1570,7 +1570,7 @@ static void ChangeTileOwner_Road(TileIndex tile, PlayerID old_player, PlayerID n
static CommandCost TerraformTile_Road(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new) static CommandCost TerraformTile_Road(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
{ {
if (_patches.build_on_slopes && AutoslopeEnabled()) { if (_settings.construction.build_on_slopes && AutoslopeEnabled()) {
switch (GetRoadTileType(tile)) { switch (GetRoadTileType(tile)) {
case ROAD_TILE_CROSSING: 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); if (!IsSteepSlope(tileh_new) && (GetTileMaxZ(tile) == z_new + GetSlopeMaxZ(tileh_new)) && HasBit(VALID_LEVEL_CROSSING_SLOPES, tileh_new)) return CommandCost(EXPENSES_CONSTRUCTION, _price.terraform);

View File

@ -409,12 +409,12 @@ struct BuildRoadToolbarWindow : Window {
WIDGET_LIST_END); WIDGET_LIST_END);
this->FindWindowPlacementAndResize(desc); this->FindWindowPlacementAndResize(desc);
if (_patches.link_terraform_toolbar) ShowTerraformToolbar(this); if (_settings.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
} }
~BuildRoadToolbarWindow() ~BuildRoadToolbarWindow()
{ {
if (_patches.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0); if (_settings.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
} }
/** /**
@ -839,7 +839,7 @@ public:
this->DrawWidgets(); this->DrawWidgets();
if (_station_show_coverage) { if (_station_show_coverage) {
int rad = _patches.modified_catchment ? CA_TRUCK /* = CA_BUS */ : CA_UNMODIFIED; int rad = _settings.station.modified_catchment ? CA_TRUCK /* = CA_BUS */ : CA_UNMODIFIED;
SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad); SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
} else { } else {
SetTileSelectSize(1, 1); SetTileSelectSize(1, 1);

View File

@ -205,7 +205,7 @@ CommandCost CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
/* find the first free roadveh id */ /* find the first free roadveh id */
unit_num = HasBit(p2, 0) ? 0 : GetFreeUnitNumber(VEH_ROAD); unit_num = HasBit(p2, 0) ? 0 : GetFreeUnitNumber(VEH_ROAD);
if (unit_num > _patches.max_roadveh) if (unit_num > _settings.vehicle.max_roadveh)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME); return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
@ -257,7 +257,7 @@ CommandCost CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v->name = NULL; v->name = NULL;
v->service_interval = _patches.servint_roadveh; v->service_interval = _settings.vehicle.servint_roadveh;
v->date_of_last_service = _date; v->date_of_last_service = _date;
v->build_year = _cur_year; v->build_year = _cur_year;
@ -419,7 +419,7 @@ static bool EnumRoadSignalFindDepot(TileIndex tile, void* data, Trackdir trackdi
static const Depot* FindClosestRoadDepot(const Vehicle* v) static const Depot* FindClosestRoadDepot(const Vehicle* v)
{ {
switch (_patches.pathfinder_for_roadvehs) { switch (_settings.pf.pathfinder_for_roadvehs) {
case VPF_YAPF: /* YAPF */ case VPF_YAPF: /* YAPF */
return YapfFindNearestRoadDepot(v); return YapfFindNearestRoadDepot(v);
@ -863,7 +863,7 @@ static bool RoadVehAccelerate(Vehicle *v)
/* updates statusbar only if speed have changed to save CPU time */ /* updates statusbar only if speed have changed to save CPU time */
if (spd != v->cur_speed) { if (spd != v->cur_speed) {
v->cur_speed = spd; v->cur_speed = spd;
if (_patches.vehicle_speed) { if (_settings.gui.vehicle_speed) {
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
} }
@ -1085,7 +1085,7 @@ static Trackdir RoadFindPathToDest(Vehicle* v, TileIndex tile, DiagDirection ent
trackdirs = TRACKDIR_BIT_NONE; trackdirs = TRACKDIR_BIT_NONE;
} else { } else {
/* Proper station type, check if there is free loading bay */ /* Proper station type, check if there is free loading bay */
if (!_patches.roadveh_queue && IsStandardRoadStopTile(tile) && if (!_settings.pf.roadveh_queue && IsStandardRoadStopTile(tile) &&
!GetRoadStopByTile(tile, rstype)->HasFreeBay()) { !GetRoadStopByTile(tile, rstype)->HasFreeBay()) {
/* Station is full and RV queuing is off */ /* Station is full and RV queuing is off */
trackdirs = TRACKDIR_BIT_NONE; trackdirs = TRACKDIR_BIT_NONE;
@ -1124,7 +1124,7 @@ static Trackdir RoadFindPathToDest(Vehicle* v, TileIndex tile, DiagDirection ent
return_track(FindFirstBit2x64(trackdirs)); return_track(FindFirstBit2x64(trackdirs));
} }
switch (_patches.pathfinder_for_roadvehs) { switch (_settings.pf.pathfinder_for_roadvehs) {
case VPF_YAPF: { /* YAPF */ case VPF_YAPF: { /* YAPF */
Trackdir trackdir = YapfChooseRoadTrack(v, tile, enterdir); Trackdir trackdir = YapfChooseRoadTrack(v, tile, enterdir);
if (trackdir != INVALID_TRACKDIR) return_track(trackdir); if (trackdir != INVALID_TRACKDIR) return_track(trackdir);
@ -1211,7 +1211,7 @@ found_best_track:;
static uint RoadFindPathToStop(const Vehicle *v, TileIndex tile) static uint RoadFindPathToStop(const Vehicle *v, TileIndex tile)
{ {
if (_patches.pathfinder_for_roadvehs == VPF_YAPF) { if (_settings.pf.pathfinder_for_roadvehs == VPF_YAPF) {
/* use YAPF */ /* use YAPF */
return YapfRoadVehDistanceToTile(v, tile); return YapfRoadVehDistanceToTile(v, tile);
} }
@ -1887,7 +1887,7 @@ void RoadVehicle::Tick()
static void CheckIfRoadVehNeedsService(Vehicle *v) static void CheckIfRoadVehNeedsService(Vehicle *v)
{ {
/* If we already got a slot at a stop, use that FIRST, and go to a depot later */ /* If we already got a slot at a stop, use that FIRST, and go to a depot later */
if (v->u.road.slot != NULL || _patches.servint_roadveh == 0 || !v->NeedsAutomaticServicing()) return; if (v->u.road.slot != NULL || _settings.vehicle.servint_roadveh == 0 || !v->NeedsAutomaticServicing()) return;
if (v->IsInDepot()) { if (v->IsInDepot()) {
VehicleServiceInDepot(v); VehicleServiceInDepot(v);
return; return;

View File

@ -1776,7 +1776,7 @@ SaveOrLoadResult SaveOrLoad(const char *filename, int mode, Subdirectory sb)
} }
} }
/** Do a save when exiting the game (patch option) _patches.autosave_on_exit */ /** Do a save when exiting the game (patch option) _settings.gui.autosave_on_exit */
void DoExitSave() void DoExitSave()
{ {
SaveOrLoad("exit.sav", SL_SAVE, AUTOSAVE_DIR); SaveOrLoad("exit.sav", SL_SAVE, AUTOSAVE_DIR);

View File

@ -65,8 +65,8 @@
GameOptions _opt; GameOptions _opt;
GameOptions _opt_newgame; GameOptions _opt_newgame;
Patches _patches; Settings _settings;
Patches _patches_newgame; Settings _settings_newgame;
struct IniFile; struct IniFile;
struct IniItem; struct IniItem;
@ -343,6 +343,28 @@ static IniGroup *ini_getgroup(IniFile *ini, const char *name, size_t len = 0)
return group; return group;
} }
static void ini_removegroup(IniFile *ini, const char *name)
{
size_t len = strlen(name);
IniGroup *prev = NULL;
IniGroup *group;
/* does it exist already? */
for (group = ini->group; group != NULL; prev = group, group = group->next) {
if (memcmp(group->name, name, len) == 0) {
break;
}
}
if (group == NULL) return;
if (prev != NULL) {
prev->next = prev->next->next;
} else {
ini->group = ini->group->next;
}
}
/** lookup an item or make a new one */ /** lookup an item or make a new one */
static IniItem *ini_getitem(IniGroup *group, const char *name, bool create) static IniItem *ini_getitem(IniGroup *group, const char *name, bool create)
{ {
@ -720,7 +742,7 @@ static void ini_load_settings(IniFile *ini, const SettingDesc *sd, const char *g
if (!SlIsObjectCurrentlyValid(sld->version_from, sld->version_to)) continue; if (!SlIsObjectCurrentlyValid(sld->version_from, sld->version_to)) continue;
/* XXX - wtf is this?? (group override?) */ /* For patches.xx.yy load the settings from [xx] yy = ? */
s = strchr(sdb->name, '.'); s = strchr(sdb->name, '.');
if (s != NULL) { if (s != NULL) {
group = ini_getgroup(ini, sdb->name, s - sdb->name); group = ini_getgroup(ini, sdb->name, s - sdb->name);
@ -731,6 +753,18 @@ static void ini_load_settings(IniFile *ini, const SettingDesc *sd, const char *g
} }
item = ini_getitem(group, s, false); item = ini_getitem(group, s, false);
if (item == NULL && group != group_def) {
/* For patches.xx.yy load the settings from [patches] yy = ? in case the previous
* did not exist (e.g. loading old config files with a [patches] section */
item = ini_getitem(group_def, s, false);
}
if (item == NULL) {
/* For patches.xx.zz.yy load the settings from [zz] yy = ? in case the previous
* did not exist (e.g. loading old config files with a [yapf] section */
const char *sc = strchr(s, '.');
if (sc != NULL) item = ini_getitem(ini_getgroup(ini, s, sc - s), sc + 1, false);
}
p = (item == NULL) ? sdb->def : string_to_val(sdb, item->value); p = (item == NULL) ? sdb->def : string_to_val(sdb, item->value);
ptr = GetVariableAddress(object, sld); ptr = GetVariableAddress(object, sld);
@ -1120,7 +1154,7 @@ static int32 Ai_In_Multiplayer_Warning(int32 p1)
{ {
if (p1 == 1) { if (p1 == 1) {
ShowErrorMessage(INVALID_STRING_ID, TEMP_AI_MULTIPLAYER, 0, 0); ShowErrorMessage(INVALID_STRING_ID, TEMP_AI_MULTIPLAYER, 0, 0);
_patches.ainew_active = true; _settings.ai.ainew_active = true;
} }
return 0; return 0;
} }
@ -1186,7 +1220,7 @@ static int32 UpdateConsists(int32 p1)
static int32 CheckInterval(int32 p1) static int32 CheckInterval(int32 p1)
{ {
bool warning; bool warning;
const Patches *ptc = (_game_mode == GM_MENU) ? &_patches_newgame : &_patches; const VehicleSettings *ptc = (_game_mode == GM_MENU) ? &_settings_newgame.vehicle : &_settings.vehicle;
if (p1) { if (p1) {
warning = ( (IsInsideMM(ptc->servint_trains, 5, 90 + 1) || ptc->servint_trains == 0) && warning = ( (IsInsideMM(ptc->servint_trains, 5, 90 + 1) || ptc->servint_trains == 0) &&
@ -1208,19 +1242,19 @@ static int32 CheckInterval(int32 p1)
static int32 EngineRenewUpdate(int32 p1) static int32 EngineRenewUpdate(int32 p1)
{ {
DoCommandP(0, 0, _patches.autorenew, NULL, CMD_SET_AUTOREPLACE); DoCommandP(0, 0, _settings.gui.autorenew, NULL, CMD_SET_AUTOREPLACE);
return 0; return 0;
} }
static int32 EngineRenewMonthsUpdate(int32 p1) static int32 EngineRenewMonthsUpdate(int32 p1)
{ {
DoCommandP(0, 1, _patches.autorenew_months, NULL, CMD_SET_AUTOREPLACE); DoCommandP(0, 1, _settings.gui.autorenew_months, NULL, CMD_SET_AUTOREPLACE);
return 0; return 0;
} }
static int32 EngineRenewMoneyUpdate(int32 p1) static int32 EngineRenewMoneyUpdate(int32 p1)
{ {
DoCommandP(0, 2, _patches.autorenew_money, NULL, CMD_SET_AUTOREPLACE); DoCommandP(0, 2, _settings.gui.autorenew_money, NULL, CMD_SET_AUTOREPLACE);
return 0; return 0;
} }
@ -1252,9 +1286,9 @@ static int32 DragSignalsDensityChanged(int32)
*/ */
static int32 CheckTownLayout(int32 p1) static int32 CheckTownLayout(int32 p1)
{ {
if (_patches.town_layout == TL_NO_ROADS && _game_mode == GM_EDITOR) { if (_settings.economy.town_layout == TL_NO_ROADS && _game_mode == GM_EDITOR) {
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_PATCHES_TOWN_LAYOUT_INVALID, 0, 0); ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_PATCHES_TOWN_LAYOUT_INVALID, 0, 0);
_patches.town_layout = TL_ORIGINAL; _settings.economy.town_layout = TL_ORIGINAL;
} }
return 0; return 0;
} }
@ -1279,9 +1313,9 @@ static int32 ConvertLandscape(const char *value)
* So basically, 200, 400, 800 are the lowest allowed values */ * So basically, 200, 400, 800 are the lowest allowed values */
static int32 CheckNoiseToleranceLevel(const char *value) static int32 CheckNoiseToleranceLevel(const char *value)
{ {
Patches *patches_ptr = (_game_mode == GM_MENU) ? &_patches_newgame : &_patches; Settings *s = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings;
for (uint16 i = 0; i < lengthof(patches_ptr->town_noise_population); i++) { for (uint16 i = 0; i < lengthof(s->economy.town_noise_population); i++) {
patches_ptr->town_noise_population[i] = max(uint16(200 * (i + 1)), patches_ptr->town_noise_population[i]); s->economy.town_noise_population[i] = max(uint16(200 * (i + 1)), s->economy.town_noise_population[i]);
} }
return 0; return 0;
} }
@ -1421,246 +1455,188 @@ static const SettingDesc _gameopt_settings[] = {
* service depot, causing desyncs on a massive scale. */ * service depot, causing desyncs on a massive scale. */
const SettingDesc _patch_settings[] = { const SettingDesc _patch_settings[] = {
/***************************************************************************/ /***************************************************************************/
/* User-interface section of the GUI-configure patches window */ /* Saved patch variables. */
SDT_BOOL(Patches, vehicle_speed, S, 0, true, STR_CONFIG_PATCHES_VEHICLESPEED, NULL),
SDT_BOOL(Patches, status_long_date, S, 0, true, STR_CONFIG_PATCHES_LONGDATE, NULL), SDT_BOOL(Settings, construction.build_on_slopes, 0,NN, true, STR_CONFIG_PATCHES_BUILDONSLOPES, NULL),
SDT_BOOL(Patches, show_finances, S, 0, true, STR_CONFIG_PATCHES_SHOWFINANCES, NULL), SDT_CONDBOOL(Settings, construction.autoslope, 75, SL_MAX_VERSION, 0, 0, true, STR_CONFIG_PATCHES_AUTOSLOPE, NULL),
SDT_BOOL(Patches, autoscroll, S, 0, false, STR_CONFIG_PATCHES_AUTOSCROLL, NULL), SDT_BOOL(Settings, construction.extra_dynamite, 0, 0, false, STR_CONFIG_PATCHES_EXTRADYNAMITE, NULL),
SDT_BOOL(Patches, reverse_scroll, S, 0, false, STR_CONFIG_PATCHES_REVERSE_SCROLLING, NULL), SDT_BOOL(Settings, construction.longbridges, 0,NN, true, STR_CONFIG_PATCHES_LONGBRIDGES, NULL),
SDT_BOOL(Patches, smooth_scroll, S, 0, false, STR_CONFIG_PATCHES_SMOOTH_SCROLLING, NULL), SDT_BOOL(Settings, construction.signal_side, N,NN, true, STR_CONFIG_PATCHES_SIGNALSIDE, RedrawScreen),
SDT_BOOL(Patches, measure_tooltip, S, 0, false, STR_CONFIG_PATCHES_MEASURE_TOOLTIP, NULL), SDT_BOOL(Settings, station.always_small_airport, 0,NN, false, STR_CONFIG_PATCHES_SMALL_AIRPORTS, NULL),
SDT_VAR(Patches, errmsg_duration, SLE_UINT8, S, 0, 5, 0, 20, 0, STR_CONFIG_PATCHES_ERRMSG_DURATION, 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_VAR(Patches, toolbar_pos, SLE_UINT8, S,MS, 0, 0, 2, 0, STR_CONFIG_PATCHES_TOOLBAR_POS, v_PositionMainToolbar),
SDT_VAR(Patches, window_snap_radius, SLE_UINT8, S,D0, 10, 1, 32, 0, STR_CONFIG_PATCHES_SNAP_RADIUS, NULL), SDT_BOOL(Settings, vehicle.realistic_acceleration, 0, 0, false, STR_CONFIG_PATCHES_REALISTICACCEL, RealisticAccelerationChanged),
SDT_BOOL(Patches, population_in_label, S, 0, true, STR_CONFIG_PATCHES_POPULATION_IN_LABEL, PopulationInLabelActive), SDT_BOOL(Settings, pf.forbid_90_deg, 0, 0, false, STR_CONFIG_PATCHES_FORBID_90_DEG, NULL),
SDT_VAR(Patches, map_x, SLE_UINT8, S, 0, 8, 6, 11, 0, STR_CONFIG_PATCHES_MAP_X, NULL), SDT_BOOL(Settings, vehicle.mammoth_trains, 0,NN, true, STR_CONFIG_PATCHES_MAMMOTHTRAINS, NULL),
SDT_VAR(Patches, map_y, SLE_UINT8, S, 0, 8, 6, 11, 0, STR_CONFIG_PATCHES_MAP_Y, NULL), SDT_BOOL(Settings, order.gotodepot, 0, 0, true, STR_CONFIG_PATCHES_GOTODEPOT, NULL),
SDT_BOOL(Patches, link_terraform_toolbar, S, 0, false, STR_CONFIG_PATCHES_LINK_TERRAFORM_TOOLBAR,NULL), SDT_BOOL(Settings, pf.roadveh_queue, 0, 0, true, STR_CONFIG_PATCHES_ROADVEH_QUEUE, NULL),
SDT_VAR(Patches, liveries, SLE_UINT8, S,MS, 2, 0, 2, 0, STR_CONFIG_PATCHES_LIVERIES, RedrawScreen),
SDT_BOOL(Patches, prefer_teamchat, S, 0, false, STR_CONFIG_PATCHES_PREFER_TEAMCHAT, NULL), SDT_CONDBOOL(Settings, pf.new_pathfinding_all, 0, 86, 0, 0, false, STR_NULL, NULL),
SDT_VAR(Patches, scrollwheel_scrolling,SLE_UINT8,S,MS, 0, 0, 2, 0, STR_CONFIG_PATCHES_SCROLLWHEEL_SCROLLING, NULL), SDT_CONDBOOL(Settings, pf.yapf.ship_use_yapf, 28, 86, 0, 0, false, STR_NULL, NULL),
SDT_VAR(Patches,scrollwheel_multiplier,SLE_UINT8,S, 0, 5, 1, 15, 1, STR_CONFIG_PATCHES_SCROLLWHEEL_MULTIPLIER,NULL), SDT_CONDBOOL(Settings, pf.yapf.road_use_yapf, 28, 86, 0, 0, true, STR_NULL, NULL),
SDT_BOOL(Patches, pause_on_newgame, S, 0, false, STR_CONFIG_PATCHES_PAUSE_ON_NEW_GAME, NULL), SDT_CONDBOOL(Settings, pf.yapf.rail_use_yapf, 28, 86, 0, 0, true, STR_NULL, NULL),
SDT_VAR(Patches,advanced_vehicle_list,SLE_UINT8,S,MS, 1, 0, 2, 0, STR_CONFIG_PATCHES_ADVANCED_VEHICLE_LISTS,NULL),
SDT_BOOL(Patches, timetable_in_ticks, S, 0, false, STR_CONFIG_PATCHES_TIMETABLE_IN_TICKS, 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_VAR(Patches, loading_indicators, SLE_UINT8, S,MS, 1, 0, 2, 0, STR_CONFIG_PATCHES_LOADING_INDICATORS, RedrawScreen), 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_VAR(Patches, default_rail_type, SLE_UINT8, S,MS, 4, 0, 6, 0, STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE, 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_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(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(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(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_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(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(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_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_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),
/***************************************************************************/ /***************************************************************************/
/* Construction section of the GUI-configure patches window */ /* Unsaved patch variables. */
SDT_BOOL(Patches, build_on_slopes, 0,NN, true, STR_CONFIG_PATCHES_BUILDONSLOPES, NULL), SDT_BOOL(Settings, gui.vehicle_speed, S, 0, true, STR_CONFIG_PATCHES_VEHICLESPEED, NULL),
SDT_CONDBOOL(Patches, autoslope, 75, SL_MAX_VERSION, 0, 0, true, STR_CONFIG_PATCHES_AUTOSLOPE, NULL), SDT_BOOL(Settings, gui.status_long_date, S, 0, true, STR_CONFIG_PATCHES_LONGDATE, NULL),
SDT_BOOL(Patches, extra_dynamite, 0, 0, false, STR_CONFIG_PATCHES_EXTRADYNAMITE, NULL), SDT_BOOL(Settings, gui.show_finances, S, 0, true, STR_CONFIG_PATCHES_SHOWFINANCES, NULL),
SDT_BOOL(Patches, longbridges, 0,NN, true, STR_CONFIG_PATCHES_LONGBRIDGES, NULL), SDT_BOOL(Settings, gui.autoscroll, S, 0, false, STR_CONFIG_PATCHES_AUTOSCROLL, NULL),
SDT_BOOL(Patches, signal_side, N,NN, true, STR_CONFIG_PATCHES_SIGNALSIDE, RedrawScreen), SDT_BOOL(Settings, gui.reverse_scroll, S, 0, false, STR_CONFIG_PATCHES_REVERSE_SCROLLING, NULL),
SDT_BOOL(Patches, always_small_airport, 0,NN, false, STR_CONFIG_PATCHES_SMALL_AIRPORTS, NULL), SDT_BOOL(Settings, gui.smooth_scroll, S, 0, false, STR_CONFIG_PATCHES_SMOOTH_SCROLLING, NULL),
SDT_BOOL(Patches, enable_signal_gui, S, 0, false, STR_CONFIG_PATCHES_ENABLE_SIGNAL_GUI, CloseSignalGUI), SDT_BOOL(Settings, gui.measure_tooltip, S, 0, false, STR_CONFIG_PATCHES_MEASURE_TOOLTIP, NULL),
SDT_VAR(Patches, drag_signals_density,SLE_UINT8,S, 0, 4, 1, 20, 0, STR_CONFIG_PATCHES_DRAG_SIGNALS_DENSITY,DragSignalsDensityChanged), SDT_VAR(Settings, gui.errmsg_duration, SLE_UINT8, S, 0, 5, 0, 20, 0, STR_CONFIG_PATCHES_ERRMSG_DURATION, NULL),
SDT_VAR(Patches, semaphore_build_before,SLE_INT32, S, NC, 1975, MIN_YEAR, MAX_YEAR, 1, STR_CONFIG_PATCHES_SEMAPHORE_BUILD_BEFORE_DATE, ResetSignalVariant), SDT_VAR(Settings, gui.toolbar_pos, SLE_UINT8, S,MS, 0, 0, 2, 0, STR_CONFIG_PATCHES_TOOLBAR_POS, v_PositionMainToolbar),
SDT_CONDVAR(Patches, 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_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, game_creation.map_x, SLE_UINT8, S, 0, 8, 6, 11, 0, STR_CONFIG_PATCHES_MAP_X, NULL),
/* Vehicle section of the GUI-configure patches window */ SDT_VAR(Settings, game_creation.map_y, SLE_UINT8, S, 0, 8, 6, 11, 0, STR_CONFIG_PATCHES_MAP_Y, NULL),
SDT_BOOL(Patches, realistic_acceleration, 0, 0, false, STR_CONFIG_PATCHES_REALISTICACCEL, RealisticAccelerationChanged),
SDT_BOOL(Patches, forbid_90_deg, 0, 0, false, STR_CONFIG_PATCHES_FORBID_90_DEG, NULL),
SDT_BOOL(Patches, mammoth_trains, 0,NN, true, STR_CONFIG_PATCHES_MAMMOTHTRAINS, NULL),
SDT_BOOL(Patches, gotodepot, 0, 0, true, STR_CONFIG_PATCHES_GOTODEPOT, NULL),
SDT_BOOL(Patches, roadveh_queue, 0, 0, true, STR_CONFIG_PATCHES_ROADVEH_QUEUE, NULL),
SDT_CONDBOOL(Patches, new_pathfinding_all, 0,86, 0, 0, false, STR_NULL, NULL),
SDT_CONDBOOL(Patches, yapf.ship_use_yapf, 28,86, 0, 0, false, STR_NULL, NULL),
SDT_CONDBOOL(Patches, yapf.road_use_yapf, 28,86, 0, 0, true, STR_NULL, NULL),
SDT_CONDBOOL(Patches, yapf.rail_use_yapf, 28,86, 0, 0, true, STR_NULL, NULL),
SDT_CONDVAR(Patches, pathfinder_for_trains, SLE_UINT8, 87, SL_MAX_VERSION, 0, MS, 2, 0, 2, 1, STR_CONFIG_PATCHES_PATHFINDER_FOR_TRAINS, NULL),
SDT_CONDVAR(Patches, pathfinder_for_roadvehs, SLE_UINT8, 87, SL_MAX_VERSION, 0, MS, 2, 0, 2, 1, STR_CONFIG_PATCHES_PATHFINDER_FOR_ROADVEH, NULL),
SDT_CONDVAR(Patches, pathfinder_for_ships, SLE_UINT8, 87, SL_MAX_VERSION, 0, MS, 0, 0, 2, 1, STR_CONFIG_PATCHES_PATHFINDER_FOR_SHIPS, NULL),
SDT_BOOL(Patches, train_income_warn, S, 0, true, STR_CONFIG_PATCHES_WARN_INCOME_LESS, NULL),
SDT_VAR(Patches, order_review_system,SLE_UINT8, S,MS, 2, 0, 2, 0, STR_CONFIG_PATCHES_ORDER_REVIEW, NULL),
SDT_BOOL(Patches, never_expire_vehicles, 0,NN, false, STR_CONFIG_PATCHES_NEVER_EXPIRE_VEHICLES,NULL),
SDT_BOOL(Patches, lost_train_warn, S, 0, true, STR_CONFIG_PATCHES_WARN_LOST_TRAIN, NULL),
SDT_BOOL(Patches, autorenew, S, 0, false, STR_CONFIG_PATCHES_AUTORENEW_VEHICLE, EngineRenewUpdate),
SDT_VAR(Patches, autorenew_months, SLE_INT16, S, 0, 6, -12, 12, 0, STR_CONFIG_PATCHES_AUTORENEW_MONTHS, EngineRenewMonthsUpdate),
SDT_VAR(Patches, autorenew_money, SLE_UINT, S,CR,100000, 0, 2000000, 0, STR_CONFIG_PATCHES_AUTORENEW_MONEY, EngineRenewMoneyUpdate),
SDT_BOOL(Patches, always_build_infrastructure, S, 0, false, STR_CONFIG_PATCHES_ALWAYS_BUILD_INFRASTRUCTURE, RedrawScreen),
SDT_VAR(Patches, max_trains, SLE_UINT16, 0, 0, 500, 0, 5000, 0, STR_CONFIG_PATCHES_MAX_TRAINS, RedrawScreen),
SDT_VAR(Patches, max_roadveh, SLE_UINT16, 0, 0, 500, 0, 5000, 0, STR_CONFIG_PATCHES_MAX_ROADVEH, RedrawScreen),
SDT_VAR(Patches, max_aircraft, SLE_UINT16, 0, 0, 200, 0, 5000, 0, STR_CONFIG_PATCHES_MAX_AIRCRAFT, RedrawScreen),
SDT_VAR(Patches, max_ships, SLE_UINT16, 0, 0, 300, 0, 5000, 0, STR_CONFIG_PATCHES_MAX_SHIPS, RedrawScreen),
SDT_BOOL(Patches, servint_ispercent, 0, 0, false, STR_CONFIG_PATCHES_SERVINT_ISPERCENT, CheckInterval),
SDT_VAR(Patches, servint_trains, SLE_UINT16, 0,D0, 150, 5, 800, 0, STR_CONFIG_PATCHES_SERVINT_TRAINS, InValidateDetailsWindow),
SDT_VAR(Patches, servint_roadveh, SLE_UINT16, 0,D0, 150, 5, 800, 0, STR_CONFIG_PATCHES_SERVINT_ROADVEH, InValidateDetailsWindow),
SDT_VAR(Patches, servint_ships, SLE_UINT16, 0,D0, 360, 5, 800, 0, STR_CONFIG_PATCHES_SERVINT_SHIPS, InValidateDetailsWindow),
SDT_VAR(Patches, servint_aircraft, SLE_UINT16, 0,D0, 100, 5, 800, 0, STR_CONFIG_PATCHES_SERVINT_AIRCRAFT, InValidateDetailsWindow),
SDT_BOOL(Patches, no_servicing_if_no_breakdowns, 0, 0, false, STR_CONFIG_PATCHES_NOSERVICE, NULL),
SDT_BOOL(Patches, wagon_speed_limits, 0,NN, true, STR_CONFIG_PATCHES_WAGONSPEEDLIMITS, UpdateConsists),
SDT_CONDBOOL(Patches, disable_elrails, 38, SL_MAX_VERSION, 0, NN, false, STR_CONFIG_PATCHES_DISABLE_ELRAILS, SettingsDisableElrail),
SDT_CONDVAR(Patches, freight_trains, SLE_UINT8, 39, SL_MAX_VERSION, 0,NN, 1, 1, 255, 1, STR_CONFIG_PATCHES_FREIGHT_TRAINS, NULL),
SDT_CONDBOOL(Patches, timetabling, 67, SL_MAX_VERSION, 0, 0, true, STR_CONFIG_PATCHES_TIMETABLE_ALLOW, NULL),
SDT_CONDVAR(Patches, plane_speed, SLE_UINT8, 90, SL_MAX_VERSION, 0, 0, 4, 1, 4, 0, STR_CONFIG_PATCHES_PLANE_SPEED, NULL),
SDT_CONDBOOL(Patches, dynamic_engines, 95, SL_MAX_VERSION, 0,NN, false, STR_CONFIG_PATCHES_DYNAMIC_ENGINES, NULL),
/***************************************************************************/
/* Station section of the GUI-configure patches window */
SDT_BOOL(Patches, join_stations, 0, 0, true, STR_CONFIG_PATCHES_JOINSTATIONS, NULL),
SDT_CONDBOOL(Patches, sg_full_load_any, 0, 92, 0, 0, true, STR_NULL, NULL),
SDT_BOOL(Patches, improved_load, 0,NN, false, STR_CONFIG_PATCHES_IMPROVEDLOAD, NULL),
SDT_BOOL(Patches, selectgoods, 0, 0, true, STR_CONFIG_PATCHES_SELECTGOODS, NULL),
SDT_BOOL(Patches, new_nonstop, S, 0, false, STR_CONFIG_PATCHES_NEW_NONSTOP, NULL),
SDT_CONDBOOL(Patches, sg_new_nonstop, 0, 92, 0, 0, false, STR_NULL, NULL),
SDT_BOOL(Patches, nonuniform_stations, 0,NN, true, STR_CONFIG_PATCHES_NONUNIFORM_STATIONS,NULL),
SDT_VAR(Patches, station_spread,SLE_UINT8,0, 0, 12, 4, 64, 0, STR_CONFIG_PATCHES_STATION_SPREAD, InvalidateStationBuildWindow),
SDT_BOOL(Patches, serviceathelipad, 0, 0, true, STR_CONFIG_PATCHES_SERVICEATHELIPAD, NULL),
SDT_BOOL(Patches, modified_catchment, 0, 0, true, STR_CONFIG_PATCHES_CATCHMENT, NULL),
SDT_CONDBOOL(Patches, gradual_loading, 40, SL_MAX_VERSION, 0, 0, true, STR_CONFIG_PATCHES_GRADUAL_LOADING, NULL),
SDT_CONDBOOL(Patches, road_stop_on_town_road, 47, SL_MAX_VERSION, 0, 0, false, STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD, NULL),
SDT_CONDBOOL(Patches, adjacent_stations, 62, SL_MAX_VERSION, 0, 0, true, STR_CONFIG_PATCHES_ADJACENT_STATIONS, NULL),
SDT_CONDBOOL(Patches, station_noise_level, 96, SL_MAX_VERSION, 0, 0, false, STR_CONFIG_PATCHES_NOISE_LEVEL, InvalidateTownViewWindow),
/***************************************************************************/
/* Economy section of the GUI-configure patches window */
SDT_BOOL(Patches, inflation, 0, 0, true, STR_CONFIG_PATCHES_INFLATION, NULL),
SDT_VAR(Patches, raw_industry_construction,SLE_UINT8,0,MS,0,0, 2, 0, STR_CONFIG_PATCHES_RAW_INDUSTRY_CONSTRUCTION_METHOD, InvalidateBuildIndustryWindow),
SDT_BOOL(Patches, multiple_industry_per_town, 0, 0, false, STR_CONFIG_PATCHES_MULTIPINDTOWN, NULL),
SDT_BOOL(Patches, same_industry_close, 0, 0, false, STR_CONFIG_PATCHES_SAMEINDCLOSE, NULL),
SDT_BOOL(Patches, bribe, 0, 0, true, STR_CONFIG_PATCHES_BRIBE, NULL),
SDT_CONDBOOL(Patches, exclusive_rights, 79, SL_MAX_VERSION, 0, 0, true, STR_CONFIG_PATCHES_ALLOW_EXCLUSIVE, NULL),
SDT_CONDBOOL(Patches, give_money, 79, SL_MAX_VERSION, 0, 0, true, STR_CONFIG_PATCHES_ALLOW_GIVE_MONEY, NULL),
SDT_VAR(Patches, snow_line_height,SLE_UINT8, 0, 0, 7, 2, 13, 0, STR_CONFIG_PATCHES_SNOWLINE_HEIGHT, NULL),
SDT_VAR(Patches, colored_news_year,SLE_INT32, 0,NC, 2000, MIN_YEAR, MAX_YEAR, 1, STR_CONFIG_PATCHES_COLORED_NEWS_YEAR,NULL),
SDT_VAR(Patches, starting_year, SLE_INT32, 0,NC, 1950, MIN_YEAR, MAX_YEAR, 1, STR_CONFIG_PATCHES_STARTING_YEAR,NULL),
SDT_VAR(Patches, ending_year, SLE_INT32,0,NC|NO,2051, MIN_YEAR, MAX_YEAR, 1, STR_CONFIG_PATCHES_ENDING_YEAR, NULL),
SDT_BOOL(Patches, smooth_economy, 0, 0, true, STR_CONFIG_PATCHES_SMOOTH_ECONOMY, NULL),
SDT_BOOL(Patches, allow_shares, 0, 0, false, STR_CONFIG_PATCHES_ALLOW_SHARES, NULL),
SDT_CONDVAR(Patches, town_growth_rate, SLE_UINT8, 54, SL_MAX_VERSION, 0, MS, 2, 0, 4, 0, STR_CONFIG_PATCHES_TOWN_GROWTH, NULL),
SDT_CONDVAR(Patches, larger_towns, SLE_UINT8, 54, SL_MAX_VERSION, 0, D0, 4, 0, 255, 1, STR_CONFIG_PATCHES_LARGER_TOWNS, NULL),
SDT_CONDVAR(Patches, initial_city_size, SLE_UINT8, 56, SL_MAX_VERSION, 0, 0, 2, 1, 10, 1, STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER, NULL),
SDT_CONDBOOL(Patches, mod_road_rebuild, 77, SL_MAX_VERSION, 0, 0, false, STR_CONFIG_MODIFIED_ROAD_REBUILD, NULL),
/***************************************************************************/
/* AI section of the GUI-configure patches window */
SDT_BOOL(Patches, ainew_active, 0, 0, false, STR_CONFIG_PATCHES_AINEW_ACTIVE, AiNew_PatchActive_Warning),
SDT_BOOL(Patches, ai_in_multiplayer, 0, 0, false, STR_CONFIG_PATCHES_AI_IN_MULTIPLAYER, Ai_In_Multiplayer_Warning),
SDT_BOOL(Patches, ai_disable_veh_train, 0, 0, false, STR_CONFIG_PATCHES_AI_BUILDS_TRAINS, NULL),
SDT_BOOL(Patches, ai_disable_veh_roadveh, 0, 0, false, STR_CONFIG_PATCHES_AI_BUILDS_ROADVEH, NULL),
SDT_BOOL(Patches, ai_disable_veh_aircraft,0, 0, false, STR_CONFIG_PATCHES_AI_BUILDS_AIRCRAFT,NULL),
SDT_BOOL(Patches, ai_disable_veh_ship, 0, 0, false, STR_CONFIG_PATCHES_AI_BUILDS_SHIPS, NULL),
/***************************************************************************/
/* Patches without any GUI representation */
SDT_BOOL(Patches, keep_all_autosave, S, 0, false, STR_NULL, NULL),
SDT_BOOL(Patches, autosave_on_exit, S, 0, false, STR_NULL, NULL),
SDT_VAR(Patches, max_num_autosaves, SLE_UINT8, S, 0, 16, 0, 255, 0, STR_NULL, NULL),
SDT_BOOL(Patches, bridge_pillars, S, 0, true, STR_NULL, NULL),
SDT_VAR(Patches, extend_vehicle_life, SLE_UINT8, 0, 0, 0, 0, 100, 0, STR_NULL, NULL),
SDT_BOOL(Patches, auto_euro, S, 0, true, STR_NULL, NULL),
SDT_VAR(Patches, dist_local_authority,SLE_UINT8, 0, 0, 20, 5, 60, 0, STR_NULL, NULL),
SDT_VAR(Patches, wait_oneway_signal, SLE_UINT8, 0, 0, 15, 2, 100, 0, STR_NULL, NULL),
SDT_VAR(Patches, wait_twoway_signal, SLE_UINT8, 0, 0, 41, 2, 100, 0, STR_NULL, NULL),
SDT_CONDLISTO(Patches, town_noise_population, 3, SLE_UINT16, 96, SL_MAX_VERSION, 0, D0, "800,2000,4000", STR_NULL, NULL, CheckNoiseToleranceLevel),
/***************************************************************************/
/* New Pathfinding patch settings */
SDT_VAR(Patches, pf_maxlength, SLE_UINT16, 0, 0, 4096, 64, 65535, 0, STR_NULL, NULL),
SDT_VAR(Patches, pf_maxdepth, SLE_UINT8, 0, 0, 48, 4, 255, 0, STR_NULL, NULL),
/* The maximum number of nodes to search */
SDT_VAR(Patches, npf_max_search_nodes,SLE_UINT, 0, 0, 10000, 500, 100000, 0, STR_NULL, NULL),
/* When a red signal is encountered, a small detour can be made around
* it. This specifically occurs when a track is doubled, in which case
* the detour is typically 2 tiles. It is also often used at station
* entrances, when there is a choice of multiple platforms. If we take
* a typical 4 platform station, the detour is 4 tiles. To properly
* support larger stations we increase this value.
* We want to prevent that trains that want to leave at one side of a
* station, leave through the other side, turn around, enter the
* station on another platform and exit the station on the right side
* again, just because the sign at the right side was red. If we take
* a typical 5 length station, this detour is 10 or 11 tiles (not
* sure), so we set the default penalty at 10 (the station tile
* penalty will further prevent this.
* We give presignal exits (and combo's) a different (larger) penalty, because
* we really don't want trains waiting in front of a presignal exit. */
SDT_VAR(Patches, npf_rail_firstred_penalty, SLE_UINT, 0, 0, (10 * NPF_TILE_LENGTH), 0, 100000, 0, STR_NULL, NULL),
SDT_VAR(Patches, npf_rail_firstred_exit_penalty,SLE_UINT, 0, 0, (100 * NPF_TILE_LENGTH),0, 100000, 0, STR_NULL, NULL),
/* This penalty is for when the last signal before the target is red.
* This is useful for train stations, where there are multiple
* platforms to choose from, which lie in different signal blocks.
* Every target in a occupied signal block (ie an occupied platform)
* will get this penalty. */
SDT_VAR(Patches, npf_rail_lastred_penalty, SLE_UINT, 0, 0, (10 * NPF_TILE_LENGTH), 0, 100000, 0, STR_NULL, NULL),
/* When a train plans a route over a station tile, this penalty is
* applied. We want that trains plan a route around a typical, 4x5
* station, which means two tiles to the right, and two tiles back to
* the left around it, or 5 tiles of station through it. If we assign
* a penalty of 1 tile for every station tile passed, the route will
* be around it. */
SDT_VAR(Patches, npf_rail_station_penalty, SLE_UINT, 0, 0, (1 * NPF_TILE_LENGTH), 0, 100000, 0, STR_NULL, NULL),
SDT_VAR(Patches, npf_rail_slope_penalty, SLE_UINT, 0, 0, (1 * NPF_TILE_LENGTH), 0, 100000, 0, STR_NULL, NULL),
/* This penalty is applied when a train makes a turn. Its value of 1 makes
* sure that it has a minimal impact on the pathfinding, only when two
* paths have equal length it will make a difference */
SDT_VAR(Patches, npf_rail_curve_penalty, SLE_UINT, 0, 0, 1, 0, 100000, 0, STR_NULL, NULL),
/* Ths penalty is applied when a vehicle reverses inside a depot (doesn't
* apply to ships, as they can just come out the other end). XXX: Is this a
* good value? */
SDT_VAR(Patches, npf_rail_depot_reverse_penalty,SLE_UINT, 0, 0, (NPF_TILE_LENGTH * 50), 0, 100000, 0, STR_NULL, NULL),
SDT_VAR(Patches, npf_buoy_penalty, SLE_UINT, 0, 0, (2 * NPF_TILE_LENGTH), 0, 100000, 0, STR_NULL, NULL),
/* This penalty is applied when a ship makes a turn. It is bigger than the
* rail curve penalty, since ships (realisticly) have more trouble with
* making turns */
SDT_VAR(Patches, npf_water_curve_penalty, SLE_UINT, 0, 0, (NPF_TILE_LENGTH / 4), 0, 100000, 0, STR_NULL, NULL),
/* This is the penalty for road, same as for rail. */
SDT_VAR(Patches, npf_road_curve_penalty, SLE_UINT, 0, 0, 1, 0, 100000, 0, STR_NULL, NULL),
/* This is the penalty for level crossings, for both road and rail vehicles */
SDT_VAR(Patches, npf_crossing_penalty, SLE_UINT, 0, 0, (3 * NPF_TILE_LENGTH), 0, 100000, 0, STR_NULL, NULL),
/* This is the penalty for drive-through road, stops. */
SDT_CONDVAR (Patches, npf_road_drive_through_penalty, SLE_UINT, 47, SL_MAX_VERSION, 0, 0, 8 * NPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL),
/* The maximum number of nodes to search */
SDT_CONDBOOL(Patches, yapf.disable_node_optimization , 28, SL_MAX_VERSION, 0, 0, false , STR_NULL, NULL),
SDT_CONDVAR (Patches, yapf.max_search_nodes , SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 10000 , 500, 1000000, 0, STR_NULL, NULL),
SDT_CONDBOOL(Patches, yapf.rail_firstred_twoway_eol , 28, SL_MAX_VERSION, 0, 0, true , STR_NULL, NULL),
SDT_CONDVAR (Patches, yapf.rail_firstred_penalty , SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 10 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL),
SDT_CONDVAR (Patches, 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 (Patches, yapf.rail_lastred_penalty , SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 10 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL),
SDT_CONDVAR (Patches, 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 (Patches, yapf.rail_station_penalty , SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 30 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL),
SDT_CONDVAR (Patches, yapf.rail_slope_penalty , SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 2 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL),
SDT_CONDVAR (Patches, yapf.rail_curve45_penalty , SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 1 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL),
SDT_CONDVAR (Patches, yapf.rail_curve90_penalty , SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 6 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL),
/* This penalty is applied when a train reverses inside a depot */
SDT_CONDVAR (Patches, yapf.rail_depot_reverse_penalty , SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 50 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL),
/* This is the penalty for level crossings (for trains only) */
SDT_CONDVAR (Patches, yapf.rail_crossing_penalty , SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 3 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL),
/* look-ahead how many signals are checked */
SDT_CONDVAR (Patches, yapf.rail_look_ahead_max_signals, SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 10 , 1, 100, 0, STR_NULL, NULL),
/* look-ahead n-th red signal penalty polynomial: penalty = p2 * n^2 + p1 * n + p0 */
SDT_CONDVAR (Patches, yapf.rail_look_ahead_signal_p0 , SLE_INT , 28, SL_MAX_VERSION, 0, 0, 500 , -1000000, 1000000, 0, STR_NULL, NULL),
SDT_CONDVAR (Patches, yapf.rail_look_ahead_signal_p1 , SLE_INT , 28, SL_MAX_VERSION, 0, 0, -100 , -1000000, 1000000, 0, STR_NULL, NULL),
SDT_CONDVAR (Patches, yapf.rail_look_ahead_signal_p2 , SLE_INT , 28, SL_MAX_VERSION, 0, 0, 5 , -1000000, 1000000, 0, STR_NULL, NULL),
/* penalties for too long or too short station platforms */
SDT_CONDVAR (Patches, 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 (Patches, 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 (Patches, 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 (Patches, 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),
/* road vehicles - penalties */
SDT_CONDVAR (Patches, yapf.road_slope_penalty , SLE_UINT, 33, SL_MAX_VERSION, 0, 0, 2 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL),
SDT_CONDVAR (Patches, yapf.road_curve_penalty , SLE_UINT, 33, SL_MAX_VERSION, 0, 0, 1 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL),
SDT_CONDVAR (Patches, yapf.road_crossing_penalty , SLE_UINT, 33, SL_MAX_VERSION, 0, 0, 3 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL),
SDT_CONDVAR (Patches, yapf.road_stop_penalty , SLE_UINT, 47, SL_MAX_VERSION, 0, 0, 8 * YAPF_TILE_LENGTH, 0, 1000000, 0, STR_NULL, NULL),
/***************************************************************************/
/* Terrain genation related patch options */
SDT_CONDVAR(Patches, land_generator, SLE_UINT8, 30, SL_MAX_VERSION, 0, MS, 1, 0, 1, 0, STR_CONFIG_PATCHES_LAND_GENERATOR, NULL),
SDT_CONDVAR(Patches, 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(Patches, tgen_smoothness, SLE_UINT8, 30, SL_MAX_VERSION, 0, MS, 1, 0, 3, 0, STR_CONFIG_PATCHES_ROUGHNESS_OF_TERRAIN, NULL),
SDT_CONDVAR(Patches, generation_seed, SLE_UINT32, 30, SL_MAX_VERSION, 0, 0, GENERATE_NEW_SEED, 0, MAX_UVALUE(uint32), 0, STR_NULL, NULL),
SDT_CONDVAR(Patches, tree_placer, SLE_UINT8, 30, SL_MAX_VERSION, 0, MS, 2, 0, 2, 0, STR_CONFIG_PATCHES_TREE_PLACER, NULL),
SDT_VAR (Patches, heightmap_rotation, SLE_UINT8, S, MS, 0, 0, 1, 0, STR_CONFIG_PATCHES_HEIGHTMAP_ROTATION, NULL),
SDT_VAR (Patches, se_flat_world_height, SLE_UINT8, S, 0, 0, 0, 15, 0, STR_CONFIG_PATCHES_SE_FLAT_WORLD_HEIGHT, NULL),
/* /*
* Since the network code (CmdChangePatchSetting and friends) use the index in this array to decide * Since the network code (CmdChangePatchSetting and friends) use the index in this array to decide
@ -1671,7 +1647,7 @@ const SettingDesc _patch_settings[] = {
#ifdef __APPLE__ #ifdef __APPLE__
/* We might need to emulate a right mouse button on mac */ /* We might need to emulate a right mouse button on mac */
SDT_VAR(Patches,right_mouse_btn_emulation,SLE_UINT8,S,MS,0, 0, 2, 0, STR_CONFIG_PATCHES_RIGHT_MOUSE_BTN_EMU, NULL), SDT_VAR(Settings, gui.right_mouse_btn_emulation, SLE_UINT8, S, MS, 0, 0, 2, 0, STR_CONFIG_PATCHES_RIGHT_MOUSE_BTN_EMU, NULL),
#endif #endif
SDT_END() SDT_END()
@ -1863,7 +1839,7 @@ static void HandleSettingDescs(IniFile *ini, SettingDescProc *proc, SettingDescP
#endif /* WIN32 */ #endif /* WIN32 */
proc(ini, _gameopt_settings, "gameopt", &_opt_newgame); proc(ini, _gameopt_settings, "gameopt", &_opt_newgame);
proc(ini, _patch_settings, "patches", &_patches_newgame); proc(ini, _patch_settings, "patches", &_settings_newgame);
proc(ini, _currency_settings,"currency", &_custom_currency); proc(ini, _currency_settings,"currency", &_custom_currency);
#ifdef ENABLE_NETWORK #ifdef ENABLE_NETWORK
@ -1892,6 +1868,11 @@ void LoadFromConfig()
void SaveToConfig() void SaveToConfig()
{ {
IniFile *ini = ini_load(_config_file); IniFile *ini = ini_load(_config_file);
/* Remove some obsolete groups. These have all been loaded into other groups. */
ini_removegroup(ini, "patches");
ini_removegroup(ini, "yapf");
HandleSettingDescs(ini, ini_save_settings, ini_save_setting_list); HandleSettingDescs(ini, ini_save_settings, ini_save_setting_list);
GRFSaveConfig(ini, "newgrf", _grfconfig_newgame); GRFSaveConfig(ini, "newgrf", _grfconfig_newgame);
GRFSaveConfig(ini, "newgrf-static", _grfconfig_static); GRFSaveConfig(ini, "newgrf-static", _grfconfig_static);
@ -1926,8 +1907,8 @@ CommandCost CmdChangePatchSetting(TileIndex tile, uint32 flags, uint32 p1, uint3
if ((sd->desc.flags & SGF_NO_NETWORK) && _networking) return CMD_ERROR; if ((sd->desc.flags & SGF_NO_NETWORK) && _networking) return CMD_ERROR;
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
Patches *patches_ptr = (_game_mode == GM_MENU) ? &_patches_newgame : &_patches; Settings *s = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings;
void *var = GetVariableAddress(patches_ptr, &sd->save); void *var = GetVariableAddress(s, &sd->save);
Write_ValidateSetting(var, sd, (int32)p2); Write_ValidateSetting(var, sd, (int32)p2);
if (sd->desc.proc != NULL) sd->desc.proc((int32)ReadValue(var, sd->save.conv)); if (sd->desc.proc != NULL) sd->desc.proc((int32)ReadValue(var, sd->save.conv));
@ -1944,7 +1925,7 @@ CommandCost CmdChangePatchSetting(TileIndex tile, uint32 flags, uint32 p1, uint3
* This only affects patch-members that are not needed to be the same on all * This only affects patch-members that are not needed to be the same on all
* clients in a network game. * clients in a network game.
* @param value new value of the patch */ * @param value new value of the patch */
bool SetPatchValue(uint index, const Patches *object, int32 value) bool SetPatchValue(uint index, const Settings *object, int32 value)
{ {
const SettingDesc *sd = &_patch_settings[index]; const SettingDesc *sd = &_patch_settings[index];
/* If an item is player-based, we do not send it over the network /* If an item is player-based, we do not send it over the network
@ -1956,7 +1937,7 @@ bool SetPatchValue(uint index, const Patches *object, int32 value)
Write_ValidateSetting(var, sd, value); Write_ValidateSetting(var, sd, value);
if (_game_mode != GM_MENU) { if (_game_mode != GM_MENU) {
void *var2 = GetVariableAddress(&_patches_newgame, &sd->save); void *var2 = GetVariableAddress(&_settings_newgame, &sd->save);
Write_ValidateSetting(var2, sd, value); Write_ValidateSetting(var2, sd, value);
} }
if (sd->desc.proc != NULL) sd->desc.proc((int32)ReadValue(var, sd->save.conv)); if (sd->desc.proc != NULL) sd->desc.proc((int32)ReadValue(var, sd->save.conv));
@ -1990,7 +1971,6 @@ bool IConsoleSetPatchSetting(const char *name, int32 value)
bool success; bool success;
uint index; uint index;
const SettingDesc *sd = GetPatchFromName(name, &index); const SettingDesc *sd = GetPatchFromName(name, &index);
const Patches *patches_ptr;
void *ptr; void *ptr;
if (sd == NULL) { if (sd == NULL) {
@ -1998,10 +1978,10 @@ bool IConsoleSetPatchSetting(const char *name, int32 value)
return true; return true;
} }
patches_ptr = (_game_mode == GM_MENU) ? &_patches_newgame : &_patches; Settings *s = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings;
ptr = GetVariableAddress(patches_ptr, &sd->save); ptr = GetVariableAddress(s, &sd->save);
success = SetPatchValue(index, patches_ptr, value); success = SetPatchValue(index, s, value);
return success; return success;
} }
@ -2017,7 +1997,7 @@ void IConsoleGetPatchSetting(const char *name)
return; return;
} }
ptr = GetVariableAddress((_game_mode == GM_MENU) ? &_patches_newgame : &_patches, &sd->save); ptr = GetVariableAddress((_game_mode == GM_MENU) ? &_settings_newgame : &_settings, &sd->save);
if (sd->desc.cmd == SDT_BOOLX) { if (sd->desc.cmd == SDT_BOOLX) {
snprintf(value, sizeof(value), (*(bool*)ptr == 1) ? "on" : "off"); snprintf(value, sizeof(value), (*(bool*)ptr == 1) ? "on" : "off");
@ -2035,7 +2015,7 @@ void IConsoleListPatches()
for (const SettingDesc *sd = _patch_settings; sd->save.cmd != SL_END; sd++) { for (const SettingDesc *sd = _patch_settings; sd->save.cmd != SL_END; sd++) {
char value[80]; char value[80];
const void *ptr = GetVariableAddress((_game_mode == GM_MENU) ? &_patches_newgame : &_patches, &sd->save); const void *ptr = GetVariableAddress((_game_mode == GM_MENU) ? &_settings_newgame : &_settings, &sd->save);
if (sd->desc.cmd == SDT_BOOLX) { if (sd->desc.cmd == SDT_BOOLX) {
snprintf(value, lengthof(value), (*(bool*)ptr == 1) ? "on" : "off"); snprintf(value, lengthof(value), (*(bool*)ptr == 1) ? "on" : "off");
@ -2120,22 +2100,22 @@ static void Load_PATS()
/* Copy over default setting since some might not get loaded in /* Copy over default setting since some might not get loaded in
* a networking environment. This ensures for example that the local * a networking environment. This ensures for example that the local
* signal_side stays when joining a network-server */ * signal_side stays when joining a network-server */
_patches = _patches_newgame; _settings = _settings_newgame;
LoadSettings(_patch_settings, &_patches); LoadSettings(_patch_settings, &_settings);
} }
static void Save_PATS() static void Save_PATS()
{ {
SaveSettings(_patch_settings, &_patches); SaveSettings(_patch_settings, &_settings);
} }
void CheckConfig() void CheckConfig()
{ {
// Increase old default values for pf_maxdepth and pf_maxlength // Increase old default values for pf_maxdepth and pf_maxlength
// to support big networks. // to support big networks.
if (_patches_newgame.pf_maxdepth == 16 && _patches_newgame.pf_maxlength == 512) { if (_settings_newgame.pf.opf.pf_maxdepth == 16 && _settings_newgame.pf.opf.pf_maxlength == 512) {
_patches_newgame.pf_maxdepth = 48; _settings_newgame.pf.opf.pf_maxdepth = 48;
_patches_newgame.pf_maxlength = 4096; _settings_newgame.pf.opf.pf_maxlength = 4096;
} }
} }
@ -2144,7 +2124,7 @@ void UpdatePatches()
/* Since old(er) savegames don't have any patches saved, we initialise /* Since old(er) savegames don't have any patches saved, we initialise
* them with the default values just as it was in the old days. * them with the default values just as it was in the old days.
* Also new games need this copying-over */ * Also new games need this copying-over */
_patches = _patches_newgame; /* backwards compatibility */ _settings = _settings_newgame; /* backwards compatibility */
} }
extern const ChunkHandler _setting_chunk_handlers[] = { extern const ChunkHandler _setting_chunk_handlers[] = {

View File

@ -667,125 +667,125 @@ void ShowGameDifficulty()
} }
static const char *_patches_ui[] = { static const char *_patches_ui[] = {
"vehicle_speed", "gui.vehicle_speed",
"status_long_date", "gui.status_long_date",
"show_finances", "gui.show_finances",
"autoscroll", "gui.autoscroll",
"reverse_scroll", "gui.reverse_scroll",
"smooth_scroll", "gui.smooth_scroll",
"errmsg_duration", "gui.errmsg_duration",
"toolbar_pos", "gui.toolbar_pos",
"measure_tooltip", "gui.measure_tooltip",
"window_snap_radius", "gui.window_snap_radius",
"population_in_label", "gui.population_in_label",
"link_terraform_toolbar", "gui.link_terraform_toolbar",
"liveries", "gui.liveries",
"prefer_teamchat", "gui.prefer_teamchat",
/* While the horizontal scrollwheel scrolling is written as general code, only /* While the horizontal scrollwheel scrolling is written as general code, only
* the cocoa (OSX) driver generates input for it. * the cocoa (OSX) driver generates input for it.
* Since it's also able to completely disable the scrollwheel will we display it on all platforms anyway */ * Since it's also able to completely disable the scrollwheel will we display it on all platforms anyway */
"scrollwheel_scrolling", "gui.scrollwheel_scrolling",
"scrollwheel_multiplier", "gui.scrollwheel_multiplier",
#ifdef __APPLE__ #ifdef __APPLE__
/* We might need to emulate a right mouse button on mac */ /* We might need to emulate a right mouse button on mac */
"right_mouse_btn_emulation", "gui.right_mouse_btn_emulation",
#endif #endif
"pause_on_newgame", "gui.pause_on_newgame",
"advanced_vehicle_list", "gui.advanced_vehicle_list",
"loading_indicators", "gui.loading_indicators",
"timetable_in_ticks", "gui.timetable_in_ticks",
"default_rail_type", "gui.default_rail_type",
"always_build_infrastructure", "gui.always_build_infrastructure",
}; };
static const char *_patches_construction[] = { static const char *_patches_construction[] = {
"build_on_slopes", "construction.build_on_slopes",
"autoslope", "construction.autoslope",
"extra_dynamite", "construction.extra_dynamite",
"longbridges", "construction.longbridges",
"signal_side", "construction.signal_side",
"always_small_airport", "station.always_small_airport",
"enable_signal_gui", "gui.enable_signal_gui",
"drag_signals_density", "gui.drag_signals_density",
"oil_refinery_limit", "game_creation.oil_refinery_limit",
"semaphore_build_before", "gui.semaphore_build_before",
}; };
static const char *_patches_stations[] = { static const char *_patches_stations[] = {
"join_stations", "station.join_stations",
"improved_load", "order.improved_load",
"selectgoods", "order.selectgoods",
"new_nonstop", "gui.new_nonstop",
"nonuniform_stations", "station.nonuniform_stations",
"station_spread", "station.station_spread",
"serviceathelipad", "order.serviceathelipad",
"modified_catchment", "station.modified_catchment",
"gradual_loading", "order.gradual_loading",
"road_stop_on_town_road", "construction.road_stop_on_town_road",
"adjacent_stations", "station.adjacent_stations",
"station_noise_level", "economy.station_noise_level",
}; };
static const char *_patches_economy[] = { static const char *_patches_economy[] = {
"inflation", "economy.inflation",
"raw_industry_construction", "construction.raw_industry_construction",
"multiple_industry_per_town", "economy.multiple_industry_per_town",
"same_industry_close", "economy.same_industry_close",
"bribe", "economy.bribe",
"exclusive_rights", "economy.exclusive_rights",
"give_money", "economy.give_money",
"colored_news_year", "gui.colored_news_year",
"ending_year", "gui.ending_year",
"smooth_economy", "economy.smooth_economy",
"allow_shares", "economy.allow_shares",
"town_layout", "economy.town_layout",
"mod_road_rebuild", "economy.mod_road_rebuild",
"town_growth_rate", "economy.town_growth_rate",
"larger_towns", "economy.larger_towns",
"initial_city_size", "economy.initial_city_size",
}; };
static const char *_patches_ai[] = { static const char *_patches_ai[] = {
"ainew_active", "ai.ainew_active",
"ai_in_multiplayer", "ai.ai_in_multiplayer",
"ai_disable_veh_train", "ai.ai_disable_veh_train",
"ai_disable_veh_roadveh", "ai.ai_disable_veh_roadveh",
"ai_disable_veh_aircraft", "ai.ai_disable_veh_aircraft",
"ai_disable_veh_ship", "ai.ai_disable_veh_ship",
}; };
static const char *_patches_vehicles[] = { static const char *_patches_vehicles[] = {
"realistic_acceleration", "vehicle.realistic_acceleration",
"forbid_90_deg", "pf.forbid_90_deg",
"mammoth_trains", "vehicle.mammoth_trains",
"gotodepot", "order.gotodepot",
"roadveh_queue", "pf.roadveh_queue",
"pathfinder_for_trains", "pf.pathfinder_for_trains",
"pathfinder_for_roadvehs", "pf.pathfinder_for_roadvehs",
"pathfinder_for_ships", "pf.pathfinder_for_ships",
"train_income_warn", "gui.train_income_warn",
"order_review_system", "gui.order_review_system",
"never_expire_vehicles", "vehicle.never_expire_vehicles",
"lost_train_warn", "gui.lost_train_warn",
"autorenew", "gui.autorenew",
"autorenew_months", "gui.autorenew_months",
"autorenew_money", "gui.autorenew_money",
"max_trains", "vehicle.max_trains",
"max_roadveh", "vehicle.max_roadveh",
"max_aircraft", "vehicle.max_aircraft",
"max_ships", "vehicle.max_ships",
"servint_ispercent", "vehicle.servint_ispercent",
"servint_trains", "vehicle.servint_trains",
"servint_roadveh", "vehicle.servint_roadveh",
"servint_ships", "vehicle.servint_ships",
"servint_aircraft", "vehicle.servint_aircraft",
"no_servicing_if_no_breakdowns", "order.no_servicing_if_no_breakdowns",
"wagon_speed_limits", "vehicle.wagon_speed_limits",
"disable_elrails", "vehicle.disable_elrails",
"freight_trains", "vehicle.freight_trains",
"plane_speed", "vehicle.plane_speed",
"timetabling", "order.timetabling",
"dynamic_engines", "vehicle.dynamic_engines",
}; };
struct PatchEntry { struct PatchEntry {
@ -822,7 +822,7 @@ enum PatchesSelectionWidgets {
}; };
struct PatchesSelectionWindow : Window { struct PatchesSelectionWindow : Window {
static Patches *patches_ptr; static Settings *patches_ptr;
static int patches_max; static int patches_max;
int page; int page;
@ -833,7 +833,7 @@ struct PatchesSelectionWindow : Window {
{ {
static bool first_time = true; static bool first_time = true;
patches_ptr = (_game_mode == GM_MENU) ? &_patches_newgame : &_patches; patches_ptr = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings;
/* Build up the dynamic settings-array only once per OpenTTD session */ /* Build up the dynamic settings-array only once per OpenTTD session */
if (first_time) { if (first_time) {
@ -1045,7 +1045,7 @@ struct PatchesSelectionWindow : Window {
} }
}; };
Patches *PatchesSelectionWindow::patches_ptr = NULL; Settings *PatchesSelectionWindow::patches_ptr = NULL;
int PatchesSelectionWindow::patches_max = 0; int PatchesSelectionWindow::patches_max = 0;
static const Widget _patches_selection_widgets[] = { static const Widget _patches_selection_widgets[] = {

View File

@ -84,6 +84,6 @@ enum IniGroupType {
}; };
const SettingDesc *GetPatchFromName(const char *name, uint *i); const SettingDesc *GetPatchFromName(const char *name, uint *i);
bool SetPatchValue(uint index, const Patches *object, int32 value); bool SetPatchValue(uint index, const Settings *object, int32 value);
#endif /* SETTINGS_H */ #endif /* SETTINGS_H */

View File

@ -5,7 +5,6 @@
#ifndef SETTINGS_TYPE_H #ifndef SETTINGS_TYPE_H
#define SETTINGS_TYPE_H #define SETTINGS_TYPE_H
#include "yapf/yapf_settings.h"
#include "date_type.h" #include "date_type.h"
#include "town_type.h" #include "town_type.h"
#include "transport_type.h" #include "transport_type.h"
@ -19,7 +18,7 @@ enum {
GAME_DIFFICULTY_INITIAL_INTEREST, GAME_DIFFICULTY_INITIAL_INTEREST,
GAME_DIFFICULTY_VEHICLE_COST, GAME_DIFFICULTY_VEHICLE_COST,
GAME_DIFFICULTY_AI_SPEED, GAME_DIFFICULTY_AI_SPEED,
GAME_DIFFICULTY_AI_INTELLIGENCE, ///< no longer in use GAME_DIFFICULTY_AI_INTELLIGENCE, ///< no longer in use
GAME_DIFFICULTY_VEHICLES_BREAKDOWN, GAME_DIFFICULTY_VEHICLES_BREAKDOWN,
GAME_DIFFICULTY_SUBSIDY_MULTIPLIER, GAME_DIFFICULTY_SUBSIDY_MULTIPLIER,
GAME_DIFFICULTY_CONSTRUCTION_COST, GAME_DIFFICULTY_CONSTRUCTION_COST,
@ -52,7 +51,7 @@ struct GameDifficulty {
GDType economy; GDType economy;
GDType line_reverse_mode; GDType line_reverse_mode;
GDType disasters; GDType disasters;
GDType town_council_tolerance; ///< minimum required town ratings to be allowed to demolish stuff GDType town_council_tolerance; ///< minimum required town ratings to be allowed to demolish stuff
}; };
struct GameOptions { struct GameOptions {
@ -74,191 +73,247 @@ extern GameOptions _opt;
/* These are the default options for a new game */ /* These are the default options for a new game */
extern GameOptions _opt_newgame; extern GameOptions _opt_newgame;
struct Patches { /** Settings related to the GUI and other stuff that is not saved in the savegame. */
bool modified_catchment; ///< different-size catchment areas struct GUISettings {
bool vehicle_speed; ///< show vehicle speed bool vehicle_speed; ///< show vehicle speed
bool build_on_slopes; ///< allow building on slopes bool sg_full_load_any; ///< new full load calculation, any cargo must be full read from pre v93 savegames
bool mammoth_trains; ///< allow very long trains bool lost_train_warn; ///< if a train can't find its destination, show a warning
bool join_stations; ///< allow joining of train stations uint8 order_review_system; ///< perform order reviews on vehicles
bool sg_full_load_any; ///< new full load calculation, any cargo must be full read from pre v93 savegames bool train_income_warn; ///< if train is generating little income, show a warning
bool improved_load; ///< improved loading algorithm bool status_long_date; ///< always show long date in status bar
bool gradual_loading; ///< load vehicles gradually bool show_finances; ///< show finances at end of year
byte station_spread; ///< amount a station may spread bool sg_new_nonstop; ///< ttdpatch compatible nonstop handling read from pre v93 savegames
bool inflation; ///< disable inflation bool new_nonstop; ///< ttdpatch compatible nonstop handling
bool selectgoods; ///< only send the goods to station if a train has been there bool autoscroll; ///< scroll when moving mouse to the edge
bool longbridges; ///< allow 100 tile long bridges byte errmsg_duration; ///< duration of error message
bool gotodepot; ///< allow goto depot in orders bool link_terraform_toolbar; ///< display terraform toolbar when displaying rail, road, water and airport toolbars
uint8 raw_industry_construction; ///< Type of (raw) industry construction (none, "normal", prospecting) bool reverse_scroll; ///< right-Click-Scrolling scrolls in the opposite direction
bool multiple_industry_per_town; ///< allow many industries of the same type per town bool smooth_scroll; ///< smooth scroll viewports
bool same_industry_close; ///< allow same type industries to be built close to each other bool measure_tooltip; ///< show a permanent tooltip when dragging tools
bool lost_train_warn; ///< if a train can't find its destination, show a warning byte liveries; ///< options for displaying company liveries, 0=none, 1=self, 2=all
uint8 order_review_system; bool prefer_teamchat; ///< choose the chat message target with <ENTER>, true=all players, false=your team
bool train_income_warn; ///< if train is generating little income, show a warning uint8 advanced_vehicle_list; ///< use the "advanced" vehicle list
bool status_long_date; ///< always show long date in status bar uint8 loading_indicators; ///< show loading indicators
bool signal_side; ///< show signals on right side uint8 default_rail_type; ///< the default rail type for the rail GUI
bool show_finances; ///< show finances at end of year uint8 toolbar_pos; ///< position of toolbars, 0=left, 1=center, 2=right
bool sg_new_nonstop; ///< ttdpatch compatible nonstop handling read from pre v93 savegames uint8 window_snap_radius; ///< windows snap at each other if closer than this
bool new_nonstop; ///< ttdpatch compatible nonstop handling bool always_build_infrastructure; ///< always allow building of infrastructure, even when you do not have the vehicles for it
bool roadveh_queue; ///< buggy road vehicle queueing bool keep_all_autosave; ///< name the autosave in a different way
bool autoscroll; ///< scroll when moving mouse to the edge. bool autosave_on_exit; ///< save an autosave when you quit the game, but do not ask "Do you really want to quit?"
byte errmsg_duration; ///< duration of error message byte max_num_autosaves; ///< controls how many autosavegames are made before the game starts to overwrite (names them 0 to max_num_autosaves - 1)
byte land_generator; ///< the landscape generator bool population_in_label; ///< show the population of a town in his label?
byte oil_refinery_limit; ///< distance oil refineries allowed from map edge uint8 right_mouse_btn_emulation; ///< should we emulate right mouse clicking?
byte snow_line_height; ///< a number 0-15 that configured snow line height uint8 scrollwheel_scrolling; ///< scrolling using the scroll wheel?
byte tgen_smoothness; ///< how rough is the terrain from 0-3 uint8 scrollwheel_multiplier; ///< how much 'wheel' per incoming event from the OS?
uint32 generation_seed; ///< noise seed for world generation bool pause_on_newgame; ///< whether to start new games paused or not
byte tree_placer; ///< the tree placer algorithm bool enable_signal_gui; ///< show the signal GUI when the signal button is pressed
byte heightmap_rotation; ///< rotation director for the heightmap Year ending_year; ///< end of the game (just show highscore)
byte se_flat_world_height; ///< land height a flat world gets in SE Year colored_news_year; ///< when does newspaper become colored?
bool bribe; ///< enable bribing the local authority bool timetable_in_ticks; ///< whether to show the timetable in ticks rather than days
bool nonuniform_stations; ///< allow nonuniform train stations bool bridge_pillars; ///< show bridge pillars for high bridges
bool adjacent_stations; ///< allow stations to be built directly adjacent to other stations bool auto_euro; ///< automatically switch to euro in 2002
bool always_small_airport; ///< always allow small airports byte drag_signals_density; ///< many signals density
bool realistic_acceleration; ///< realistic acceleration for trains Year semaphore_build_before; ///< build semaphore signals automatically before this year
bool wagon_speed_limits; ///< enable wagon speed limits bool autorenew; ///< should autorenew be enabled for new companies?
bool forbid_90_deg; ///< forbid trains to make 90 deg turns int16 autorenew_months; ///< how many months from EOL of vehicles should autorenew trigger for new companies?
bool no_servicing_if_no_breakdowns; ///< dont send vehicles to depot when breakdowns are disabled int32 autorenew_money; ///< how much money before autorenewing for new companies?
bool link_terraform_toolbar; ///< display terraform toolbar when displaying rail, road, water and airport toolbars };
bool reverse_scroll; ///< Right-Click-Scrolling scrolls in the opposite direction
bool smooth_scroll; ///< Smooth scroll viewports
bool disable_elrails; ///< when true, the elrails are disabled
bool measure_tooltip; ///< Show a permanent tooltip when dragging tools
byte liveries; ///< Options for displaying company liveries, 0=none, 1=self, 2=all
bool prefer_teamchat; ///< Choose the chat message target with <ENTER>, true=all players, false=your team
uint8 advanced_vehicle_list; ///< Use the "advanced" vehicle list
uint8 loading_indicators; ///< Show loading indicators
uint8 default_rail_type; ///< The default rail type for the rail GUI
uint8 toolbar_pos; ///< position of toolbars, 0=left, 1=center, 2=right /** Settings related to the creation of games. */
uint8 window_snap_radius; ///< Windows snap at each other if closer than this struct GameCreationSettings {
uint32 generation_seed; ///< noise seed for world generation
Year starting_year; ///< starting date
uint8 map_x; ///< X size of map
uint8 map_y; ///< Y size of map
byte land_generator; ///< the landscape generator
byte oil_refinery_limit; ///< distance oil refineries allowed from map edge
byte snow_line_height; ///< a number 0-15 that configured snow line height
byte tgen_smoothness; ///< how rough is the terrain from 0-3
byte tree_placer; ///< the tree placer algorithm
byte heightmap_rotation; ///< rotation director for the heightmap
byte se_flat_world_height; ///< land height a flat world gets in SE
};
bool always_build_infrastructure; ///< Always allow building of infrastructure, even when you do not have the vehicles for it /** Settings related to construction in-game */
UnitID max_trains; ///< max trains in game per player (these are 16bit because the unitnumber field can't hold more) struct ConstructionSettings {
UnitID max_roadveh; ///< max trucks in game per player bool build_on_slopes; ///< allow building on slopes
UnitID max_aircraft; ///< max planes in game per player bool autoslope; ///< allow terraforming under things
UnitID max_ships; ///< max ships in game per player bool longbridges; ///< allow 100 tile long bridges
bool signal_side; ///< show signals on right side
bool extra_dynamite; ///< extra dynamite
bool road_stop_on_town_road; ///< allow building of drive-through road stops on town owned roads
uint8 raw_industry_construction; ///< type of (raw) industry construction (none, "normal", prospecting)
};
bool servint_ispercent; ///< service intervals are in percents /** Settings related to the AI. */
uint16 servint_trains; ///< service interval for trains struct AISettings {
uint16 servint_roadveh; ///< service interval for road vehicles bool ainew_active; ///< is the new AI active?
uint16 servint_aircraft; ///< service interval for aircraft bool ai_in_multiplayer; ///< so we allow AIs in multiplayer
uint16 servint_ships; ///< service interval for ships bool ai_disable_veh_train; ///< disable types for AI
bool ai_disable_veh_roadveh; ///< disable types for AI
bool ai_disable_veh_aircraft; ///< disable types for AI
bool ai_disable_veh_ship; ///< disable types for AI
};
uint8 pathfinder_for_trains; ///< the pathfinder to use for trains /** Settings related to the old pathfinder. */
uint8 pathfinder_for_roadvehs; ///< the pathfinder to use for roadvehicles struct OPFSettings {
uint8 pathfinder_for_ships; ///< the pathfinder to use for ships uint16 pf_maxlength; ///< maximum length when searching for a train route for new pathfinder
byte pf_maxdepth; ///< maximum recursion depth when searching for a train route for new pathfinder
uint8 plane_speed; ///< divisor for speed of aircraft };
bool autorenew;
int16 autorenew_months;
int32 autorenew_money;
byte pf_maxdepth; ///< maximum recursion depth when searching for a train route for new pathfinder
uint16 pf_maxlength; ///< maximum length when searching for a train route for new pathfinder
bool bridge_pillars; ///< show bridge pillars for high bridges
bool ai_disable_veh_train; ///< disable types for AI
bool ai_disable_veh_roadveh; ///< disable types for AI
bool ai_disable_veh_aircraft; ///< disable types for AI
bool ai_disable_veh_ship; ///< disable types for AI
Year starting_year; ///< starting date
Year ending_year; ///< end of the game (just show highscore)
Year colored_news_year; ///< when does newspaper become colored?
bool keep_all_autosave; ///< name the autosave in a different way.
bool autosave_on_exit; ///< save an autosave when you quit the game, but do not ask "Do you really want to quit?"
byte max_num_autosaves; ///< controls how many autosavegames are made before the game starts to overwrite (names them 0 to max_num_autosaves - 1)
bool extra_dynamite; ///< extra dynamite
bool road_stop_on_town_road; ///< allow building of drive-through road stops on town owned roads
bool never_expire_vehicles; ///< never expire vehicles
byte extend_vehicle_life; ///< extend vehicle life by this many years
bool auto_euro; ///< automatically switch to euro in 2002
bool serviceathelipad; ///< service helicopters at helipads automatically (no need to send to depot)
bool smooth_economy; ///< smooth economy
bool allow_shares; ///< allow the buying/selling of shares
byte dist_local_authority; ///< distance for town local authority, default 20
byte wait_oneway_signal; ///< waitingtime in days before a oneway signal
byte wait_twoway_signal; ///< waitingtime in days before a twoway signal
uint8 map_x; ///< Size of map
uint8 map_y;
byte drag_signals_density; ///< many signals density
Year semaphore_build_before; ///< Build semaphore signals automatically before this year
bool ainew_active; ///< Is the new AI active?
bool ai_in_multiplayer; ///< Do we allow AIs in multiplayer
/*
* New Path Finding
*/
bool new_pathfinding_all; ///< Use the newest pathfinding algorithm for all
/** Settings related to the new pathfinder. */
struct NPFSettings {
/** /**
* The maximum amount of search nodes a single NPF run should take. This * The maximum amount of search nodes a single NPF run should take. This
* limit should make sure performance stays at acceptable levels at the cost * limit should make sure performance stays at acceptable levels at the cost
* of not being perfect anymore. This will probably be fixed in a more * of not being perfect anymore.
* sophisticated way sometime soon
*/ */
uint32 npf_max_search_nodes; uint32 npf_max_search_nodes;
uint32 npf_rail_firstred_penalty; ///< The penalty for when the first signal is red (and it is not an exit or combo signal) uint32 npf_rail_firstred_penalty; ///< the penalty for when the first signal is red (and it is not an exit or combo signal)
uint32 npf_rail_firstred_exit_penalty; ///< The penalty for when the first signal is red (and it is an exit or combo signal) uint32 npf_rail_firstred_exit_penalty; ///< the penalty for when the first signal is red (and it is an exit or combo signal)
uint32 npf_rail_lastred_penalty; ///< The penalty for when the last signal is red uint32 npf_rail_lastred_penalty; ///< the penalty for when the last signal is red
uint32 npf_rail_station_penalty; ///< The penalty for station tiles uint32 npf_rail_station_penalty; ///< the penalty for station tiles
uint32 npf_rail_slope_penalty; ///< The penalty for sloping upwards uint32 npf_rail_slope_penalty; ///< the penalty for sloping upwards
uint32 npf_rail_curve_penalty; ///< The penalty for curves uint32 npf_rail_curve_penalty; ///< the penalty for curves
uint32 npf_rail_depot_reverse_penalty; ///< The penalty for reversing in depots uint32 npf_rail_depot_reverse_penalty; ///< the penalty for reversing in depots
uint32 npf_buoy_penalty; ///< The penalty for going over (through) a buoy uint32 npf_buoy_penalty; ///< the penalty for going over (through) a buoy
uint32 npf_water_curve_penalty; ///< The penalty for curves uint32 npf_water_curve_penalty; ///< the penalty for curves
uint32 npf_road_curve_penalty; ///< The penalty for curves uint32 npf_road_curve_penalty; ///< the penalty for curves
uint32 npf_crossing_penalty; ///< The penalty for level crossings uint32 npf_crossing_penalty; ///< the penalty for level crossings
uint32 npf_road_drive_through_penalty; ///< The penalty for going through a drive-through road stop uint32 npf_road_drive_through_penalty; ///< the penalty for going through a drive-through road stop
bool population_in_label; ///< Show the population of a town in his label?
uint8 freight_trains; ///< Value to multiply the weight of cargo by
/** YAPF settings */
YapfSettings yapf;
uint8 right_mouse_btn_emulation;
uint8 scrollwheel_scrolling;
uint8 scrollwheel_multiplier;
uint8 town_growth_rate; ///< Town growth rate
uint8 larger_towns; ///< The number of cities to build. These start off larger and grow twice as fast
uint8 initial_city_size; ///< Multiplier for the initial size of the cities compared to towns
bool pause_on_newgame; ///< Whether to start new games paused or not.
TownLayoutByte town_layout; ///< Select town layout
bool station_noise_level; ///< build new airports when the town noise level is still within accepted limits
uint16 town_noise_population[3]; ///< Population to base decision on noise evaluation (@see town_council_tolerance)
bool timetabling; ///< Whether to allow timetabling.
bool timetable_in_ticks; ///< Whether to show the timetable in ticks rather than days.
bool autoslope; ///< Allow terraforming under things.
bool mod_road_rebuild; ///< Roadworks remove unneccesary RoadBits
bool exclusive_rights; ///< allow buying exclusive rights
bool give_money; ///< allow giving other players money
bool enable_signal_gui; ///< Show the signal GUI when the signal button is pressed
bool dynamic_engines; ///< Enable dynamic allocation of engine data
}; };
extern Patches _patches; /** Settings related to the yet another pathfinder. */
struct YAPFSettings {
bool disable_node_optimization; ///< whether to use exit-dir instead of trackdir in node key
uint32 max_search_nodes; ///< stop path-finding when this number of nodes visited
bool ship_use_yapf; ///< use YAPF for ships
bool road_use_yapf; ///< use YAPF for road
bool rail_use_yapf; ///< use YAPF for rail
uint32 road_slope_penalty; ///< penalty for up-hill slope
uint32 road_curve_penalty; ///< penalty for curves
uint32 road_crossing_penalty; ///< penalty for level crossing
uint32 road_stop_penalty; ///< penalty for going through a drive-through road stop
bool rail_firstred_twoway_eol; ///< treat first red two-way signal as dead end
uint32 rail_firstred_penalty; ///< penalty for first red signal
uint32 rail_firstred_exit_penalty; ///< penalty for first red exit signal
uint32 rail_lastred_penalty; ///< penalty for last red signal
uint32 rail_lastred_exit_penalty; ///< penalty for last red exit signal
uint32 rail_station_penalty; ///< penalty for non-target station tile
uint32 rail_slope_penalty; ///< penalty for up-hill slope
uint32 rail_curve45_penalty; ///< penalty for curve
uint32 rail_curve90_penalty; ///< penalty for 90-deg curve
uint32 rail_depot_reverse_penalty; ///< penalty for reversing in the depot
uint32 rail_crossing_penalty; ///< penalty for level crossing
uint32 rail_look_ahead_max_signals; ///< max. number of signals taken into consideration in look-ahead load balancer
int32 rail_look_ahead_signal_p0; ///< constant in polynomial penalty function
int32 rail_look_ahead_signal_p1; ///< constant in polynomial penalty function
int32 rail_look_ahead_signal_p2; ///< constant in polynomial penalty function
uint32 rail_longer_platform_penalty; ///< penalty for longer station platform than train
uint32 rail_longer_platform_per_tile_penalty; ///< penalty for longer station platform than train (per tile)
uint32 rail_shorter_platform_penalty; ///< penalty for shorter station platform than train
uint32 rail_shorter_platform_per_tile_penalty; ///< penalty for shorter station platform than train (per tile)
};
/** Settings related to all pathfinders. */
struct PathfinderSettings {
uint8 pathfinder_for_trains; ///< the pathfinder to use for trains
uint8 pathfinder_for_roadvehs; ///< the pathfinder to use for roadvehicles
uint8 pathfinder_for_ships; ///< the pathfinder to use for ships
bool new_pathfinding_all; ///< use the newest pathfinding algorithm for all
bool roadveh_queue; ///< buggy road vehicle queueing
bool forbid_90_deg; ///< forbid trains to make 90 deg turns
byte wait_oneway_signal; ///< waitingtime in days before a oneway signal
byte wait_twoway_signal; ///< waitingtime in days before a twoway signal
OPFSettings opf; ///< pathfinder settings for the old pathfinder
NPFSettings npf; ///< pathfinder settings for the new pathfinder
YAPFSettings yapf; ///< pathfinder settings for the yet another pathfinder
};
/** Settings related to orders. */
struct OrderSettings {
bool improved_load; ///< improved loading algorithm
bool gradual_loading; ///< load vehicles gradually
bool selectgoods; ///< only send the goods to station if a train has been there
bool gotodepot; ///< allow goto depot in orders
bool no_servicing_if_no_breakdowns; ///< dont send vehicles to depot when breakdowns are disabled
bool timetabling; ///< whether to allow timetabling
bool serviceathelipad; ///< service helicopters at helipads automatically (no need to send to depot)
};
/** Settings related to vehicles. */
struct VehicleSettings {
bool mammoth_trains; ///< allow very long trains
bool realistic_acceleration; ///< realistic acceleration for trains
bool wagon_speed_limits; ///< enable wagon speed limits
bool disable_elrails; ///< when true, the elrails are disabled
UnitID max_trains; ///< max trains in game per player
UnitID max_roadveh; ///< max trucks in game per player
UnitID max_aircraft; ///< max planes in game per player
UnitID max_ships; ///< max ships in game per player
bool servint_ispercent; ///< service intervals are in percents
uint16 servint_trains; ///< service interval for trains
uint16 servint_roadveh; ///< service interval for road vehicles
uint16 servint_aircraft; ///< service interval for aircraft
uint16 servint_ships; ///< service interval for ships
uint8 plane_speed; ///< divisor for speed of aircraft
uint8 freight_trains; ///< value to multiply the weight of cargo by
bool dynamic_engines; ///< enable dynamic allocation of engine data
bool never_expire_vehicles; ///< never expire vehicles
byte extend_vehicle_life; ///< extend vehicle life by this many years
};
/** Settings related to the economy. */
struct EconomySettings {
bool inflation; ///< disable inflation
bool bribe; ///< enable bribing the local authority
bool smooth_economy; ///< smooth economy
bool allow_shares; ///< allow the buying/selling of shares
byte dist_local_authority; ///< distance for town local authority, default 20
bool exclusive_rights; ///< allow buying exclusive rights
bool give_money; ///< allow giving other players money
bool mod_road_rebuild; ///< roadworks remove unneccesary RoadBits
bool multiple_industry_per_town; ///< allow many industries of the same type per town
bool same_industry_close; ///< allow same type industries to be built close to each other
uint8 town_growth_rate; ///< town growth rate
uint8 larger_towns; ///< the number of cities to build. These start off larger and grow twice as fast
uint8 initial_city_size; ///< multiplier for the initial size of the cities compared to towns
TownLayoutByte town_layout; ///< select town layout
bool station_noise_level; ///< build new airports when the town noise level is still within accepted limits
uint16 town_noise_population[3]; ///< population to base decision on noise evaluation (@see town_council_tolerance)
};
/** Settings related to stations. */
struct StationSettings {
bool modified_catchment; ///< different-size catchment areas
bool join_stations; ///< allow joining of train stations
bool nonuniform_stations; ///< allow nonuniform train stations
bool adjacent_stations; ///< allow stations to be built directly adjacent to other stations
bool always_small_airport; ///< always allow small airports
byte station_spread; ///< amount a station may spread
};
/** All settings together. */
struct Settings {
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?
PathfinderSettings pf; ///< settings for all pathfinders
OrderSettings order; ///< settings related to orders
VehicleSettings vehicle; ///< options for vehicles
EconomySettings economy; ///< settings to change the economy
StationSettings station; ///< settings related to station management
};
extern Settings _settings;
/** The patch values that are used for new games and/or modified in config file */ /** The patch values that are used for new games and/or modified in config file */
extern Patches _patches_newgame; extern Settings _settings_newgame;
#endif /* SETTINGS_TYPE_H */ #endif /* SETTINGS_TYPE_H */

View File

@ -106,7 +106,7 @@ SpriteID Ship::GetImage(Direction direction) const
static const Depot* FindClosestShipDepot(const Vehicle* v) static const Depot* FindClosestShipDepot(const Vehicle* v)
{ {
if (_patches.pathfinder_for_ships == VPF_NPF) { /* NPF is used */ if (_settings.pf.pathfinder_for_ships == VPF_NPF) { /* NPF is used */
Trackdir trackdir = GetVehicleTrackdir(v); Trackdir trackdir = GetVehicleTrackdir(v);
NPFFoundTargetData ftd = NPFRouteToDepotTrialError(v->tile, trackdir, false, TRANSPORT_WATER, 0, v->owner, INVALID_RAILTYPES); NPFFoundTargetData ftd = NPFRouteToDepotTrialError(v->tile, trackdir, false, TRANSPORT_WATER, 0, v->owner, INVALID_RAILTYPES);
@ -137,7 +137,7 @@ static const Depot* FindClosestShipDepot(const Vehicle* v)
static void CheckIfShipNeedsService(Vehicle *v) static void CheckIfShipNeedsService(Vehicle *v)
{ {
if (_patches.servint_ships == 0 || !v->NeedsAutomaticServicing()) return; if (_settings.vehicle.servint_ships == 0 || !v->NeedsAutomaticServicing()) return;
if (v->IsInDepot()) { if (v->IsInDepot()) {
VehicleServiceInDepot(v); VehicleServiceInDepot(v);
return; return;
@ -320,7 +320,7 @@ static bool ShipAccelerate(Vehicle *v)
/*updates statusbar only if speed have changed to save CPU time */ /*updates statusbar only if speed have changed to save CPU time */
if (spd != v->cur_speed) { if (spd != v->cur_speed) {
v->cur_speed = spd; v->cur_speed = spd;
if (_patches.vehicle_speed) if (_settings.gui.vehicle_speed)
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
@ -459,7 +459,7 @@ static Track ChooseShipTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir,
{ {
assert(IsValidDiagDirection(enterdir)); assert(IsValidDiagDirection(enterdir));
switch (_patches.pathfinder_for_ships) { switch (_settings.pf.pathfinder_for_ships) {
case VPF_YAPF: { /* YAPF */ case VPF_YAPF: { /* YAPF */
Trackdir trackdir = YapfChooseShipTrack(v, tile, enterdir, tracks); Trackdir trackdir = YapfChooseShipTrack(v, tile, enterdir, tracks);
if (trackdir != INVALID_TRACKDIR) return TrackdirToTrack(trackdir); if (trackdir != INVALID_TRACKDIR) return TrackdirToTrack(trackdir);
@ -756,7 +756,7 @@ CommandCost CmdBuildShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
unit_num = HasBit(p2, 0) ? 0 : GetFreeUnitNumber(VEH_SHIP); unit_num = HasBit(p2, 0) ? 0 : GetFreeUnitNumber(VEH_SHIP);
if (!Vehicle::AllocateList(NULL, 1) || unit_num > _patches.max_ships) if (!Vehicle::AllocateList(NULL, 1) || unit_num > _settings.vehicle.max_ships)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME); return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
@ -800,7 +800,7 @@ CommandCost CmdBuildShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v->name = NULL; v->name = NULL;
v->u.ship.state = TRACK_BIT_DEPOT; v->u.ship.state = TRACK_BIT_DEPOT;
v->service_interval = _patches.servint_ships; v->service_interval = _settings.vehicle.servint_ships;
v->date_of_last_service = _date; v->date_of_last_service = _date;
v->build_year = _cur_year; v->build_year = _cur_year;
v->cur_image = 0x0E5E; v->cur_image = 0x0E5E;

View File

@ -285,7 +285,7 @@ bool StationRect::BeforeAddTile(TileIndex tile, StationRectMode mode)
/* check new rect dimensions against preset max */ /* check new rect dimensions against preset max */
int w = new_rect.right - new_rect.left + 1; int w = new_rect.right - new_rect.left + 1;
int h = new_rect.bottom - new_rect.top + 1; int h = new_rect.bottom - new_rect.top + 1;
if (mode != ADD_FORCE && (w > _patches.station_spread || h > _patches.station_spread)) { if (mode != ADD_FORCE && (w > _settings.station.station_spread || h > _settings.station.station_spread)) {
assert(mode != ADD_TRY); assert(mode != ADD_TRY);
_error_message = STR_306C_STATION_TOO_SPREAD_OUT; _error_message = STR_306C_STATION_TOO_SPREAD_OUT;
return false; return false;

View File

@ -563,7 +563,7 @@ static void UpdateStationAcceptance(Station *st, bool show_msg)
TileXY(rect.left, rect.bottom), TileXY(rect.left, rect.bottom),
rect.right - rect.left + 1, rect.right - rect.left + 1,
rect.top - rect.bottom + 1, rect.top - rect.bottom + 1,
_patches.modified_catchment ? FindCatchmentRadius(st) : (uint)CA_UNMODIFIED _settings.station.modified_catchment ? FindCatchmentRadius(st) : (uint)CA_UNMODIFIED
); );
} else { } else {
memset(accepts, 0, sizeof(accepts)); memset(accepts, 0, sizeof(accepts));
@ -692,7 +692,7 @@ CommandCost CheckFlatLandBelow(TileIndex tile, uint w, uint h, uint flags, uint
* b) the build_on_slopes switch is disabled * b) the build_on_slopes switch is disabled
*/ */
if (IsSteepSlope(tileh) || if (IsSteepSlope(tileh) ||
((_is_old_ai_player || !_patches.build_on_slopes) && tileh != SLOPE_FLAT)) { ((_is_old_ai_player || !_settings.construction.build_on_slopes) && tileh != SLOPE_FLAT)) {
return_cmd_error(STR_0007_FLAT_LAND_REQUIRED); return_cmd_error(STR_0007_FLAT_LAND_REQUIRED);
} }
@ -750,7 +750,7 @@ static bool CanExpandRailroadStation(const Station *st, uint *fin, Axis axis)
uint w = fin[1]; uint w = fin[1];
uint h = fin[2]; uint h = fin[2];
if (_patches.nonuniform_stations) { if (_settings.station.nonuniform_stations) {
/* determine new size of train station region.. */ /* determine new size of train station region.. */
int x = min(TileX(st->train_tile), TileX(tile)); int x = min(TileX(st->train_tile), TileX(tile));
int y = min(TileY(st->train_tile), TileY(tile)); int y = min(TileY(st->train_tile), TileY(tile));
@ -794,7 +794,7 @@ static bool CanExpandRailroadStation(const Station *st, uint *fin, Axis axis)
} }
} }
/* make sure the final size is not too big. */ /* make sure the final size is not too big. */
if (curw > _patches.station_spread || curh > _patches.station_spread) { if (curw > _settings.station.station_spread || curh > _settings.station.station_spread) {
_error_message = STR_306C_STATION_TOO_SPREAD_OUT; _error_message = STR_306C_STATION_TOO_SPREAD_OUT;
return false; return false;
} }
@ -883,7 +883,7 @@ CommandCost CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1,
w_org = numtracks; w_org = numtracks;
} }
if (h_org > _patches.station_spread || w_org > _patches.station_spread) return CMD_ERROR; if (h_org > _settings.station.station_spread || w_org > _settings.station.station_spread) return CMD_ERROR;
/* these values are those that will be stored in train_tile and station_platforms */ /* these values are those that will be stored in train_tile and station_platforms */
uint finalvalues[3]; uint finalvalues[3];
@ -896,14 +896,14 @@ CommandCost CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1,
/* If DC_EXEC is in flag, do not want to pass it to CheckFlatLandBelow, because of a nice bug /* If DC_EXEC is in flag, do not want to pass it to CheckFlatLandBelow, because of a nice bug
* for detail info, see: * for detail info, see:
* https://sourceforge.net/tracker/index.php?func=detail&aid=1029064&group_id=103924&atid=636365 */ * 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, _patches.nonuniform_stations ? &est : NULL); CommandCost ret = CheckFlatLandBelow(tile_org, w_org, h_org, flags & ~DC_EXEC, 5 << axis, _settings.station.nonuniform_stations ? &est : NULL);
if (CmdFailed(ret)) return ret; if (CmdFailed(ret)) return ret;
CommandCost cost(EXPENSES_CONSTRUCTION, ret.GetCost() + (numtracks * _price.train_station_track + _price.train_station_length) * plat_len); CommandCost cost(EXPENSES_CONSTRUCTION, ret.GetCost() + (numtracks * _price.train_station_track + _price.train_station_length) * plat_len);
Station *st = NULL; Station *st = NULL;
bool check_surrounding = true; bool check_surrounding = true;
if (_patches.adjacent_stations) { if (_settings.station.adjacent_stations) {
if (est != INVALID_STATION) { if (est != INVALID_STATION) {
if (HasBit(p1, 24)) { if (HasBit(p1, 24)) {
/* You can't build an adjacent station over the top of one that /* You can't build an adjacent station over the top of one that
@ -938,7 +938,7 @@ CommandCost CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1,
if (st->train_tile != 0) { if (st->train_tile != 0) {
/* check if we want to expanding an already existing station? */ /* check if we want to expanding an already existing station? */
if (_is_old_ai_player || !_patches.join_stations) if (_is_old_ai_player || !_settings.station.join_stations)
return_cmd_error(STR_3005_TOO_CLOSE_TO_ANOTHER_RAILROAD); return_cmd_error(STR_3005_TOO_CLOSE_TO_ANOTHER_RAILROAD);
if (!CanExpandRailroadStation(st, finalvalues, axis)) if (!CanExpandRailroadStation(st, finalvalues, axis))
return CMD_ERROR; return CMD_ERROR;
@ -993,7 +993,7 @@ CommandCost CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1,
/* Now really clear the land below the station /* Now really clear the land below the station
* It should never return CMD_ERROR.. but you never know ;) * 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) */ * (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, _patches.nonuniform_stations ? &est : NULL); ret = CheckFlatLandBelow(tile_org, w_org, h_org, flags, 5 << axis, _settings.station.nonuniform_stations ? &est : NULL);
if (CmdFailed(ret)) return ret; if (CmdFailed(ret)) return ret;
st->train_tile = finalvalues[0]; st->train_tile = finalvalues[0];
@ -1162,7 +1162,7 @@ CommandCost CmdRemoveFromRailroadStation(TileIndex tile, uint32 flags, uint32 p1
/* Do not allow removing from stations if non-uniform stations are not enabled /* Do not allow removing from stations if non-uniform stations are not enabled
* The check must be here to give correct error message * The check must be here to give correct error message
*/ */
if (!_patches.nonuniform_stations) return_cmd_error(STR_NONUNIFORM_STATIONS_DISALLOWED); if (!_settings.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 */ /* If we reached here, the tile is valid so increase the quantity of tiles we will remove */
quantity++; quantity++;
@ -1207,7 +1207,7 @@ CommandCost CmdRemoveFromRailroadStation(TileIndex tile, uint32 flags, uint32 p1
static CommandCost RemoveRailroadStation(Station *st, TileIndex tile, uint32 flags) 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 there is flooding and non-uniform stations are enabled, remove platforms tile by tile */
if (_current_player == OWNER_WATER && _patches.nonuniform_stations) { if (_current_player == OWNER_WATER && _settings.station.nonuniform_stations) {
return DoCommand(tile, 0, 0, DC_EXEC, CMD_REMOVE_FROM_RAILROAD_STATION); return DoCommand(tile, 0, 0, DC_EXEC, CMD_REMOVE_FROM_RAILROAD_STATION);
} }
@ -1326,7 +1326,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
Owner road_owner = GetRoadOwner(tile, ROADTYPE_ROAD); Owner road_owner = GetRoadOwner(tile, ROADTYPE_ROAD);
if (road_owner == OWNER_TOWN) { if (road_owner == OWNER_TOWN) {
town_owned_road = true; town_owned_road = true;
if (!_patches.road_stop_on_town_road) return_cmd_error(STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD); if (!_settings.construction.road_stop_on_town_road) return_cmd_error(STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD);
} else { } else {
if (road_owner != OWNER_NONE && !CheckOwnership(road_owner)) return CMD_ERROR; if (road_owner != OWNER_NONE && !CheckOwnership(road_owner)) return CMD_ERROR;
} }
@ -1350,7 +1350,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
Station *st = NULL; Station *st = NULL;
if (!_patches.adjacent_stations || !HasBit(p2, 5)) { if (!_settings.station.adjacent_stations || !HasBit(p2, 5)) {
st = GetStationAround(tile, 1, 1, INVALID_STATION); st = GetStationAround(tile, 1, 1, INVALID_STATION);
if (st == CHECK_STATIONS_ERR) return CMD_ERROR; if (st == CHECK_STATIONS_ERR) return CMD_ERROR;
} }
@ -1718,7 +1718,7 @@ CommandCost CmdBuildAirport(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
int h = afc->size_y; int h = afc->size_y;
Station *st = NULL; Station *st = NULL;
if (w > _patches.station_spread || h > _patches.station_spread) { if (w > _settings.station.station_spread || h > _settings.station.station_spread) {
_error_message = STR_306C_STATION_TOO_SPREAD_OUT; _error_message = STR_306C_STATION_TOO_SPREAD_OUT;
return CMD_ERROR; return CMD_ERROR;
} }
@ -1732,7 +1732,7 @@ CommandCost CmdBuildAirport(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
/* Check if local auth would allow a new airport */ /* Check if local auth would allow a new airport */
bool autority_refused; bool autority_refused;
if (_patches.station_noise_level) { if (_settings.economy.station_noise_level) {
/* do not allow to build a new airport if this raise the town noise over the maximum allowed by town */ /* do not allow to build a new airport if this raise the town noise over the maximum allowed by town */
autority_refused = (t->noise_reached + newnoise_level) > t->MaxTownNoise(); autority_refused = (t->noise_reached + newnoise_level) > t->MaxTownNoise();
} else { } else {
@ -1749,7 +1749,7 @@ CommandCost CmdBuildAirport(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
return_cmd_error(STR_2035_LOCAL_AUTHORITY_REFUSES); return_cmd_error(STR_2035_LOCAL_AUTHORITY_REFUSES);
} }
if (!_patches.adjacent_stations || !HasBit(p2, 0)) { if (!_settings.station.adjacent_stations || !HasBit(p2, 0)) {
st = GetStationAround(tile, w, h, INVALID_STATION); st = GetStationAround(tile, w, h, INVALID_STATION);
if (st == CHECK_STATIONS_ERR) return CMD_ERROR; if (st == CHECK_STATIONS_ERR) return CMD_ERROR;
} else { } else {
@ -1824,7 +1824,7 @@ CommandCost CmdBuildAirport(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
InvalidateWindowData(WC_STATION_LIST, st->owner, 0); InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_PLANES); InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_PLANES);
if (_patches.station_noise_level) { if (_settings.economy.station_noise_level) {
InvalidateWindow(WC_TOWN_VIEW, st->town->index); InvalidateWindow(WC_TOWN_VIEW, st->town->index);
} }
} }
@ -1881,7 +1881,7 @@ static CommandCost RemoveAirport(Station *st, uint32 flags)
InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_PLANES); InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_PLANES);
if (_patches.station_noise_level) { if (_settings.economy.station_noise_level) {
InvalidateWindow(WC_TOWN_VIEW, st->town->index); InvalidateWindow(WC_TOWN_VIEW, st->town->index);
} }
@ -2044,7 +2044,7 @@ CommandCost CmdBuildDock(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
/* middle */ /* middle */
Station *st = NULL; Station *st = NULL;
if (!_patches.adjacent_stations || !HasBit(p1, 0)) { if (!_settings.station.adjacent_stations || !HasBit(p1, 0)) {
st = GetStationAround( st = GetStationAround(
tile + ToTileIndexDiff(_dock_tileoffs_chkaround[direction]), tile + ToTileIndexDiff(_dock_tileoffs_chkaround[direction]),
_dock_w_chk[direction], _dock_h_chk[direction], INVALID_STATION); _dock_w_chk[direction], _dock_h_chk[direction], INVALID_STATION);
@ -2774,7 +2774,7 @@ StationSet FindStationsAroundIndustryTile(TileIndex tile, int w, int h)
int w_prod; // width and height of the "producer" of the cargo int w_prod; // width and height of the "producer" of the cargo
int h_prod; int h_prod;
int max_rad; int max_rad;
if (_patches.modified_catchment) { if (_settings.station.modified_catchment) {
w_prod = w; w_prod = w;
h_prod = h; h_prod = h;
w += 2 * MAX_CATCHMENT; w += 2 * MAX_CATCHMENT;
@ -2797,7 +2797,7 @@ StationSet FindStationsAroundIndustryTile(TileIndex tile, int w, int h)
if (st->IsBuoy()) continue; // bouys don't accept cargo if (st->IsBuoy()) continue; // bouys don't accept cargo
if (_patches.modified_catchment) { if (_settings.station.modified_catchment) {
/* min and max coordinates of the producer relative */ /* min and max coordinates of the producer relative */
const int x_min_prod = max_rad + 1; const int x_min_prod = max_rad + 1;
const int x_max_prod = max_rad + w_prod; const int x_max_prod = max_rad + w_prod;
@ -2851,7 +2851,7 @@ uint MoveGoodsToStation(TileIndex tile, int w, int h, CargoID type, uint amount)
if (st->goods[type].rating == 0) continue; // Lowest possible rating, better not to give cargo anymore if (st->goods[type].rating == 0) continue; // Lowest possible rating, better not to give cargo anymore
if (_patches.selectgoods && st->goods[type].last_speed == 0) continue; // Selectively servicing stations, and not this one if (_settings.order.selectgoods && st->goods[type].last_speed == 0) continue; // Selectively servicing stations, and not this one
if (IsCargoInClass(type, CC_PASSENGERS)) { if (IsCargoInClass(type, CC_PASSENGERS)) {
if (st->facilities == FACIL_TRUCK_STOP) continue; // passengers are never served by just a truck stop if (st->facilities == FACIL_TRUCK_STOP) continue; // passengers are never served by just a truck stop
@ -3076,7 +3076,7 @@ void AfterLoadStations()
static CommandCost TerraformTile_Station(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new) static CommandCost TerraformTile_Station(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
{ {
if (_patches.build_on_slopes && AutoslopeEnabled()) { if (_settings.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. /* 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. * TTDP does not call it.
*/ */

View File

@ -57,7 +57,7 @@ enum CatchmentArea {
CA_TRAIN = 4, CA_TRAIN = 4,
CA_DOCK = 5, CA_DOCK = 5,
CA_UNMODIFIED = 4, ///< Used when _patches.modified_catchment is false CA_UNMODIFIED = 4, ///< Used when _settings.station.modified_catchment is false
MAX_CATCHMENT = 10, ///< Airports have a catchment up to this number. MAX_CATCHMENT = 10, ///< Airports have a catchment up to this number.
}; };

View File

@ -82,7 +82,7 @@ struct StatusBarWindow : Window {
this->DrawWidgets(); this->DrawWidgets();
SetDParam(0, _date); SetDParam(0, _date);
DrawStringCentered(70, 1, (_pause_game || _patches.status_long_date) ? STR_00AF : STR_00AE, TC_FROMSTRING); DrawStringCentered(70, 1, (_pause_game || _settings.gui.status_long_date) ? STR_00AF : STR_00AE, TC_FROMSTRING);
if (p != NULL) { if (p != NULL) {
/* Draw player money */ /* Draw player money */

View File

@ -392,7 +392,7 @@ void DrawTextEffects(DrawPixelInfo *dpi)
dpi->top <= te->bottom && dpi->top <= te->bottom &&
dpi->left + dpi->width > te->x && dpi->left + dpi->width > te->x &&
dpi->top + dpi->height > te->y) { dpi->top + dpi->height > te->y) {
if (te->mode == TE_RISING || (_patches.loading_indicators && !IsTransparencySet(TO_LOADING))) { if (te->mode == TE_RISING || (_settings.gui.loading_indicators && !IsTransparencySet(TO_LOADING))) {
AddStringToDraw(te->x, te->y, te->string_id, te->params_1, te->params_2); AddStringToDraw(te->x, te->y, te->string_id, te->params_1, te->params_2);
} }
} }
@ -407,7 +407,7 @@ void DrawTextEffects(DrawPixelInfo *dpi)
dpi->top <= te->bottom * 2 - te->y && dpi->top <= te->bottom * 2 - te->y &&
dpi->left + dpi->width > te->x && dpi->left + dpi->width > te->x &&
dpi->top + dpi->height > te->y) { dpi->top + dpi->height > te->y) {
if (te->mode == TE_RISING || (_patches.loading_indicators && !IsTransparencySet(TO_LOADING))) { if (te->mode == TE_RISING || (_settings.gui.loading_indicators && !IsTransparencySet(TO_LOADING))) {
AddStringToDraw(te->x, te->y, (StringID)(te->string_id - 1), te->params_1, te->params_2); AddStringToDraw(te->x, te->y, (StringID)(te->string_id - 1), te->params_1, te->params_2);
} }
} }

View File

@ -342,7 +342,7 @@ static void HeightMapGenerate()
do { do {
log_frequency = iteration_round - log_frequency_min; log_frequency = iteration_round - log_frequency_min;
if (log_frequency >= 0) { if (log_frequency >= 0) {
amplitude = _amplitudes_by_smoothness_and_frequency[_patches.tgen_smoothness][log_frequency]; amplitude = _amplitudes_by_smoothness_and_frequency[_settings.game_creation.tgen_smoothness][log_frequency];
} else { } else {
amplitude = 0; amplitude = 0;
} }
@ -531,7 +531,7 @@ static double perlin_coast_noise_2D(const double x, const double y, const double
*/ */
static void HeightMapCoastLines() static void HeightMapCoastLines()
{ {
int smallest_size = min(_patches.map_x, _patches.map_y); int smallest_size = min(_settings.game_creation.map_x, _settings.game_creation.map_y);
const int margin = 4; const int margin = 4;
uint y, x; uint y, x;
double max_x; double max_x;
@ -663,7 +663,7 @@ static void HeightMapNormalize()
{ {
const amplitude_t water_percent = _water_percent[_opt.diff.quantity_sea_lakes]; const amplitude_t water_percent = _water_percent[_opt.diff.quantity_sea_lakes];
const height_t h_max_new = I2H(_max_height[_opt.diff.terrain_type]); const height_t h_max_new = I2H(_max_height[_opt.diff.terrain_type]);
const height_t roughness = 7 + 3 * _patches.tgen_smoothness; const height_t roughness = 7 + 3 * _settings.game_creation.tgen_smoothness;
HeightMapAdjustWaterLevel(water_percent, h_max_new); HeightMapAdjustWaterLevel(water_percent, h_max_new);
@ -692,7 +692,7 @@ static inline int perlin_landXY(uint x, uint y)
*/ */
static double int_noise(const long x, const long y, const int prime) static double int_noise(const long x, const long y, const int prime)
{ {
long n = x + y * prime + _patches.generation_seed; long n = x + y * prime + _settings.game_creation.generation_seed;
n = (n << 13) ^ n; n = (n << 13) ^ n;

View File

@ -54,7 +54,7 @@ static void ChangeTimetable(Vehicle *v, VehicleOrderID order_number, uint16 time
*/ */
CommandCost CmdChangeTimetable(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) CommandCost CmdChangeTimetable(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{ {
if (!_patches.timetabling) return CMD_ERROR; if (!_settings.order.timetabling) return CMD_ERROR;
VehicleID veh = GB(p1, 0, 16); VehicleID veh = GB(p1, 0, 16);
if (!IsValidVehicleID(veh)) return CMD_ERROR; if (!IsValidVehicleID(veh)) return CMD_ERROR;
@ -90,7 +90,7 @@ CommandCost CmdChangeTimetable(TileIndex tile, uint32 flags, uint32 p1, uint32 p
*/ */
CommandCost CmdSetVehicleOnTime(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) CommandCost CmdSetVehicleOnTime(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{ {
if (!_patches.timetabling) return CMD_ERROR; if (!_settings.order.timetabling) return CMD_ERROR;
VehicleID veh = GB(p1, 0, 16); VehicleID veh = GB(p1, 0, 16);
if (!IsValidVehicleID(veh)) return CMD_ERROR; if (!IsValidVehicleID(veh)) return CMD_ERROR;
@ -116,7 +116,7 @@ CommandCost CmdSetVehicleOnTime(TileIndex tile, uint32 flags, uint32 p1, uint32
*/ */
CommandCost CmdAutofillTimetable(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) CommandCost CmdAutofillTimetable(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{ {
if (!_patches.timetabling) return CMD_ERROR; if (!_settings.order.timetabling) return CMD_ERROR;
VehicleID veh = GB(p1, 0, 16); VehicleID veh = GB(p1, 0, 16);
if (!IsValidVehicleID(veh)) return CMD_ERROR; if (!IsValidVehicleID(veh)) return CMD_ERROR;
@ -157,7 +157,7 @@ void UpdateVehicleTimetable(Vehicle *v, bool travelling)
v->current_order_time = 0; v->current_order_time = 0;
if (!_patches.timetabling) return; if (!_settings.order.timetabling) return;
/* Make sure the timetable only starts when the vehicle reaches the first /* Make sure the timetable only starts when the vehicle reaches the first
* order, not when travelling from the depot to the first station. */ * order, not when travelling from the depot to the first station. */

View File

@ -38,7 +38,7 @@ enum TimetableViewWindowWidgets {
void SetTimetableParams(int param1, int param2, uint32 time) void SetTimetableParams(int param1, int param2, uint32 time)
{ {
if (_patches.timetable_in_ticks) { if (_settings.gui.timetable_in_ticks) {
SetDParam(param1, STR_TIMETABLE_TICKS); SetDParam(param1, STR_TIMETABLE_TICKS);
SetDParam(param2, time); SetDParam(param2, time);
} else { } else {
@ -172,7 +172,7 @@ struct TimetableWindow : Window {
} }
y += 10; y += 10;
if (v->lateness_counter == 0 || (!_patches.timetable_in_ticks && v->lateness_counter / DAY_TICKS == 0)) { if (v->lateness_counter == 0 || (!_settings.gui.timetable_in_ticks && v->lateness_counter / DAY_TICKS == 0)) {
DrawString(2, y, STR_TIMETABLE_STATUS_ON_TIME, TC_BLACK); DrawString(2, y, STR_TIMETABLE_STATUS_ON_TIME, TC_BLACK);
} else { } else {
SetTimetableParams(0, 1, abs(v->lateness_counter)); SetTimetableParams(0, 1, abs(v->lateness_counter));
@ -222,7 +222,7 @@ struct TimetableWindow : Window {
if (order != NULL) { if (order != NULL) {
uint time = (selected % 2 == 1) ? order->travel_time : order->wait_time; uint time = (selected % 2 == 1) ? order->travel_time : order->wait_time;
if (!_patches.timetable_in_ticks) time /= DAY_TICKS; if (!_settings.gui.timetable_in_ticks) time /= DAY_TICKS;
if (time != 0) { if (time != 0) {
SetDParam(0, time); SetDParam(0, time);
@ -259,7 +259,7 @@ struct TimetableWindow : Window {
uint32 p1 = PackTimetableArgs(v, this->sel_index); uint32 p1 = PackTimetableArgs(v, this->sel_index);
uint64 time = StrEmpty(str) ? 0 : strtoul(str, NULL, 10); uint64 time = StrEmpty(str) ? 0 : strtoul(str, NULL, 10);
if (!_patches.timetable_in_ticks) time *= DAY_TICKS; if (!_settings.gui.timetable_in_ticks) time *= DAY_TICKS;
uint32 p2 = minu(time, MAX_UVALUE(uint16)); uint32 p2 = minu(time, MAX_UVALUE(uint16));

View File

@ -542,8 +542,8 @@ static void ToolbarScenDateBackward(Window *w)
w->HandleButtonClick(6); w->HandleButtonClick(6);
w->SetDirty(); w->SetDirty();
_patches_newgame.starting_year = Clamp(_patches_newgame.starting_year - 1, MIN_YEAR, MAX_YEAR); _settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year - 1, MIN_YEAR, MAX_YEAR);
SetDate(ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); SetDate(ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1));
} }
_left_button_clicked = false; _left_button_clicked = false;
} }
@ -555,8 +555,8 @@ static void ToolbarScenDateForward(Window *w)
w->HandleButtonClick(7); w->HandleButtonClick(7);
w->SetDirty(); w->SetDirty();
_patches_newgame.starting_year = Clamp(_patches_newgame.starting_year + 1, MIN_YEAR, MAX_YEAR); _settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year + 1, MIN_YEAR, MAX_YEAR);
SetDate(ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); SetDate(ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1));
} }
_left_button_clicked = false; _left_button_clicked = false;
} }
@ -905,8 +905,8 @@ struct ScenarioEditorToolbarWindow : Window {
virtual void OnPaint() virtual void OnPaint()
{ {
this->SetWidgetDisabledState(6, _patches_newgame.starting_year <= MIN_YEAR); this->SetWidgetDisabledState(6, _settings_newgame.game_creation.starting_year <= MIN_YEAR);
this->SetWidgetDisabledState(7, _patches_newgame.starting_year >= MAX_YEAR); this->SetWidgetDisabledState(7, _settings_newgame.game_creation.starting_year >= MAX_YEAR);
/* Draw brown-red toolbar bg. */ /* Draw brown-red toolbar bg. */
GfxFillRect(0, 0, this->width - 1, this->height - 1, 0xB2); GfxFillRect(0, 0, this->width - 1, this->height - 1, 0xB2);
@ -914,7 +914,7 @@ struct ScenarioEditorToolbarWindow : Window {
this->DrawWidgets(); this->DrawWidgets();
SetDParam(0, ConvertYMDToDate(_patches_newgame.starting_year, 0, 1)); SetDParam(0, ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1));
DrawStringCenteredTruncated(this->widget[6].right, this->widget[7].left, 6, STR_00AF, TC_FROMSTRING); DrawStringCenteredTruncated(this->widget[6].right, this->widget[7].left, 6, STR_00AF, TC_FROMSTRING);
/* We hide this panel when the toolbar space gets too small */ /* We hide this panel when the toolbar space gets too small */

View File

@ -197,7 +197,7 @@ struct Town : PoolItem<Town, TownID, &_Town_pool> {
inline uint16 MaxTownNoise() const { inline uint16 MaxTownNoise() const {
if (this->population == 0) return 0; // no population? no noise if (this->population == 0) return 0; // no population? no noise
return ((this->population / _patches.town_noise_population[_opt.diff.town_council_tolerance]) + 3); return ((this->population / _settings.economy.town_noise_population[_opt.diff.town_council_tolerance]) + 3);
} }
}; };
@ -207,7 +207,7 @@ struct Town : PoolItem<Town, TownID, &_Town_pool> {
*/ */
inline TownLayout Town::GetActiveLayout() const inline TownLayout Town::GetActiveLayout() const
{ {
return (_patches.town_layout == TL_RANDOM) ? this->layout : _patches.town_layout; return (_settings.economy.town_layout == TL_RANDOM) ? this->layout : _settings.economy.town_layout;
} }
struct HouseSpec { struct HouseSpec {

View File

@ -324,7 +324,7 @@ void UpdateTownVirtCoord(Town *t)
SetDParam(0, t->index); SetDParam(0, t->index);
SetDParam(1, t->population); SetDParam(1, t->population);
UpdateViewportSignPos(&t->sign, pt.x, pt.y - 24, UpdateViewportSignPos(&t->sign, pt.x, pt.y - 24,
_patches.population_in_label ? STR_TOWN_LABEL_POP : STR_TOWN_LABEL); _settings.gui.population_in_label ? STR_TOWN_LABEL_POP : STR_TOWN_LABEL);
MarkTownSignDirty(t); MarkTownSignDirty(t);
} }
@ -1255,7 +1255,7 @@ static bool GrowTown(Town *t)
/* Let the town be a ghost town /* Let the town be a ghost town
* The player wanted it in such a way. Thus there he has it. ;) * The player wanted it in such a way. Thus there he has it. ;)
* Never reached in editor mode. */ * Never reached in editor mode. */
if (_patches.town_layout == TL_NO_ROADS && _generating_world) { if (_settings.economy.town_layout == TL_NO_ROADS && _generating_world) {
return false; return false;
} }
@ -1485,7 +1485,7 @@ static void DoCreateTown(Town *t, TileIndex tile, uint32 townnameparts, TownSize
break; break;
case TSM_CITY: case TSM_CITY:
x *= _patches.initial_city_size; x *= _settings.economy.initial_city_size;
t->larger_town = true; t->larger_town = true;
break; break;
} }
@ -1586,7 +1586,7 @@ bool GenerateTowns()
{ {
uint num = 0; uint num = 0;
uint n = ScaleByMapSize(_num_initial_towns[_opt.diff.number_towns] + (Random() & 7)); uint n = ScaleByMapSize(_num_initial_towns[_opt.diff.number_towns] + (Random() & 7));
uint num_cities = _patches.larger_towns == 0 ? 0 : n / _patches.larger_towns; uint num_cities = _settings.economy.larger_towns == 0 ? 0 : n / _settings.economy.larger_towns;
SetGeneratingWorldProgress(GWP_TOWN, n); SetGeneratingWorldProgress(GWP_TOWN, n);
@ -1594,7 +1594,7 @@ bool GenerateTowns()
IncreaseGeneratingWorldProgress(GWP_TOWN); IncreaseGeneratingWorldProgress(GWP_TOWN);
/* try 20 times to create a random-sized town for the first loop. */ /* try 20 times to create a random-sized town for the first loop. */
TownSizeMode mode = num_cities > 0 ? TSM_CITY : TSM_RANDOM; TownSizeMode mode = num_cities > 0 ? TSM_CITY : TSM_RANDOM;
if (CreateRandomTown(20, mode, _patches.initial_city_size) != NULL) num++; if (CreateRandomTown(20, mode, _settings.economy.initial_city_size) != NULL) num++;
if (num_cities > 0) num_cities--; if (num_cities > 0) num_cities--;
} while (--n); } while (--n);
@ -2219,7 +2219,7 @@ static void TownActionFundBuildings(Town *t)
static void TownActionBuyRights(Town *t) static void TownActionBuyRights(Town *t)
{ {
/* Check if it's allowed to by the rights */ /* Check if it's allowed to by the rights */
if (!_patches.exclusive_rights) return; if (!_settings.economy.exclusive_rights) return;
t->exclusive_counter = 12; t->exclusive_counter = 12;
t->exclusivity = _current_player; t->exclusivity = _current_player;
@ -2333,7 +2333,7 @@ static void UpdateTownGrowRate(Town *t)
} }
ClrBit(t->flags12, TOWN_IS_FUNDED); ClrBit(t->flags12, TOWN_IS_FUNDED);
if (_patches.town_growth_rate == 0 && t->fund_buildings_months == 0) return; if (_settings.economy.town_growth_rate == 0 && t->fund_buildings_months == 0) return;
/** Towns are processed every TOWN_GROWTH_FREQUENCY ticks, and this is the /** Towns are processed every TOWN_GROWTH_FREQUENCY ticks, and this is the
* number of times towns are processed before a new building is built. */ * number of times towns are processed before a new building is built. */
@ -2362,7 +2362,7 @@ static void UpdateTownGrowRate(Town *t)
/* Use the normal growth rate values if new buildings have been funded in /* Use the normal growth rate values if new buildings have been funded in
* this town and the growth rate is set to none. */ * this town and the growth rate is set to none. */
uint growth_multiplier = _patches.town_growth_rate != 0 ? _patches.town_growth_rate - 1 : 1; uint growth_multiplier = _settings.economy.town_growth_rate != 0 ? _settings.economy.town_growth_rate - 1 : 1;
m >>= growth_multiplier; m >>= growth_multiplier;
if (t->larger_town) m /= 2; if (t->larger_town) m /= 2;
@ -2405,7 +2405,7 @@ bool CheckIfAuthorityAllows(TileIndex tile)
{ {
if (!IsValidPlayer(_current_player)) return true; if (!IsValidPlayer(_current_player)) return true;
Town *t = ClosestTownFromTile(tile, _patches.dist_local_authority); Town *t = ClosestTownFromTile(tile, _settings.economy.dist_local_authority);
if (t == NULL) return true; if (t == NULL) return true;
if (t->ratings[_current_player] > RATING_VERYPOOR) return true; if (t->ratings[_current_player] > RATING_VERYPOOR) return true;

View File

@ -76,7 +76,7 @@ uint GetMaskOfTownActions(int *nump, PlayerID pid, const Town *t)
TownActions buttons = TACT_NONE; TownActions buttons = TACT_NONE;
/* Spectators and unwanted have no options */ /* Spectators and unwanted have no options */
if (pid != PLAYER_SPECTATOR && !(_patches.bribe && t->unwanted[pid])) { if (pid != PLAYER_SPECTATOR && !(_settings.economy.bribe && t->unwanted[pid])) {
/* Things worth more than this are not shown */ /* Things worth more than this are not shown */
Money avail = GetPlayer(pid)->player_money + _price.station_value * 200; Money avail = GetPlayer(pid)->player_money + _price.station_value * 200;
@ -88,11 +88,11 @@ uint GetMaskOfTownActions(int *nump, PlayerID pid, const Town *t)
const TownActions cur = (TownActions)(1 << i); const TownActions cur = (TownActions)(1 << i);
/* Is the player not able to bribe ? */ /* Is the player not able to bribe ? */
if (cur == TACT_BRIBE && (!_patches.bribe || t->ratings[pid] >= RATING_BRIBE_MAXIMUM)) if (cur == TACT_BRIBE && (!_settings.economy.bribe || t->ratings[pid] >= RATING_BRIBE_MAXIMUM))
continue; continue;
/* Is the player not able to buy exclusive rights ? */ /* Is the player not able to buy exclusive rights ? */
if (cur == TACT_BUY_RIGHTS && !_patches.exclusive_rights) if (cur == TACT_BUY_RIGHTS && !_settings.economy.exclusive_rights)
continue; continue;
/* Is the player not able to build a statue ? */ /* Is the player not able to build a statue ? */
@ -313,7 +313,7 @@ public:
} }
/* Space required for showing noise level information */ /* Space required for showing noise level information */
if (_patches.station_noise_level) { if (_settings.economy.station_noise_level) {
ResizeWindowForWidget(this, TVW_INFOPANEL, 0, 10); ResizeWindowForWidget(this, TVW_INFOPANEL, 0, 10);
} }
@ -343,7 +343,7 @@ public:
this->DrawViewport(); this->DrawViewport();
/* only show the town noise, if the noise option is activated. */ /* only show the town noise, if the noise option is activated. */
if (_patches.station_noise_level) { if (_settings.economy.station_noise_level) {
SetDParam(0, this->town->noise_reached); SetDParam(0, this->town->noise_reached);
SetDParam(1, this->town->MaxTownNoise()); SetDParam(1, this->town->MaxTownNoise());
DrawString(2, 137, STR_NOISE_IN_TOWN, 0); DrawString(2, 137, STR_NOISE_IN_TOWN, 0);
@ -385,7 +385,7 @@ public:
/* Called when setting station noise have changed, in order to resize the window */ /* Called when setting station noise have changed, in order to resize the window */
this->SetDirty(); // refresh display for current size. This will allow to avoid glitches when downgrading this->SetDirty(); // refresh display for current size. This will allow to avoid glitches when downgrading
if (_patches.station_noise_level) { // adjust depending if (_settings.economy.station_noise_level) { // adjust depending
if (this->height == 150) { // window is smaller, needs to be bigger if (this->height == 150) { // window is smaller, needs to be bigger
ResizeWindowForWidget(this, TVW_INFOPANEL, 0, 10); ResizeWindowForWidget(this, TVW_INFOPANEL, 0, 10);
} }

View File

@ -92,7 +92,7 @@ static inline DiagDirection TrainExitDir(Direction direction, TrackBits track)
byte FreightWagonMult(CargoID cargo) byte FreightWagonMult(CargoID cargo)
{ {
if (!GetCargo(cargo)->is_freight) return 1; if (!GetCargo(cargo)->is_freight) return 1;
return _patches.freight_trains; return _settings.vehicle.freight_trains;
} }
@ -278,7 +278,7 @@ void TrainConsistChanged(Vehicle *v)
} }
/* max speed is the minimum of the speed limits of all vehicles in the consist */ /* max speed is the minimum of the speed limits of all vehicles in the consist */
if ((rvi_u->railveh_type != RAILVEH_WAGON || _patches.wagon_speed_limits) && !UsesWagonOverride(u)) { if ((rvi_u->railveh_type != RAILVEH_WAGON || _settings.vehicle.wagon_speed_limits) && !UsesWagonOverride(u)) {
uint16 speed = GetVehicleProperty(u, 0x09, rvi_u->max_speed); uint16 speed = GetVehicleProperty(u, 0x09, rvi_u->max_speed);
if (speed != 0) max_speed = min(speed, max_speed); if (speed != 0) max_speed = min(speed, max_speed);
} }
@ -726,7 +726,7 @@ CommandCost CmdBuildRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32
Vehicle *v = vl[0]; Vehicle *v = vl[0];
UnitID unit_num = HasBit(p2, 0) ? 0 : GetFreeUnitNumber(VEH_TRAIN); UnitID unit_num = HasBit(p2, 0) ? 0 : GetFreeUnitNumber(VEH_TRAIN);
if (unit_num > _patches.max_trains) if (unit_num > _settings.vehicle.max_trains)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME); return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
@ -765,7 +765,7 @@ CommandCost CmdBuildRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32
v->u.rail.railtype = rvi->railtype; v->u.rail.railtype = rvi->railtype;
_new_vehicle_id = v->index; _new_vehicle_id = v->index;
v->service_interval = _patches.servint_trains; v->service_interval = _settings.vehicle.servint_trains;
v->date_of_last_service = _date; v->date_of_last_service = _date;
v->build_year = _cur_year; v->build_year = _cur_year;
v->cur_image = 0xAC2; v->cur_image = 0xAC2;
@ -1001,7 +1001,7 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p
if (HasBit(p2, 0) && src_head == dst_head) return CommandCost(); if (HasBit(p2, 0) && src_head == dst_head) return CommandCost();
{ {
int max_len = _patches.mammoth_trains ? 100 : 10; int max_len = _settings.vehicle.mammoth_trains ? 100 : 10;
/* check if all vehicles in the source train are stopped inside a depot. */ /* check if all vehicles in the source train are stopped inside a depot. */
int src_len = CheckTrainStoppedInDepot(src_head); int src_len = CheckTrainStoppedInDepot(src_head);
@ -1044,7 +1044,7 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p
/* moving a loco to a new line?, then we need to assign a unitnumber. */ /* moving a loco to a new line?, then we need to assign a unitnumber. */
if (dst == NULL && !IsFrontEngine(src) && IsTrainEngine(src)) { if (dst == NULL && !IsFrontEngine(src) && IsTrainEngine(src)) {
UnitID unit_num = GetFreeUnitNumber(VEH_TRAIN); UnitID unit_num = GetFreeUnitNumber(VEH_TRAIN);
if (unit_num > _patches.max_trains) if (unit_num > _settings.vehicle.max_trains)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME); return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
if (flags & DC_EXEC) src->unitnumber = unit_num; if (flags & DC_EXEC) src->unitnumber = unit_num;
@ -1544,7 +1544,7 @@ static inline void SetLastSpeed(Vehicle *v, int spd)
int old = v->u.rail.last_speed; int old = v->u.rail.last_speed;
if (spd != old) { if (spd != old) {
v->u.rail.last_speed = spd; v->u.rail.last_speed = spd;
if (_patches.vehicle_speed || (old == 0) != (spd == 0)) { if (_settings.gui.vehicle_speed || (old == 0) != (spd == 0)) {
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH); InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
} }
} }
@ -1883,7 +1883,7 @@ CommandCost CmdReverseTrainDirection(TileIndex tile, uint32 flags, uint32 p1, ui
if (v->vehstatus & VS_CRASHED || v->breakdown_ctr != 0) return CMD_ERROR; if (v->vehstatus & VS_CRASHED || v->breakdown_ctr != 0) return CMD_ERROR;
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
if (_patches.realistic_acceleration && v->cur_speed != 0) { if (_settings.vehicle.realistic_acceleration && v->cur_speed != 0) {
ToggleBit(v->u.rail.flags, VRF_REVERSING); ToggleBit(v->u.rail.flags, VRF_REVERSING);
} else { } else {
v->cur_speed = 0; v->cur_speed = 0;
@ -2058,7 +2058,7 @@ static TrainFindDepotData FindClosestTrainDepot(Vehicle *v, int max_distance)
return tfdd; return tfdd;
} }
switch (_patches.pathfinder_for_trains) { switch (_settings.pf.pathfinder_for_trains) {
case VPF_YAPF: { /* YAPF */ case VPF_YAPF: { /* YAPF */
bool found = YapfFindNearestRailDepotTwoWay(v, max_distance, NPF_INFINITE_PENALTY, &tfdd.tile, &tfdd.reverse); bool found = YapfFindNearestRailDepotTwoWay(v, max_distance, NPF_INFINITE_PENALTY, &tfdd.tile, &tfdd.reverse);
tfdd.best_length = found ? max_distance / 2 : UINT_MAX; // some fake distance or NOT_FOUND tfdd.best_length = found ? max_distance / 2 : UINT_MAX; // some fake distance or NOT_FOUND
@ -2369,7 +2369,7 @@ static Track ChooseTrainTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir
/* quick return in case only one possible track is available */ /* quick return in case only one possible track is available */
if (KillFirstBit(tracks) == TRACK_BIT_NONE) return FindFirstTrack(tracks); if (KillFirstBit(tracks) == TRACK_BIT_NONE) return FindFirstTrack(tracks);
switch (_patches.pathfinder_for_trains) { switch (_settings.pf.pathfinder_for_trains) {
case VPF_YAPF: { /* YAPF */ case VPF_YAPF: { /* YAPF */
Trackdir trackdir = YapfChooseRailTrack(v, tile, enterdir, tracks, &path_not_found); Trackdir trackdir = YapfChooseRailTrack(v, tile, enterdir, tracks, &path_not_found);
if (trackdir != INVALID_TRACKDIR) { if (trackdir != INVALID_TRACKDIR) {
@ -2446,7 +2446,7 @@ static Track ChooseTrainTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir
/* it is first time the problem occurred, set the "path not found" flag */ /* it is first time the problem occurred, set the "path not found" flag */
SetBit(v->u.rail.flags, VRF_NO_PATH_TO_DESTINATION); SetBit(v->u.rail.flags, VRF_NO_PATH_TO_DESTINATION);
/* and notify user about the event */ /* and notify user about the event */
if (_patches.lost_train_warn && v->owner == _local_player) { if (_settings.gui.lost_train_warn && v->owner == _local_player) {
SetDParam(0, v->unitnumber); SetDParam(0, v->unitnumber);
AddNewsItem( AddNewsItem(
STR_TRAIN_IS_LOST, STR_TRAIN_IS_LOST,
@ -2487,7 +2487,7 @@ static bool CheckReverseTrain(Vehicle *v)
assert(v->u.rail.track); assert(v->u.rail.track);
switch (_patches.pathfinder_for_trains) { switch (_settings.pf.pathfinder_for_trains) {
case VPF_YAPF: /* YAPF */ case VPF_YAPF: /* YAPF */
reverse_best = YapfCheckReverseTrain(v); reverse_best = YapfCheckReverseTrain(v);
break; break;
@ -2607,13 +2607,13 @@ static int UpdateTrainSpeed(Vehicle *v)
uint accel; uint accel;
if (v->vehstatus & VS_STOPPED || HasBit(v->u.rail.flags, VRF_REVERSING)) { if (v->vehstatus & VS_STOPPED || HasBit(v->u.rail.flags, VRF_REVERSING)) {
if (_patches.realistic_acceleration) { if (_settings.vehicle.realistic_acceleration) {
accel = GetTrainAcceleration(v, AM_BRAKE) * 2; accel = GetTrainAcceleration(v, AM_BRAKE) * 2;
} else { } else {
accel = v->acceleration * -2; accel = v->acceleration * -2;
} }
} else { } else {
if (_patches.realistic_acceleration) { if (_settings.vehicle.realistic_acceleration) {
accel = GetTrainAcceleration(v, AM_ACCEL); accel = GetTrainAcceleration(v, AM_ACCEL);
} else { } else {
accel = v->acceleration; accel = v->acceleration;
@ -2754,7 +2754,7 @@ static const RailtypeSlowdownParams _railtype_slowdown[] = {
/** Modify the speed of the vehicle due to a turn */ /** Modify the speed of the vehicle due to a turn */
static inline void AffectSpeedByDirChange(Vehicle *v, Direction new_dir) static inline void AffectSpeedByDirChange(Vehicle *v, Direction new_dir)
{ {
if (_patches.realistic_acceleration) return; if (_settings.vehicle.realistic_acceleration) return;
DirDiff diff = DirDifference(v->direction, new_dir); DirDiff diff = DirDifference(v->direction, new_dir);
if (diff == DIRDIFF_SAME) return; if (diff == DIRDIFF_SAME) return;
@ -2766,7 +2766,7 @@ static inline void AffectSpeedByDirChange(Vehicle *v, Direction new_dir)
/** Modify the speed of the vehicle due to a change in altitude */ /** Modify the speed of the vehicle due to a change in altitude */
static inline void AffectSpeedByZChange(Vehicle *v, byte old_z) static inline void AffectSpeedByZChange(Vehicle *v, byte old_z)
{ {
if (old_z == v->z_pos || _patches.realistic_acceleration) return; if (old_z == v->z_pos || _settings.vehicle.realistic_acceleration) return;
const RailtypeSlowdownParams *rsp = &_railtype_slowdown[v->u.rail.railtype]; const RailtypeSlowdownParams *rsp = &_railtype_slowdown[v->u.rail.railtype];
@ -2971,7 +2971,7 @@ static void TrainController(Vehicle *v, Vehicle *nomove, bool update_image)
TrackBits red_signals = TrackdirBitsToTrackBits(TrackStatusToRedSignals(ts) & reachable_trackdirs); TrackBits red_signals = TrackdirBitsToTrackBits(TrackStatusToRedSignals(ts) & reachable_trackdirs);
TrackBits bits = TrackdirBitsToTrackBits(trackdirbits); TrackBits bits = TrackdirBitsToTrackBits(trackdirbits);
if (_patches.pathfinder_for_trains != VPF_NTP && _patches.forbid_90_deg && prev == NULL) { if (_settings.pf.pathfinder_for_trains != VPF_NTP && _settings.pf.forbid_90_deg && prev == NULL) {
/* We allow wagons to make 90 deg turns, because forbid_90_deg /* We allow wagons to make 90 deg turns, because forbid_90_deg
* can be switched on halfway a turn */ * can be switched on halfway a turn */
bits &= ~TrackCrossesTracks(FindFirstTrack(v->u.rail.track)); bits &= ~TrackCrossesTracks(FindFirstTrack(v->u.rail.track));
@ -2999,12 +2999,12 @@ static void TrainController(Vehicle *v, Vehicle *nomove, bool update_image)
v->cur_speed = 0; v->cur_speed = 0;
v->subspeed = 0; v->subspeed = 0;
v->progress = 255 - 100; v->progress = 255 - 100;
if (++v->load_unload_time_rem < _patches.wait_oneway_signal * 20) return; if (++v->load_unload_time_rem < _settings.pf.wait_oneway_signal * 20) return;
} else if (HasSignalOnTrackdir(gp.new_tile, i)) { } else if (HasSignalOnTrackdir(gp.new_tile, i)) {
v->cur_speed = 0; v->cur_speed = 0;
v->subspeed = 0; v->subspeed = 0;
v->progress = 255 - 10; v->progress = 255 - 10;
if (++v->load_unload_time_rem < _patches.wait_twoway_signal * 73) { if (++v->load_unload_time_rem < _settings.pf.wait_twoway_signal * 73) {
TileIndex o_tile = gp.new_tile + TileOffsByDiagDir(enterdir); TileIndex o_tile = gp.new_tile + TileOffsByDiagDir(enterdir);
Direction rdir = ReverseDir(dir); Direction rdir = ReverseDir(dir);
@ -3406,7 +3406,7 @@ static bool TrainCheckIfLineEnds(Vehicle *v)
/* mask unreachable track bits if we are forbidden to do 90deg turns */ /* mask unreachable track bits if we are forbidden to do 90deg turns */
TrackBits bits = TrackdirBitsToTrackBits(trackdirbits); TrackBits bits = TrackdirBitsToTrackBits(trackdirbits);
if (_patches.pathfinder_for_trains != VPF_NTP && _patches.forbid_90_deg) { if (_settings.pf.pathfinder_for_trains != VPF_NTP && _settings.pf.forbid_90_deg) {
bits &= ~TrackCrossesTracks(FindFirstTrack(v->u.rail.track)); bits &= ~TrackCrossesTracks(FindFirstTrack(v->u.rail.track));
} }
@ -3539,7 +3539,7 @@ static void CheckIfTrainNeedsService(Vehicle *v)
{ {
static const uint MAX_ACCEPTABLE_DEPOT_DIST = 16; static const uint MAX_ACCEPTABLE_DEPOT_DIST = 16;
if (_patches.servint_trains == 0 || !v->NeedsAutomaticServicing()) return; if (_settings.vehicle.servint_trains == 0 || !v->NeedsAutomaticServicing()) return;
if (v->IsInDepot()) { if (v->IsInDepot()) {
VehicleServiceInDepot(v); VehicleServiceInDepot(v);
return; return;
@ -3614,7 +3614,7 @@ void TrainsYearlyLoop()
FOR_ALL_VEHICLES(v) { FOR_ALL_VEHICLES(v) {
if (v->type == VEH_TRAIN && IsFrontEngine(v)) { if (v->type == VEH_TRAIN && IsFrontEngine(v)) {
/* show warning if train is not generating enough income last 2 years (corresponds to a red icon in the vehicle list) */ /* show warning if train is not generating enough income last 2 years (corresponds to a red icon in the vehicle list) */
if (_patches.train_income_warn && v->owner == _local_player && v->age >= 730 && v->GetDisplayProfitThisYear() < 0) { if (_settings.gui.train_income_warn && v->owner == _local_player && v->age >= 730 && v->GetDisplayProfitThisYear() < 0) {
SetDParam(1, v->GetDisplayProfitThisYear()); SetDParam(1, v->GetDisplayProfitThisYear());
SetDParam(0, v->unitnumber); SetDParam(0, v->unitnumber);
AddNewsItem( AddNewsItem(

View File

@ -124,7 +124,7 @@ static void TrainDetailsCargoTab(const Vehicle *v, int x, int y)
SetDParam(0, v->cargo_type); SetDParam(0, v->cargo_type);
SetDParam(1, v->cargo.Count()); SetDParam(1, v->cargo.Count());
SetDParam(2, v->cargo.Source()); SetDParam(2, v->cargo.Source());
SetDParam(3, _patches.freight_trains); SetDParam(3, _settings.vehicle.freight_trains);
str = FreightWagonMult(v->cargo_type) > 1 ? STR_FROM_MULT : STR_8813_FROM; str = FreightWagonMult(v->cargo_type) > 1 ? STR_FROM_MULT : STR_8813_FROM;
} }
DrawString(x, y, str, TC_FROMSTRING); DrawString(x, y, str, TC_FROMSTRING);
@ -150,7 +150,7 @@ static void TrainDetailsCapacityTab(const Vehicle *v, int x, int y)
if (v->cargo_cap != 0) { if (v->cargo_cap != 0) {
SetDParam(0, v->cargo_type); SetDParam(0, v->cargo_type);
SetDParam(1, v->cargo_cap); SetDParam(1, v->cargo_cap);
SetDParam(2, _patches.freight_trains); SetDParam(2, _settings.vehicle.freight_trains);
DrawString(x, y, FreightWagonMult(v->cargo_type) > 1 ? STR_CAPACITY_MULT : STR_013F_CAPACITY, TC_FROMSTRING); DrawString(x, y, FreightWagonMult(v->cargo_type) > 1 ? STR_CAPACITY_MULT : STR_013F_CAPACITY, TC_FROMSTRING);
} }
} }
@ -249,7 +249,7 @@ void DrawTrainDetails(const Vehicle *v, int x, int y, int vscroll_pos, uint16 vs
SetDParam(1, act_cargo[i]); // {CARGO} #2 SetDParam(1, act_cargo[i]); // {CARGO} #2
SetDParam(2, i); // {SHORTCARGO} #1 SetDParam(2, i); // {SHORTCARGO} #1
SetDParam(3, max_cargo[i]); // {SHORTCARGO} #2 SetDParam(3, max_cargo[i]); // {SHORTCARGO} #2
SetDParam(4, _patches.freight_trains); SetDParam(4, _settings.vehicle.freight_trains);
DrawString(x, y + 2, FreightWagonMult(i) > 1 ? STR_TOTAL_CAPACITY_MULT : STR_TOTAL_CAPACITY, TC_FROMSTRING); DrawString(x, y + 2, FreightWagonMult(i) > 1 ? STR_TOTAL_CAPACITY_MULT : STR_TOTAL_CAPACITY, TC_FROMSTRING);
} }
} }

View File

@ -249,7 +249,7 @@ void PlaceTreesRandomly()
if (CanPlantTreesOnTile(tile, true)) { if (CanPlantTreesOnTile(tile, true)) {
PlaceTree(tile, r); PlaceTree(tile, r);
if (_patches.tree_placer != TP_IMPROVED) continue; if (_settings.game_creation.tree_placer != TP_IMPROVED) continue;
/* Place a number of trees based on the tile height. /* Place a number of trees based on the tile height.
* This gives a cool effect of multiple trees close together. * This gives a cool effect of multiple trees close together.
@ -296,11 +296,11 @@ void GenerateTrees()
{ {
uint i, total; uint i, total;
if (_patches.tree_placer == TP_NONE) return; if (_settings.game_creation.tree_placer == TP_NONE) return;
if (_opt.landscape != LT_TOYLAND) PlaceMoreTrees(); if (_opt.landscape != LT_TOYLAND) PlaceMoreTrees();
switch (_patches.tree_placer) { switch (_settings.game_creation.tree_placer) {
case TP_ORIGINAL: i = _opt.landscape == LT_ARCTIC ? 15 : 6; break; case TP_ORIGINAL: i = _opt.landscape == LT_ARCTIC ? 15 : 6; break;
case TP_IMPROVED: i = _opt.landscape == LT_ARCTIC ? 4 : 2; break; case TP_IMPROVED: i = _opt.landscape == LT_ARCTIC ? 4 : 2; break;
default: NOT_REACHED(); return; default: NOT_REACHED(); return;
@ -390,7 +390,7 @@ CommandCost CmdPlantTree(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
} }
if (_game_mode != GM_EDITOR && IsValidPlayer(_current_player)) { if (_game_mode != GM_EDITOR && IsValidPlayer(_current_player)) {
Town *t = ClosestTownFromTile(tile, _patches.dist_local_authority); Town *t = ClosestTownFromTile(tile, _settings.economy.dist_local_authority);
if (t != NULL) ChangeTownRating(t, RATING_TREE_UP_STEP, RATING_TREE_MAXIMUM); if (t != NULL) ChangeTownRating(t, RATING_TREE_UP_STEP, RATING_TREE_MAXIMUM);
} }
@ -533,7 +533,7 @@ static CommandCost ClearTile_Trees(TileIndex tile, byte flags)
uint num; uint num;
if (IsValidPlayer(_current_player)) { if (IsValidPlayer(_current_player)) {
Town *t = ClosestTownFromTile(tile, _patches.dist_local_authority); Town *t = ClosestTownFromTile(tile, _settings.economy.dist_local_authority);
if (t != NULL) ChangeTownRating(t, RATING_TREE_DOWN_STEP, RATING_TREE_MINIMUM); if (t != NULL) ChangeTownRating(t, RATING_TREE_DOWN_STEP, RATING_TREE_MINIMUM);
} }

View File

@ -169,7 +169,7 @@ bool CheckBridge_Stuff(BridgeType bridge_type, uint bridge_len)
if (b->avail_year > _cur_year) return false; if (b->avail_year > _cur_year) return false;
max = b->max_length; max = b->max_length;
if (max >= 16 && _patches.longbridges) max = 100; if (max >= 16 && _settings.construction.longbridges) max = 100;
return b->min_length <= bridge_len && bridge_len <= max; return b->min_length <= bridge_len && bridge_len <= max;
} }
@ -311,7 +311,7 @@ CommandCost CmdBuildBridge(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p
} else { } else {
/* Build a new bridge. */ /* Build a new bridge. */
bool allow_on_slopes = (!_is_old_ai_player && _patches.build_on_slopes); bool allow_on_slopes = (!_is_old_ai_player && _settings.construction.build_on_slopes);
/* Try and clear the start landscape */ /* Try and clear the start landscape */
ret = DoCommand(tile_start, 0, 0, flags, CMD_LANDSCAPE_CLEAR); ret = DoCommand(tile_start, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
@ -576,7 +576,7 @@ static inline bool CheckAllowRemoveTunnelBridge(TileIndex tile)
/* Obviously if the bridge/tunnel belongs to us, or no-one, we can remove it */ /* Obviously if the bridge/tunnel belongs to us, or no-one, we can remove it */
if (CheckTileOwnership(tile) || IsTileOwner(tile, OWNER_NONE)) return true; if (CheckTileOwnership(tile) || IsTileOwner(tile, OWNER_NONE)) return true;
/* Otherwise we can only remove town-owned stuff with extra patch-settings, or cheat */ /* Otherwise we can only remove town-owned stuff with extra patch-settings, or cheat */
if (IsTileOwner(tile, OWNER_TOWN) && (_patches.extra_dynamite || _cheats.magic_bulldozer.value)) return true; if (IsTileOwner(tile, OWNER_TOWN) && (_settings.construction.extra_dynamite || _cheats.magic_bulldozer.value)) return true;
return false; return false;
} }
@ -1123,7 +1123,7 @@ void DrawBridgeMiddle(const TileInfo* ti)
DrawGroundSpriteAt(image, pal, x, y, z); DrawGroundSpriteAt(image, pal, x, y, z);
} }
} else if (_patches.bridge_pillars) { } else if (_settings.gui.bridge_pillars) {
/* draw pillars below for high bridges */ /* draw pillars below for high bridges */
DrawBridgePillars(psid, ti, axis, type, x, y, z); DrawBridgePillars(psid, ti, axis, type, x, y, z);
} }
@ -1388,7 +1388,7 @@ static VehicleEnterTileStatus VehicleEnter_TunnelBridge(Vehicle *v, TileIndex ti
static CommandCost TerraformTile_TunnelBridge(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new) static CommandCost TerraformTile_TunnelBridge(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
{ {
if (_patches.build_on_slopes && AutoslopeEnabled() && IsBridge(tile)) { if (_settings.construction.build_on_slopes && AutoslopeEnabled() && IsBridge(tile)) {
DiagDirection direction = GetTunnelBridgeDirection(tile); DiagDirection direction = GetTunnelBridgeDirection(tile);
Axis axis = DiagDirToAxis(direction); Axis axis = DiagDirToAxis(direction);
CommandCost res; CommandCost res;

View File

@ -127,20 +127,20 @@ bool Vehicle::NeedsServicing() const
{ {
if (this->vehstatus & (VS_STOPPED | VS_CRASHED)) return false; if (this->vehstatus & (VS_STOPPED | VS_CRASHED)) return false;
if (_patches.no_servicing_if_no_breakdowns && _opt.diff.vehicle_breakdowns == 0) { if (_settings.order.no_servicing_if_no_breakdowns && _opt.diff.vehicle_breakdowns == 0) {
/* Vehicles set for autoreplacing needs to go to a depot even if breakdowns are turned off. /* Vehicles set for autoreplacing needs to go to a depot even if breakdowns are turned off.
* Note: If servicing is enabled, we postpone replacement till next service. */ * Note: If servicing is enabled, we postpone replacement till next service. */
return EngineHasReplacementForPlayer(GetPlayer(this->owner), this->engine_type, this->group_id); return EngineHasReplacementForPlayer(GetPlayer(this->owner), this->engine_type, this->group_id);
} }
return _patches.servint_ispercent ? return _settings.vehicle.servint_ispercent ?
(this->reliability < GetEngine(this->engine_type)->reliability * (100 - this->service_interval) / 100) : (this->reliability < GetEngine(this->engine_type)->reliability * (100 - this->service_interval) / 100) :
(this->date_of_last_service + this->service_interval < _date); (this->date_of_last_service + this->service_interval < _date);
} }
bool Vehicle::NeedsAutomaticServicing() const bool Vehicle::NeedsAutomaticServicing() const
{ {
if (_patches.gotodepot && VehicleHasDepotOrders(this)) return false; if (_settings.order.gotodepot && VehicleHasDepotOrders(this)) return false;
if (this->current_order.IsType(OT_LOADING)) return false; if (this->current_order.IsType(OT_LOADING)) return false;
if (this->current_order.IsType(OT_GOTO_DEPOT) && this->current_order.GetDepotOrderType() != ODTFB_SERVICE) return false; if (this->current_order.IsType(OT_GOTO_DEPOT) && this->current_order.GetDepotOrderType() != ODTFB_SERVICE) return false;
return NeedsServicing(); return NeedsServicing();
@ -1855,10 +1855,10 @@ UnitID GetFreeUnitNumber(VehicleType type)
static UnitID gmax = 0; static UnitID gmax = 0;
switch (type) { switch (type) {
case VEH_TRAIN: max = _patches.max_trains; break; case VEH_TRAIN: max = _settings.vehicle.max_trains; break;
case VEH_ROAD: max = _patches.max_roadveh; break; case VEH_ROAD: max = _settings.vehicle.max_roadveh; break;
case VEH_SHIP: max = _patches.max_ships; break; case VEH_SHIP: max = _settings.vehicle.max_ships; break;
case VEH_AIRCRAFT: max = _patches.max_aircraft; break; case VEH_AIRCRAFT: max = _settings.vehicle.max_aircraft; break;
default: NOT_REACHED(); default: NOT_REACHED();
} }
@ -1908,14 +1908,14 @@ bool CanBuildVehicleInfrastructure(VehicleType type)
assert(IsPlayerBuildableVehicleType(type)); assert(IsPlayerBuildableVehicleType(type));
if (!IsValidPlayer(_current_player)) return false; if (!IsValidPlayer(_current_player)) return false;
if (_patches.always_build_infrastructure) return true; if (_settings.gui.always_build_infrastructure) return true;
UnitID max; UnitID max;
switch (type) { switch (type) {
case VEH_TRAIN: max = _patches.max_trains; break; case VEH_TRAIN: max = _settings.vehicle.max_trains; break;
case VEH_ROAD: max = _patches.max_roadveh; break; case VEH_ROAD: max = _settings.vehicle.max_roadveh; break;
case VEH_SHIP: max = _patches.max_ships; break; case VEH_SHIP: max = _settings.vehicle.max_ships; break;
case VEH_AIRCRAFT: max = _patches.max_aircraft; break; case VEH_AIRCRAFT: max = _settings.vehicle.max_aircraft; break;
default: NOT_REACHED(); default: NOT_REACHED();
} }
@ -1947,7 +1947,7 @@ const Livery *GetEngineLivery(EngineID engine_type, PlayerID player, EngineID pa
/* The default livery is always available for use, but its in_use flag determines /* The default livery is always available for use, but its in_use flag determines
* whether any _other_ liveries are in use. */ * whether any _other_ liveries are in use. */
if (p->livery[LS_DEFAULT].in_use && (_patches.liveries == 2 || (_patches.liveries == 1 && player == _local_player))) { if (p->livery[LS_DEFAULT].in_use && (_settings.gui.liveries == 2 || (_settings.gui.liveries == 1 && player == _local_player))) {
/* Determine the livery scheme to use */ /* Determine the livery scheme to use */
switch (GetEngine(engine_type)->type) { switch (GetEngine(engine_type)->type) {
default: NOT_REACHED(); default: NOT_REACHED();
@ -2514,7 +2514,7 @@ void Vehicle::HandleLoading(bool mode)
/* Not the first call for this tick, or still loading */ /* Not the first call for this tick, or still loading */
if (mode || !HasBit(this->vehicle_flags, VF_LOADING_FINISHED) || if (mode || !HasBit(this->vehicle_flags, VF_LOADING_FINISHED) ||
(_patches.timetabling && this->current_order_time < wait_time)) return; (_settings.order.timetabling && this->current_order_time < wait_time)) return;
this->PlayLeaveStationSound(); this->PlayLeaveStationSound();

View File

@ -1220,12 +1220,12 @@ static void ShowVehicleListWindowLocal(PlayerID player, uint16 VLW_flag, Vehicle
void ShowVehicleListWindow(PlayerID player, VehicleType vehicle_type) void ShowVehicleListWindow(PlayerID player, VehicleType vehicle_type)
{ {
/* If _patches.advanced_vehicle_list > 1, display the Advanced list /* If _settings.gui.advanced_vehicle_list > 1, display the Advanced list
* if _patches.advanced_vehicle_list == 1, display Advanced list only for local player * if _settings.gui.advanced_vehicle_list == 1, display Advanced list only for local player
* if _ctrl_pressed, do the opposite action (Advanced list x Normal list) * if _ctrl_pressed, do the opposite action (Advanced list x Normal list)
*/ */
if ((_patches.advanced_vehicle_list > (uint)(player != _local_player)) != _ctrl_pressed) { if ((_settings.gui.advanced_vehicle_list > (uint)(player != _local_player)) != _ctrl_pressed) {
ShowPlayerGroup(player, vehicle_type); ShowPlayerGroup(player, vehicle_type);
} else { } else {
ShowVehicleListWindowLocal(player, VLW_STANDARD, vehicle_type, 0); ShowVehicleListWindowLocal(player, VLW_STANDARD, vehicle_type, 0);
@ -1411,10 +1411,10 @@ struct VehicleDetailsWindow : Window {
{ {
switch (vehicle_type) { switch (vehicle_type) {
default: NOT_REACHED(); default: NOT_REACHED();
case VEH_TRAIN: return _patches.servint_trains != 0; break; case VEH_TRAIN: return _settings.vehicle.servint_trains != 0; break;
case VEH_ROAD: return _patches.servint_roadveh != 0; break; case VEH_ROAD: return _settings.vehicle.servint_roadveh != 0; break;
case VEH_SHIP: return _patches.servint_ships != 0; break; case VEH_SHIP: return _settings.vehicle.servint_ships != 0; break;
case VEH_AIRCRAFT: return _patches.servint_aircraft != 0; break; case VEH_AIRCRAFT: return _settings.vehicle.servint_aircraft != 0; break;
} }
return false; // kill a compiler warning return false; // kill a compiler warning
} }
@ -1486,7 +1486,7 @@ struct VehicleDetailsWindow : Window {
SetDParam(1, v->u.rail.cached_power); SetDParam(1, v->u.rail.cached_power);
SetDParam(0, v->u.rail.cached_weight); SetDParam(0, v->u.rail.cached_weight);
SetDParam(3, v->u.rail.cached_max_te / 1000); SetDParam(3, v->u.rail.cached_max_te / 1000);
DrawString(2, 25, (_patches.realistic_acceleration && v->u.rail.railtype != RAILTYPE_MAGLEV) ? DrawString(2, 25, (_settings.vehicle.realistic_acceleration && v->u.rail.railtype != RAILTYPE_MAGLEV) ?
STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE : STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE :
STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED, TC_FROMSTRING); STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED, TC_FROMSTRING);
break; break;
@ -1514,7 +1514,7 @@ struct VehicleDetailsWindow : Window {
/* Draw service interval text */ /* Draw service interval text */
SetDParam(0, v->service_interval); SetDParam(0, v->service_interval);
SetDParam(1, v->date_of_last_service); SetDParam(1, v->date_of_last_service);
DrawString(13, this->height - (v->type != VEH_TRAIN ? 11 : 23), _patches.servint_ispercent ? STR_SERVICING_INTERVAL_PERCENT : STR_883C_SERVICING_INTERVAL_DAYS, TC_FROMSTRING); DrawString(13, this->height - (v->type != VEH_TRAIN ? 11 : 23), _settings.vehicle.servint_ispercent ? STR_SERVICING_INTERVAL_PERCENT : STR_883C_SERVICING_INTERVAL_DAYS, TC_FROMSTRING);
switch (v->type) { switch (v->type) {
case VEH_TRAIN: case VEH_TRAIN:
@ -1953,7 +1953,7 @@ struct VehicleViewWindow : Window {
} }
} else { } else {
SetDParam(0, v->GetDisplaySpeed()); SetDParam(0, v->GetDisplaySpeed());
str = STR_TRAIN_STOPPING + _patches.vehicle_speed; str = STR_TRAIN_STOPPING + _settings.gui.vehicle_speed;
} }
} else { // no train } else { // no train
str = STR_8861_STOPPED; str = STR_8861_STOPPED;
@ -1963,7 +1963,7 @@ struct VehicleViewWindow : Window {
case OT_GOTO_STATION: { case OT_GOTO_STATION: {
SetDParam(0, v->current_order.GetDestination()); SetDParam(0, v->current_order.GetDestination());
SetDParam(1, v->GetDisplaySpeed()); SetDParam(1, v->GetDisplaySpeed());
str = STR_HEADING_FOR_STATION + _patches.vehicle_speed; str = STR_HEADING_FOR_STATION + _settings.gui.vehicle_speed;
} break; } break;
case OT_GOTO_DEPOT: { case OT_GOTO_DEPOT: {
@ -1977,9 +1977,9 @@ struct VehicleViewWindow : Window {
SetDParam(1, v->GetDisplaySpeed()); SetDParam(1, v->GetDisplaySpeed());
} }
if ((v->current_order.GetDepotActionType() & ODATFB_HALT) && !(v->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS)) { if ((v->current_order.GetDepotActionType() & ODATFB_HALT) && !(v->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS)) {
str = _heading_for_depot_strings[v->type] + _patches.vehicle_speed; str = _heading_for_depot_strings[v->type] + _settings.gui.vehicle_speed;
} else { } else {
str = _heading_for_depot_service_strings[v->type] + _patches.vehicle_speed; str = _heading_for_depot_service_strings[v->type] + _settings.gui.vehicle_speed;
} }
} break; } break;
@ -1990,7 +1990,7 @@ struct VehicleViewWindow : Window {
case OT_GOTO_WAYPOINT: { case OT_GOTO_WAYPOINT: {
assert(v->type == VEH_TRAIN); assert(v->type == VEH_TRAIN);
SetDParam(0, v->current_order.GetDestination()); SetDParam(0, v->current_order.GetDestination());
str = STR_HEADING_FOR_WAYPOINT + _patches.vehicle_speed; str = STR_HEADING_FOR_WAYPOINT + _settings.gui.vehicle_speed;
SetDParam(1, v->GetDisplaySpeed()); SetDParam(1, v->GetDisplaySpeed());
break; break;
} }
@ -2004,7 +2004,7 @@ struct VehicleViewWindow : Window {
default: default:
if (v->num_orders == 0) { if (v->num_orders == 0) {
str = STR_NO_ORDERS + _patches.vehicle_speed; str = STR_NO_ORDERS + _settings.gui.vehicle_speed;
SetDParam(0, v->GetDisplaySpeed()); SetDParam(0, v->GetDisplaySpeed());
} else { } else {
str = STR_EMPTY; str = STR_EMPTY;

View File

@ -288,9 +288,9 @@ static uint32 QZ_MapKey(unsigned short sym)
} }
if (_current_mods & NSShiftKeyMask) key |= WKC_SHIFT; if (_current_mods & NSShiftKeyMask) key |= WKC_SHIFT;
if (_current_mods & NSControlKeyMask) key |= (_patches.right_mouse_btn_emulation != RMBE_CONTROL ? WKC_CTRL : WKC_META); if (_current_mods & NSControlKeyMask) key |= (_settings.gui.right_mouse_btn_emulation != RMBE_CONTROL ? WKC_CTRL : WKC_META);
if (_current_mods & NSAlternateKeyMask) key |= WKC_ALT; if (_current_mods & NSAlternateKeyMask) key |= WKC_ALT;
if (_current_mods & NSCommandKeyMask) key |= (_patches.right_mouse_btn_emulation != RMBE_CONTROL ? WKC_META : WKC_CTRL); if (_current_mods & NSCommandKeyMask) key |= (_settings.gui.right_mouse_btn_emulation != RMBE_CONTROL ? WKC_META : WKC_CTRL);
return key << 16; return key << 16;
} }
@ -459,8 +459,8 @@ static bool QZ_PollEvent()
case NSLeftMouseDown: case NSLeftMouseDown:
{ {
uint32 keymask = 0; uint32 keymask = 0;
if (_patches.right_mouse_btn_emulation == RMBE_COMMAND) keymask |= NSCommandKeyMask; if (_settings.gui.right_mouse_btn_emulation == RMBE_COMMAND) keymask |= NSCommandKeyMask;
if (_patches.right_mouse_btn_emulation == RMBE_CONTROL) keymask |= NSControlKeyMask; if (_settings.gui.right_mouse_btn_emulation == RMBE_CONTROL) keymask |= NSControlKeyMask;
pt = _cocoa_subdriver->GetMouseLocation(event); pt = _cocoa_subdriver->GetMouseLocation(event);
@ -602,8 +602,8 @@ static bool QZ_PollEvent()
} /* else: deltaY was 0.0 and we don't want to do anything */ } /* else: deltaY was 0.0 and we don't want to do anything */
/* Set the scroll count for scrollwheel scrolling */ /* Set the scroll count for scrollwheel scrolling */
_cursor.h_wheel -= (int)([ event deltaX ]* 5 * _patches.scrollwheel_multiplier); _cursor.h_wheel -= (int)([ event deltaX ]* 5 * _settings.gui.scrollwheel_multiplier);
_cursor.v_wheel -= (int)([ event deltaY ]* 5 * _patches.scrollwheel_multiplier); _cursor.v_wheel -= (int)([ event deltaY ]* 5 * _settings.gui.scrollwheel_multiplier);
break; break;
default: default:
@ -671,7 +671,7 @@ void QZ_GameLoop()
bool old_ctrl_pressed = _ctrl_pressed; bool old_ctrl_pressed = _ctrl_pressed;
_ctrl_pressed = !!(_current_mods & ( _patches.right_mouse_btn_emulation != RMBE_CONTROL ? NSControlKeyMask : NSCommandKeyMask)); _ctrl_pressed = !!(_current_mods & ( _settings.gui.right_mouse_btn_emulation != RMBE_CONTROL ? NSControlKeyMask : NSCommandKeyMask));
_shift_pressed = !!(_current_mods & NSShiftKeyMask); _shift_pressed = !!(_current_mods & NSShiftKeyMask);
if (old_ctrl_pressed != _ctrl_pressed) HandleCtrlChanged(); if (old_ctrl_pressed != _ctrl_pressed) HandleCtrlChanged();

View File

@ -1020,7 +1020,7 @@ static void ViewportAddTownNames(DrawPixelInfo *dpi)
right > t->sign.left && right > t->sign.left &&
left < t->sign.left + t->sign.width_1) { left < t->sign.left + t->sign.width_1) {
AddStringToDraw(t->sign.left + 1, t->sign.top + 1, AddStringToDraw(t->sign.left + 1, t->sign.top + 1,
_patches.population_in_label ? STR_TOWN_LABEL_POP : STR_TOWN_LABEL, _settings.gui.population_in_label ? STR_TOWN_LABEL_POP : STR_TOWN_LABEL,
t->index, t->population); t->index, t->population);
} }
} }
@ -1036,7 +1036,7 @@ static void ViewportAddTownNames(DrawPixelInfo *dpi)
right > t->sign.left && right > t->sign.left &&
left < t->sign.left + t->sign.width_1 * 2) { left < t->sign.left + t->sign.width_1 * 2) {
AddStringToDraw(t->sign.left + 1, t->sign.top + 1, AddStringToDraw(t->sign.left + 1, t->sign.top + 1,
_patches.population_in_label ? STR_TOWN_LABEL_POP : STR_TOWN_LABEL, _settings.gui.population_in_label ? STR_TOWN_LABEL_POP : STR_TOWN_LABEL,
t->index, t->population); t->index, t->population);
} }
} }
@ -1591,7 +1591,7 @@ void UpdateViewportPosition(Window *w)
int delta_y = w->viewport->dest_scrollpos_y - w->viewport->scrollpos_y; int delta_y = w->viewport->dest_scrollpos_y - w->viewport->scrollpos_y;
if (delta_x != 0 || delta_y != 0) { if (delta_x != 0 || delta_y != 0) {
if (_patches.smooth_scroll) { if (_settings.gui.smooth_scroll) {
int max_scroll = ScaleByMapSize1D(512); int max_scroll = ScaleByMapSize1D(512);
/* Not at our desired positon yet... */ /* Not at our desired positon yet... */
w->viewport->scrollpos_x += Clamp(delta_x / 4, -max_scroll, max_scroll); w->viewport->scrollpos_x += Clamp(delta_x / 4, -max_scroll, max_scroll);
@ -2510,7 +2510,7 @@ static void CalcRaildirsDrawstyle(TileHighlightData *thd, int x, int y, int meth
} }
} }
if (_patches.measure_tooltip) { if (_settings.gui.measure_tooltip) {
TileIndex t0 = TileVirtXY(thd->selstart.x, thd->selstart.y); TileIndex t0 = TileVirtXY(thd->selstart.x, thd->selstart.y);
TileIndex t1 = TileVirtXY(x, y); TileIndex t1 = TileVirtXY(x, y);
uint distance = DistanceManhattan(t0, t1) + 1; uint distance = DistanceManhattan(t0, t1) + 1;
@ -2590,7 +2590,7 @@ void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method)
style = HT_DIR_X; style = HT_DIR_X;
calc_heightdiff_single_direction:; calc_heightdiff_single_direction:;
if (_patches.measure_tooltip) { if (_settings.gui.measure_tooltip) {
TileIndex t0 = TileVirtXY(sx, sy); TileIndex t0 = TileVirtXY(sx, sy);
TileIndex t1 = TileVirtXY(x, y); TileIndex t1 = TileVirtXY(x, y);
uint distance = DistanceManhattan(t0, t1) + 1; uint distance = DistanceManhattan(t0, t1) + 1;
@ -2618,7 +2618,7 @@ calc_heightdiff_single_direction:;
y = sy + Clamp(y - sy, -limit, limit); y = sy + Clamp(y - sy, -limit, limit);
} /* Fallthrough */ } /* Fallthrough */
case VPM_X_AND_Y: { /* drag an X by Y area */ case VPM_X_AND_Y: { /* drag an X by Y area */
if (_patches.measure_tooltip) { if (_settings.gui.measure_tooltip) {
static const StringID measure_strings_area[] = { static const StringID measure_strings_area[] = {
STR_NULL, STR_NULL, STR_MEASURE_AREA, STR_MEASURE_AREA_HEIGHTDIFF STR_NULL, STR_NULL, STR_MEASURE_AREA, STR_MEASURE_AREA_HEIGHTDIFF
}; };

View File

@ -771,7 +771,7 @@ static Vehicle *FindFloodableVehicleOnTile(TileIndex tile)
} }
/* if non-uniform stations are disabled, flood some train in this train station (if there is any) */ /* if non-uniform stations are disabled, flood some train in this train station (if there is any) */
if (!_patches.nonuniform_stations && IsTileType(tile, MP_STATION) && GetStationType(tile) == STATION_RAIL) { if (!_settings.station.nonuniform_stations && IsTileType(tile, MP_STATION) && GetStationType(tile) == STATION_RAIL) {
const Station *st = GetStationByTile(tile); const Station *st = GetStationByTile(tile);
BEGIN_TILE_LOOP(t, st->trainst_w, st->trainst_h, st->train_tile) BEGIN_TILE_LOOP(t, st->trainst_w, st->trainst_h, st->train_tile)

View File

@ -210,7 +210,7 @@ CommandCost CmdBuildTrainWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint3
tileh = GetTileSlope(tile, NULL); tileh = GetTileSlope(tile, NULL);
if (tileh != SLOPE_FLAT && if (tileh != SLOPE_FLAT &&
(!_patches.build_on_slopes || IsSteepSlope(tileh) || !(tileh & (0x3 << axis)) || !(tileh & ~(0x3 << axis)))) { (!_settings.construction.build_on_slopes || IsSteepSlope(tileh) || !(tileh & (0x3 << axis)) || !(tileh & ~(0x3 << axis)))) {
return_cmd_error(STR_0007_FLAT_LAND_REQUIRED); return_cmd_error(STR_0007_FLAT_LAND_REQUIRED);
} }

View File

@ -1217,11 +1217,11 @@ static bool HandleWindowDragging()
int nx = x; int nx = x;
int ny = y; int ny = y;
if (_patches.window_snap_radius != 0) { if (_settings.gui.window_snap_radius != 0) {
Window* const *vz; Window* const *vz;
int hsnap = _patches.window_snap_radius; int hsnap = _settings.gui.window_snap_radius;
int vsnap = _patches.window_snap_radius; int vsnap = _settings.gui.window_snap_radius;
int delta; int delta;
FOR_ALL_WINDOWS(vz) { FOR_ALL_WINDOWS(vz) {
@ -1467,7 +1467,7 @@ static bool HandleScrollbarScrolling()
static bool HandleViewportScroll() static bool HandleViewportScroll()
{ {
bool scrollwheel_scrolling = _patches.scrollwheel_scrolling == 1 && (_cursor.v_wheel != 0 || _cursor.h_wheel != 0); bool scrollwheel_scrolling = _settings.gui.scrollwheel_scrolling == 1 && (_cursor.v_wheel != 0 || _cursor.h_wheel != 0);
if (!_scrolling_viewport) return true; if (!_scrolling_viewport) return true;
@ -1487,7 +1487,7 @@ static bool HandleViewportScroll()
} }
Point delta; Point delta;
if (_patches.reverse_scroll) { if (_settings.gui.reverse_scroll) {
delta.x = -_cursor.delta.x; delta.x = -_cursor.delta.x;
delta.y = -_cursor.delta.y; delta.y = -_cursor.delta.y;
} else { } else {
@ -1667,7 +1667,7 @@ static void HandleAutoscroll()
return; return;
} }
if (_patches.autoscroll && _game_mode != GM_MENU && !IsGeneratingWorld()) { if (_settings.gui.autoscroll && _game_mode != GM_MENU && !IsGeneratingWorld()) {
int x = _cursor.pos.x; int x = _cursor.pos.x;
int y = _cursor.pos.y; int y = _cursor.pos.y;
Window *w = FindWindowFromPt(x, y); Window *w = FindWindowFromPt(x, y);
@ -1719,7 +1719,7 @@ void MouseLoop(MouseClick click, int mousewheel)
if (!HandleViewportScroll()) return; if (!HandleViewportScroll()) return;
if (!HandleMouseOver()) return; if (!HandleMouseOver()) return;
bool scrollwheel_scrolling = _patches.scrollwheel_scrolling == 1 && (_cursor.v_wheel != 0 || _cursor.h_wheel != 0); bool scrollwheel_scrolling = _settings.gui.scrollwheel_scrolling == 1 && (_cursor.v_wheel != 0 || _cursor.h_wheel != 0);
if (click == MC_NONE && mousewheel == 0 && !scrollwheel_scrolling) return; if (click == MC_NONE && mousewheel == 0 && !scrollwheel_scrolling) return;
int x = _cursor.pos.x; int x = _cursor.pos.x;
@ -1734,7 +1734,7 @@ void MouseLoop(MouseClick click, int mousewheel)
if (vp != NULL && (_game_mode == GM_MENU || IsGeneratingWorld())) return; if (vp != NULL && (_game_mode == GM_MENU || IsGeneratingWorld())) return;
if (mousewheel != 0) { if (mousewheel != 0) {
if (_patches.scrollwheel_scrolling == 0) { if (_settings.gui.scrollwheel_scrolling == 0) {
/* Send mousewheel event to window */ /* Send mousewheel event to window */
w->OnMouseWheel(mousewheel); w->OnMouseWheel(mousewheel);
} }
@ -2059,7 +2059,7 @@ int PositionMainToolbar(Window *w)
w = FindWindowById(WC_MAIN_TOOLBAR, 0); w = FindWindowById(WC_MAIN_TOOLBAR, 0);
} }
switch (_patches.toolbar_pos) { switch (_settings.gui.toolbar_pos) {
case 1: w->left = (_screen.width - w->width) / 2; break; case 1: w->left = (_screen.width - w->width) / 2; break;
case 2: w->left = _screen.width - w->width; break; case 2: w->left = _screen.width - w->width; break;
default: w->left = 0; default: w->left = 0;

View File

@ -6,6 +6,7 @@
#define YAPF_BASE_HPP #define YAPF_BASE_HPP
#include "../debug.h" #include "../debug.h"
#include "../settings_type.h"
extern int _total_pf_time_us; extern int _total_pf_time_us;
@ -52,7 +53,7 @@ public:
protected: protected:
Node* m_pBestDestNode; ///< pointer to the destination node found at last round Node* m_pBestDestNode; ///< pointer to the destination node found at last round
Node* m_pBestIntermediateNode; ///< here should be node closest to the destination if path not found Node* m_pBestIntermediateNode; ///< here should be node closest to the destination if path not found
const YapfSettings *m_settings; ///< current settings (_patches.yapf) const YAPFSettings *m_settings; ///< current settings (_settings.yapf)
int m_max_search_nodes; ///< maximum number of nodes we are allowed to visit before we give up int m_max_search_nodes; ///< maximum number of nodes we are allowed to visit before we give up
const Vehicle* m_veh; ///< vehicle that we are trying to drive const Vehicle* m_veh; ///< vehicle that we are trying to drive
@ -73,7 +74,7 @@ public:
FORCEINLINE CYapfBaseT() FORCEINLINE CYapfBaseT()
: m_pBestDestNode(NULL) : m_pBestDestNode(NULL)
, m_pBestIntermediateNode(NULL) , m_pBestIntermediateNode(NULL)
, m_settings(&_patches.yapf) , m_settings(&_settings.pf.yapf)
, m_max_search_nodes(PfGetSettings().max_search_nodes) , m_max_search_nodes(PfGetSettings().max_search_nodes)
, m_veh(NULL) , m_veh(NULL)
, m_stats_cost_calcs(0) , m_stats_cost_calcs(0)
@ -91,7 +92,7 @@ protected:
public: public:
/// return current settings (can be custom - player based - but later) /// return current settings (can be custom - player based - but later)
FORCEINLINE const YapfSettings& PfGetSettings() const FORCEINLINE const YAPFSettings& PfGetSettings() const
{ {
return *m_settings; return *m_settings;
} }

View File

@ -254,7 +254,7 @@ Trackdir YapfChooseRailTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir,
PfnChooseRailTrack pfnChooseRailTrack = &CYapfRail1::stChooseRailTrack; PfnChooseRailTrack pfnChooseRailTrack = &CYapfRail1::stChooseRailTrack;
// check if non-default YAPF type needed // check if non-default YAPF type needed
if (_patches.forbid_90_deg) { if (_settings.pf.forbid_90_deg) {
pfnChooseRailTrack = &CYapfRail2::stChooseRailTrack; // Trackdir, forbid 90-deg pfnChooseRailTrack = &CYapfRail2::stChooseRailTrack; // Trackdir, forbid 90-deg
} }
@ -311,7 +311,7 @@ bool YapfCheckReverseTrain(Vehicle* v)
PfnCheckReverseTrain pfnCheckReverseTrain = CYapfRail1::stCheckReverseTrain; PfnCheckReverseTrain pfnCheckReverseTrain = CYapfRail1::stCheckReverseTrain;
// check if non-default YAPF type needed // check if non-default YAPF type needed
if (_patches.forbid_90_deg) { if (_settings.pf.forbid_90_deg) {
pfnCheckReverseTrain = &CYapfRail2::stCheckReverseTrain; // Trackdir, forbid 90-deg pfnCheckReverseTrain = &CYapfRail2::stCheckReverseTrain; // Trackdir, forbid 90-deg
} }
@ -341,7 +341,7 @@ bool YapfFindNearestRailDepotTwoWay(Vehicle *v, int max_distance, int reverse_pe
PfnFindNearestDepotTwoWay pfnFindNearestDepotTwoWay = &CYapfAnyDepotRail1::stFindNearestDepotTwoWay; PfnFindNearestDepotTwoWay pfnFindNearestDepotTwoWay = &CYapfAnyDepotRail1::stFindNearestDepotTwoWay;
// check if non-default YAPF type needed // check if non-default YAPF type needed
if (_patches.forbid_90_deg) { if (_settings.pf.forbid_90_deg) {
pfnFindNearestDepotTwoWay = &CYapfAnyDepotRail2::stFindNearestDepotTwoWay; // Trackdir, forbid 90-deg pfnFindNearestDepotTwoWay = &CYapfAnyDepotRail2::stFindNearestDepotTwoWay; // Trackdir, forbid 90-deg
} }

View File

@ -407,7 +407,7 @@ Trackdir YapfChooseRoadTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir)
PfnChooseRoadTrack pfnChooseRoadTrack = &CYapfRoad2::stChooseRoadTrack; // default: ExitDir, allow 90-deg PfnChooseRoadTrack pfnChooseRoadTrack = &CYapfRoad2::stChooseRoadTrack; // default: ExitDir, allow 90-deg
// check if non-default YAPF type should be used // check if non-default YAPF type should be used
if (_patches.yapf.disable_node_optimization) if (_settings.pf.yapf.disable_node_optimization)
pfnChooseRoadTrack = &CYapfRoad1::stChooseRoadTrack; // Trackdir, allow 90-deg pfnChooseRoadTrack = &CYapfRoad1::stChooseRoadTrack; // Trackdir, allow 90-deg
Trackdir td_ret = pfnChooseRoadTrack(v, tile, enterdir); Trackdir td_ret = pfnChooseRoadTrack(v, tile, enterdir);
@ -421,7 +421,7 @@ uint YapfRoadVehDistanceToTile(const Vehicle* v, TileIndex tile)
PfnDistanceToTile pfnDistanceToTile = &CYapfRoad2::stDistanceToTile; // default: ExitDir, allow 90-deg PfnDistanceToTile pfnDistanceToTile = &CYapfRoad2::stDistanceToTile; // default: ExitDir, allow 90-deg
// check if non-default YAPF type should be used // check if non-default YAPF type should be used
if (_patches.yapf.disable_node_optimization) if (_settings.pf.yapf.disable_node_optimization)
pfnDistanceToTile = &CYapfRoad1::stDistanceToTile; // Trackdir, allow 90-deg pfnDistanceToTile = &CYapfRoad1::stDistanceToTile; // Trackdir, allow 90-deg
// measure distance in YAPF units // measure distance in YAPF units
@ -450,7 +450,7 @@ Depot* YapfFindNearestRoadDepot(const Vehicle *v)
PfnFindNearestDepot pfnFindNearestDepot = &CYapfRoadAnyDepot2::stFindNearestDepot; PfnFindNearestDepot pfnFindNearestDepot = &CYapfRoadAnyDepot2::stFindNearestDepot;
// check if non-default YAPF type should be used // check if non-default YAPF type should be used
if (_patches.yapf.disable_node_optimization) if (_settings.pf.yapf.disable_node_optimization)
pfnFindNearestDepot = &CYapfRoadAnyDepot1::stFindNearestDepot; // Trackdir, allow 90-deg pfnFindNearestDepot = &CYapfRoadAnyDepot1::stFindNearestDepot; // Trackdir, allow 90-deg
Depot* ret = pfnFindNearestDepot(v, tile, trackdir); Depot* ret = pfnFindNearestDepot(v, tile, trackdir);

View File

@ -1,72 +0,0 @@
/* $Id$ */
/** @file yapf_settings.h Penalty settings for YAPF. */
#if !defined(YAPF_SETTINGS_H) || defined(YS_DEF)
# ifndef YAPF_SETTINGS_H
# define YAPF_SETTINGS_H
# endif
# ifndef YS_DEF
/*
* if YS_DEF is not defined, we will only do following declaration:
* struct YapfSettings {
* bool disable_node_optimization;
* uint32 max_search_nodes;
* .... all other yapf related settings ...
* };
*
* otherwise we will just expand YS_DEF_xx macros and then #undef them
*/
# define YS_DEF_BEGIN struct YapfSettings {
# define YS_DEF(type, name) type name;
# define YS_DEF_END };
# endif /* !YS_DEF */
# ifndef YS_DEF_BEGIN
# define YS_DEF_BEGIN
# endif // YS_DEF_BEGIN
# ifndef YS_DEF_END
# define YS_DEF_END
# endif // YS_DEF_END
YS_DEF_BEGIN
YS_DEF(bool , disable_node_optimization) ///< whether to use exit-dir instead of trackdir in node key
YS_DEF(uint32, max_search_nodes) ///< stop path-finding when this number of nodes visited
YS_DEF(bool , ship_use_yapf) ///< use YAPF for ships
YS_DEF(bool , road_use_yapf) ///< use YAPF for road
YS_DEF(bool , rail_use_yapf) ///< use YAPF for rail
YS_DEF(uint32, road_slope_penalty) ///< penalty for up-hill slope
YS_DEF(uint32, road_curve_penalty) ///< penalty for curves
YS_DEF(uint32, road_crossing_penalty) ///< penalty for level crossing
YS_DEF(uint32, road_stop_penalty) ///< penalty for going through a drive-through road stop
YS_DEF(bool , rail_firstred_twoway_eol) ///< treat first red two-way signal as dead end
YS_DEF(uint32, rail_firstred_penalty) ///< penalty for first red signal
YS_DEF(uint32, rail_firstred_exit_penalty) ///< penalty for first red exit signal
YS_DEF(uint32, rail_lastred_penalty) ///< penalty for last red signal
YS_DEF(uint32, rail_lastred_exit_penalty) ///< penalty for last red exit signal
YS_DEF(uint32, rail_station_penalty) ///< penalty for non-target station tile
YS_DEF(uint32, rail_slope_penalty) ///< penalty for up-hill slope
YS_DEF(uint32, rail_curve45_penalty) ///< penalty for curve
YS_DEF(uint32, rail_curve90_penalty) ///< penalty for 90-deg curve
YS_DEF(uint32, rail_depot_reverse_penalty) ///< penalty for reversing in the depot
YS_DEF(uint32, rail_crossing_penalty) ///< penalty for level crossing
YS_DEF(uint32, rail_look_ahead_max_signals)///< max. number of signals taken into consideration in look-ahead load balancer
YS_DEF(int32 , rail_look_ahead_signal_p0) ///< constant in polynomial penalty function
YS_DEF(int32 , rail_look_ahead_signal_p1) ///< constant in polynomial penalty function
YS_DEF(int32 , rail_look_ahead_signal_p2) ///< constant in polynomial penalty function
YS_DEF(uint32, rail_longer_platform_penalty) ///< penalty for longer station platform than train
YS_DEF(uint32, rail_longer_platform_per_tile_penalty) ///< penalty for longer station platform than train (per tile)
YS_DEF(uint32, rail_shorter_platform_penalty) ///< penalty for shorter station platform than train
YS_DEF(uint32, rail_shorter_platform_per_tile_penalty) ///< penalty for shorter station platform than train (per tile)
YS_DEF_END
#undef YS_DEF_BEGIN
#undef YS_DEF
#undef YS_DEF_END
#endif /* !YAPF_SETTINGS_H || YS_DEF */

View File

@ -154,9 +154,9 @@ Trackdir YapfChooseShipTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir,
PfnChooseShipTrack pfnChooseShipTrack = CYapfShip2::ChooseShipTrack; // default: ExitDir, allow 90-deg PfnChooseShipTrack pfnChooseShipTrack = CYapfShip2::ChooseShipTrack; // default: ExitDir, allow 90-deg
// check if non-default YAPF type needed // check if non-default YAPF type needed
if (_patches.forbid_90_deg) if (_settings.pf.forbid_90_deg)
pfnChooseShipTrack = &CYapfShip3::ChooseShipTrack; // Trackdir, forbid 90-deg pfnChooseShipTrack = &CYapfShip3::ChooseShipTrack; // Trackdir, forbid 90-deg
else if (_patches.yapf.disable_node_optimization) else if (_settings.pf.yapf.disable_node_optimization)
pfnChooseShipTrack = &CYapfShip1::ChooseShipTrack; // Trackdir, allow 90-deg pfnChooseShipTrack = &CYapfShip1::ChooseShipTrack; // Trackdir, allow 90-deg
Trackdir td_ret = pfnChooseShipTrack(v, tile, enterdir, tracks); Trackdir td_ret = pfnChooseShipTrack(v, tile, enterdir, tracks);