summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-02-27 21:07:12 +0000
committerpeter1138 <peter1138@openttd.org>2008-02-27 21:07:12 +0000
commit015cf7e6a217cffe68796c4cbc562a403892ef65 (patch)
treed9e57798c8a84adc785415895d98138653130367 /src
parent2678c4faaa1d3f938338721c4c024a3b0787de93 (diff)
downloadopenttd-015cf7e6a217cffe68796c4cbc562a403892ef65.tar.xz
(svn r12293) -Feature: Ability to change aircraft speed factor, from so
called 'realistic' (matching other vehicles) (1/1) to original TTD speed (1/4). Note this option defaults to original TTD speed.
Diffstat (limited to 'src')
-rw-r--r--src/aircraft_cmd.cpp11
-rw-r--r--src/lang/english.txt1
-rw-r--r--src/saveload.cpp2
-rw-r--r--src/settings.cpp1
-rw-r--r--src/settings_gui.cpp1
-rw-r--r--src/settings_type.h2
6 files changed, 16 insertions, 2 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index 18ba5634c..66ab37e15 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -924,6 +924,10 @@ static int UpdateAircraftSpeed(Vehicle *v, uint speed_limit = SPEED_LIMIT_NONE,
uint spd = v->acceleration * 16;
byte t;
+ /* Adjust speed limits by plane speed factor to prevent taxiing
+ * and take-off speeds being too low. */
+ speed_limit *= _patches.plane_speed;
+
if (v->u.air.cached_max_speed < speed_limit) {
if (v->cur_speed < speed_limit) hard_limit = false;
speed_limit = v->u.air.cached_max_speed;
@@ -939,7 +943,9 @@ static int UpdateAircraftSpeed(Vehicle *v, uint speed_limit = SPEED_LIMIT_NONE,
* method at slower speeds. This also results in less reduction at slow
* speeds to that aircraft do not get to taxi speed straight after
* touchdown. */
- if (!hard_limit && v->cur_speed > speed_limit) speed_limit = v->cur_speed - max(1, (v->cur_speed * v->cur_speed) / 16384);
+ 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);
+ }
spd = min(v->cur_speed + (spd >> 8) + (v->subspeed < t), speed_limit);
@@ -953,6 +959,9 @@ static int UpdateAircraftSpeed(Vehicle *v, uint speed_limit = SPEED_LIMIT_NONE,
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
}
+ /* Adjust distance moved by plane speed setting */
+ if (_patches.plane_speed > 1) spd /= _patches.plane_speed;
+
if (!(v->direction & 1)) spd = spd * 3 / 4;
spd += v->progress;
diff --git a/src/lang/english.txt b/src/lang/english.txt
index f6448f176..fd71ef3b0 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -1050,6 +1050,7 @@ STR_CONFIG_PATCHES_ALLOW_EXCLUSIVE :{LTBLUE}Allow b
STR_CONFIG_PATCHES_ALLOW_GIVE_MONEY :{LTBLUE}Allow sending money to other companies: {ORANGE}{STRING1}
STR_CONFIG_PATCHES_NONUNIFORM_STATIONS :{LTBLUE}Nonuniform stations: {ORANGE}{STRING1}
STR_CONFIG_PATCHES_FREIGHT_TRAINS :{LTBLUE}Weight multiplier for freight to simulate heavy trains: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_PLANE_SPEED :{LTBLUE}Plane speed factor: {ORANGE}1 / {STRING1}
STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD :{LTBLUE}Allow drive-through road stops on town owned roads: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ADJACENT_STATIONS :{LTBLUE}Allow building adjacent stations: {ORANGE}{STRING}
diff --git a/src/saveload.cpp b/src/saveload.cpp
index 2e8378c9c..1e55d1e86 100644
--- a/src/saveload.cpp
+++ b/src/saveload.cpp
@@ -34,7 +34,7 @@
#include "table/strings.h"
-extern const uint16 SAVEGAME_VERSION = 89;
+extern const uint16 SAVEGAME_VERSION = 90;
uint16 _sl_version; ///< the major savegame version identifier
byte _sl_minor_version; ///< the minor savegame version, DO NOT USE!
diff --git a/src/settings.cpp b/src/settings.cpp
index 5375219ec..072e4eb18 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -1432,6 +1432,7 @@ const SettingDesc _patch_settings[] = {
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),
/***************************************************************************/
/* Station section of the GUI-configure patches window */
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 34790acc0..d7be418ef 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -818,6 +818,7 @@ static const char *_patches_vehicles[] = {
"wagon_speed_limits",
"disable_elrails",
"freight_trains",
+ "plane_speed",
"timetabling",
};
diff --git a/src/settings_type.h b/src/settings_type.h
index 3460f47ed..d82297fa1 100644
--- a/src/settings_type.h
+++ b/src/settings_type.h
@@ -130,6 +130,8 @@ struct Patches {
uint8 pathfinder_for_roadvehs; ///< the pathfinder to use for roadvehicles
uint8 pathfinder_for_ships; ///< the pathfinder to use for ships
+ uint8 plane_speed; ///< divisor for speed of aircraft
+
bool autorenew;
int16 autorenew_months;
int32 autorenew_money;