(svn r14959) -Fix [FS#2508]: wrong defaults for service interval when switching between service interval in days and service interval in percentages.

This commit is contained in:
rubidium 2009-01-10 16:24:42 +00:00
parent c5db2ea181
commit 88e3815176
2 changed files with 10 additions and 15 deletions

View File

@ -1224,7 +1224,6 @@ STR_CONFIG_PATCHES_INT32 :{NUM}
STR_CONFIG_PATCHES_CURRENCY :{CURRENCY}
STR_CONFIG_PATCHES_QUERY_CAPT :{WHITE}Change setting value
STR_CONFIG_PATCHES_SERVICE_INTERVAL_INCOMPATIBLE :{WHITE}Some or all of the default service interval(s) below are incompatible with the chosen setting! 5-90% and 30-800 days are valid
STR_CONFIG_PATCHES_PATHFINDER_FOR_TRAINS :{LTBLUE}Pathfinder for trains: {ORANGE}{STRING1}
STR_CONFIG_PATCHES_PATHFINDER_FOR_TRAINS_NTP :NTP {RED}(Not recommended)

View File

@ -902,24 +902,20 @@ static int32 UpdateConsists(int32 p1)
/* Check service intervals of vehicles, p1 is value of % or day based servicing */
static int32 CheckInterval(int32 p1)
{
bool warning;
const VehicleSettings *ptc = (_game_mode == GM_MENU) ? &_settings_newgame.vehicle : &_settings_game.vehicle;
VehicleSettings *ptc = (_game_mode == GM_MENU) ? &_settings_newgame.vehicle : &_settings_game.vehicle;
if (p1) {
warning = ( (IsInsideMM(ptc->servint_trains, 5, 90 + 1) || ptc->servint_trains == 0) &&
(IsInsideMM(ptc->servint_roadveh, 5, 90 + 1) || ptc->servint_roadveh == 0) &&
(IsInsideMM(ptc->servint_aircraft, 5, 90 + 1) || ptc->servint_aircraft == 0) &&
(IsInsideMM(ptc->servint_ships, 5, 90 + 1) || ptc->servint_ships == 0) );
ptc->servint_trains = 50;
ptc->servint_roadveh = 50;
ptc->servint_aircraft = 50;
ptc->servint_ships = 50;
} else {
warning = ( (IsInsideMM(ptc->servint_trains, 30, 800 + 1) || ptc->servint_trains == 0) &&
(IsInsideMM(ptc->servint_roadveh, 30, 800 + 1) || ptc->servint_roadveh == 0) &&
(IsInsideMM(ptc->servint_aircraft, 30, 800 + 1) || ptc->servint_aircraft == 0) &&
(IsInsideMM(ptc->servint_ships, 30, 800 + 1) || ptc->servint_ships == 0) );
ptc->servint_trains = 150;
ptc->servint_roadveh = 150;
ptc->servint_aircraft = 360;
ptc->servint_ships = 100;
}
if (!warning)
ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_PATCHES_SERVICE_INTERVAL_INCOMPATIBLE, 0, 0);
return InValidateDetailsWindow(0);
}
@ -1282,7 +1278,7 @@ const SettingDesc _patch_settings[] = {
SDT_VAR(GameSettings, vehicle.max_roadveh, SLE_UINT16, 0, 0, 500, 0, 5000, 0, STR_CONFIG_PATCHES_MAX_ROADVEH, RedrawScreen),
SDT_VAR(GameSettings, vehicle.max_aircraft, SLE_UINT16, 0, 0, 200, 0, 5000, 0, STR_CONFIG_PATCHES_MAX_AIRCRAFT, RedrawScreen),
SDT_VAR(GameSettings, vehicle.max_ships, SLE_UINT16, 0, 0, 300, 0, 5000, 0, STR_CONFIG_PATCHES_MAX_SHIPS, RedrawScreen),
SDT_BOOL(GameSettings, vehicle.servint_ispercent, 0, 0, false, STR_CONFIG_PATCHES_SERVINT_ISPERCENT, CheckInterval),
SDT_BOOL(GameSettings, vehicle.servint_ispercent, 0,NN, false, STR_CONFIG_PATCHES_SERVINT_ISPERCENT, CheckInterval),
SDT_VAR(GameSettings, vehicle.servint_trains, SLE_UINT16, 0,D0, 150, 5, 800, 0, STR_CONFIG_PATCHES_SERVINT_TRAINS, InValidateDetailsWindow),
SDT_VAR(GameSettings, vehicle.servint_roadveh, SLE_UINT16, 0,D0, 150, 5, 800, 0, STR_CONFIG_PATCHES_SERVINT_ROADVEH, InValidateDetailsWindow),
SDT_VAR(GameSettings, vehicle.servint_ships, SLE_UINT16, 0,D0, 360, 5, 800, 0, STR_CONFIG_PATCHES_SERVINT_SHIPS, InValidateDetailsWindow),