diff options
author | yexo <yexo@openttd.org> | 2009-02-26 01:53:22 +0000 |
---|---|---|
committer | yexo <yexo@openttd.org> | 2009-02-26 01:53:22 +0000 |
commit | a78724e824bff0f77fd11fad5cbb991b40eb31e3 (patch) | |
tree | 516d4160e014b690ab85286bcd9758b728332e7e /src | |
parent | a0c4f1156aa5fcd503d976c102db89b5a683b81a (diff) | |
download | openttd-a78724e824bff0f77fd11fad5cbb991b40eb31e3.tar.xz |
(svn r15586) -Fix [FS#2687]: Changing vehicle.dynamic_engines when there are already vehicles can cause crashes.
Diffstat (limited to 'src')
-rw-r--r-- | src/lang/english.txt | 1 | ||||
-rw-r--r-- | src/settings.cpp | 20 |
2 files changed, 20 insertions, 1 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt index a13539245..810aa6d99 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -947,6 +947,7 @@ STR_CONFIG_SETTING_PLANE_SPEED :{LTBLUE}Plane s STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD :{LTBLUE}Allow drive-through road stops on town owned roads: {ORANGE}{STRING} STR_CONFIG_SETTING_ADJACENT_STATIONS :{LTBLUE}Allow building adjacent stations: {ORANGE}{STRING} STR_CONFIG_SETTING_DYNAMIC_ENGINES :{LTBLUE}Enable multiple NewGRF engine sets: {ORANGE}{STRING} +STR_CONFIG_SETTING_DYNAMIC_ENGINES_EXISTING_VEHICLES :{WHITE}Changing this setting is not possible when there are vehicles. STR_CONFIG_SETTING_SMALL_AIRPORTS :{LTBLUE}Always allow small airports: {ORANGE}{STRING1} diff --git a/src/settings.cpp b/src/settings.cpp index ecfc3403c..506ba8abf 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -1136,6 +1136,24 @@ static bool CheckFreeformEdges(int32 p1) return true; } +/** + * Changing the setting "allow multiple NewGRF sets" is not allowed + * if there are vehicles. + */ +static bool ChangeDynamicEngines(int32 p1) +{ + if (_game_mode == GM_MENU) return true; + + const Vehicle *v; + FOR_ALL_VEHICLES(v) { + if (IsCompanyBuildableVehicleType(v)) { + ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_SETTING_DYNAMIC_ENGINES_EXISTING_VEHICLES, 0, 0); + return false; + } + } + return true; +} + #ifdef ENABLE_NETWORK static bool UpdateMinActiveClients(int32 p1) @@ -1348,7 +1366,7 @@ const SettingDesc _settings[] = { SDT_CONDVAR(GameSettings, vehicle.freight_trains, SLE_UINT8, 39, SL_MAX_VERSION, 0,NN, 1, 1, 255, 1, STR_CONFIG_SETTING_FREIGHT_TRAINS, NULL), SDT_CONDBOOL(GameSettings, order.timetabling, 67, SL_MAX_VERSION, 0, 0, true, STR_CONFIG_SETTING_TIMETABLE_ALLOW, NULL), SDT_CONDVAR(GameSettings, vehicle.plane_speed, SLE_UINT8, 90, SL_MAX_VERSION, 0, 0, 4, 1, 4, 0, STR_CONFIG_SETTING_PLANE_SPEED, NULL), - SDT_CONDBOOL(GameSettings, vehicle.dynamic_engines, 95, SL_MAX_VERSION, 0,NN, false, STR_CONFIG_SETTING_DYNAMIC_ENGINES, NULL), + SDT_CONDBOOL(GameSettings, vehicle.dynamic_engines, 95, SL_MAX_VERSION, 0,NN, false, STR_CONFIG_SETTING_DYNAMIC_ENGINES, ChangeDynamicEngines), SDT_BOOL(GameSettings, station.join_stations, 0, 0, true, STR_CONFIG_SETTING_JOINSTATIONS, NULL), SDTC_CONDBOOL( gui.sg_full_load_any, 22, 92, 0, 0, true, STR_NULL, NULL), |