summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-01-28 22:34:14 +0000
committeryexo <yexo@openttd.org>2010-01-28 22:34:14 +0000
commitfa01b25f740d92ffa74de4bc630ca42cdc8046a0 (patch)
tree2ec72945b9470a3a579f97ea489790e5b9690146
parentb689e3d6e43f5e5d90d0c2c93059cce5d48459ae (diff)
downloadopenttd-fa01b25f740d92ffa74de4bc630ca42cdc8046a0.tar.xz
(svn r18942) -Feature [FS#2678]: add a setting to reduce/disable aircraft crashes
-rw-r--r--src/aircraft_cmd.cpp8
-rw-r--r--src/lang/english.txt4
-rw-r--r--src/saveload/saveload.cpp2
-rw-r--r--src/settings_gui.cpp1
-rw-r--r--src/settings_type.h1
-rw-r--r--src/table/settings.h1
6 files changed, 14 insertions, 3 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index d2b85ed1a..12c182975 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -1291,14 +1291,18 @@ static void CrashAirplane(Aircraft *v)
static void MaybeCrashAirplane(Aircraft *v)
{
+ if (_settings_game.vehicle.plane_crashes == 0) return;
+
Station *st = Station::Get(v->targetairport);
/* FIXME -- MaybeCrashAirplane -> increase crashing chances of very modern airplanes on smaller than AT_METROPOLITAN airports */
- uint16 prob = 0x10000 / 1500;
+ uint32 prob = (0x40000 >> _settings_game.vehicle.plane_crashes);
if ((st->Airport()->flags & AirportFTAClass::SHORT_STRIP) &&
(AircraftVehInfo(v->engine_type)->subtype & AIR_FAST) &&
!_cheats.no_jetcrash.value) {
- prob = 0x10000 / 20;
+ prob /= 20;
+ } else {
+ prob /= 1500;
}
if (GB(Random(), 0, 22) > prob) return;
diff --git a/src/lang/english.txt b/src/lang/english.txt
index 1e1ad8021..28ae0c171 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -1115,6 +1115,10 @@ STR_CONFIG_SETTING_ALLOW_GIVE_MONEY :{LTBLUE}Allow s
STR_CONFIG_SETTING_NONUNIFORM_STATIONS :{LTBLUE}Nonuniform stations: {ORANGE}{STRING1}
STR_CONFIG_SETTING_FREIGHT_TRAINS :{LTBLUE}Weight multiplier for freight to simulate heavy trains: {ORANGE}{STRING}
STR_CONFIG_SETTING_PLANE_SPEED :{LTBLUE}Plane speed factor: {ORANGE}1 / {STRING1}
+STR_CONFIG_SETTING_PLANE_CRASHES :{LTBLUE}Number of plane crashes: {ORANGE}{STRING1}
+STR_CONFIG_SETTING_PLANE_CRASHES_NONE :none
+STR_CONFIG_SETTING_PLANE_CRASHES_REDUCED :reduced
+STR_CONFIG_SETTING_PLANE_CRASHES_NORMAL :normal
STR_CONFIG_SETTING_STOP_ON_TOWN_ROAD :{LTBLUE}Allow drive-through road stops on town owned roads: {ORANGE}{STRING}
STR_CONFIG_SETTING_STOP_ON_COMPETITOR_ROAD :{LTBLUE}Allow drive-through road stops on roads owned by competitors: {ORANGE}{STRING}
STR_CONFIG_SETTING_ADJACENT_STATIONS :{LTBLUE}Allow building adjacent stations: {ORANGE}{STRING}
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index 36759196e..d6b83a794 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -46,7 +46,7 @@
#include "saveload_internal.h"
-extern const uint16 SAVEGAME_VERSION = 137;
+extern const uint16 SAVEGAME_VERSION = 138;
SavegameType _savegame_type; ///< type of savegame we are loading
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 97a47895f..7de747066 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -1458,6 +1458,7 @@ static SettingEntry _settings_vehicles[] = {
SettingEntry("vehicle.max_aircraft"),
SettingEntry("vehicle.max_ships"),
SettingEntry("vehicle.plane_speed"),
+ SettingEntry("vehicle.plane_crashes"),
SettingEntry("order.timetabling"),
SettingEntry("vehicle.dynamic_engines"),
};
diff --git a/src/settings_type.h b/src/settings_type.h
index d5e17520a..fee472165 100644
--- a/src/settings_type.h
+++ b/src/settings_type.h
@@ -320,6 +320,7 @@ struct VehicleSettings {
bool never_expire_vehicles; ///< never expire vehicles
byte extend_vehicle_life; ///< extend vehicle life by this many years
byte road_side; ///< the side of the road vehicles drive on
+ uint8 plane_crashes; ///< number of plane crashes, 0 = none, 1 = reduced, 2 = normal
};
/** Settings related to the economy. */
diff --git a/src/table/settings.h b/src/table/settings.h
index 748d225d4..00dd770d6 100644
--- a/src/table/settings.h
+++ b/src/table/settings.h
@@ -402,6 +402,7 @@ const SettingDesc _settings[] = {
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,NN, 4, 1, 4, 0, STR_CONFIG_SETTING_PLANE_SPEED, NULL),
SDT_CONDBOOL(GameSettings, vehicle.dynamic_engines, 95, SL_MAX_VERSION, 0,NN, true, STR_CONFIG_SETTING_DYNAMIC_ENGINES, ChangeDynamicEngines),
+ SDT_CONDVAR(GameSettings, vehicle.plane_crashes, SLE_UINT8,138, SL_MAX_VERSION, 0,MS, 2, 0, 2, 1, STR_CONFIG_SETTING_PLANE_CRASHES, NULL),
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),