(svn r12293) -Feature: Ability to change aircraft speed factor, from so
authorpeter1138
Wed, 27 Feb 2008 21:07:12 +0000
changeset 9144 3e82211b57c5
parent 9143 594daafabff4
child 9145 d9831299672e
(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.
src/aircraft_cmd.cpp
src/lang/english.txt
src/saveload.cpp
src/settings.cpp
src/settings_gui.cpp
src/settings_type.h
--- a/src/aircraft_cmd.cpp	Wed Feb 27 15:35:24 2008 +0000
+++ b/src/aircraft_cmd.cpp	Wed Feb 27 21:07:12 2008 +0000
@@ -924,6 +924,10 @@
 	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 @@
 	 * 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 @@
 			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;
--- a/src/lang/english.txt	Wed Feb 27 15:35:24 2008 +0000
+++ b/src/lang/english.txt	Wed Feb 27 21:07:12 2008 +0000
@@ -1050,6 +1050,7 @@
 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}
 
--- a/src/saveload.cpp	Wed Feb 27 15:35:24 2008 +0000
+++ b/src/saveload.cpp	Wed Feb 27 21:07:12 2008 +0000
@@ -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!
 
--- a/src/settings.cpp	Wed Feb 27 15:35:24 2008 +0000
+++ b/src/settings.cpp	Wed Feb 27 21:07:12 2008 +0000
@@ -1432,6 +1432,7 @@
 	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 */
--- a/src/settings_gui.cpp	Wed Feb 27 15:35:24 2008 +0000
+++ b/src/settings_gui.cpp	Wed Feb 27 21:07:12 2008 +0000
@@ -818,6 +818,7 @@
 	"wagon_speed_limits",
 	"disable_elrails",
 	"freight_trains",
+	"plane_speed",
 	"timetabling",
 };
 
--- a/src/settings_type.h	Wed Feb 27 15:35:24 2008 +0000
+++ b/src/settings_type.h	Wed Feb 27 21:07:12 2008 +0000
@@ -130,6 +130,8 @@
 	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;