summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2009-12-31 10:41:03 +0000
committerpeter1138 <peter1138@openttd.org>2009-12-31 10:41:03 +0000
commit739aea3e1afb150100c06362d098b6e19ef2342e (patch)
tree96a085088fe20b79b8cd5267ca3361b68b536835
parent2d14ced236388a69e80a5031c359d7f1f912a0d1 (diff)
downloadopenttd-739aea3e1afb150100c06362d098b6e19ef2342e.tar.xz
(svn r18674) -Feature (FS#3459): Configurable slope steepness for trains from 0% to 10%, default is 3% as before (mostly by Terkhen)
-rw-r--r--src/lang/english.txt1
-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
-rw-r--r--src/train_cmd.cpp4
6 files changed, 7 insertions, 3 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt
index ea97bd53d..50da5034d 100644
--- a/src/lang/english.txt
+++ b/src/lang/english.txt
@@ -1082,6 +1082,7 @@ STR_CONFIG_SETTING_MAMMOTHTRAINS :{LTBLUE}Enable
STR_CONFIG_SETTING_TRAIN_ACCELERATION_MODEL :{LTBLUE}Train acceleration model: {ORANGE}{STRING1}
STR_CONFIG_SETTING_TRAIN_ACCELERATION_MODEL_ORIGINAL :Original
STR_CONFIG_SETTING_TRAIN_ACCELERATION_MODEL_REALISTIC :Realistic
+STR_CONFIG_SETTING_TRAIN_SLOPE_STEEPNESS :{LTBLUE}Slope steepness for trains {ORANGE}{STRING1}%
STR_CONFIG_SETTING_FORBID_90_DEG :{LTBLUE}Forbid trains and ships to make 90 deg turns: {ORANGE}{STRING1} {LTBLUE} (not with OPF)
STR_CONFIG_SETTING_JOINSTATIONS :{LTBLUE}Join train stations built next to each other: {ORANGE}{STRING1}
STR_CONFIG_SETTING_DISTANT_JOIN_STATIONS :{LTBLUE}Allow to join stations not directly adjacent: {ORANGE}{STRING1}
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index b83faeb4c..f737a50c8 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -47,7 +47,7 @@
#include "saveload_internal.h"
-extern const uint16 SAVEGAME_VERSION = 132;
+extern const uint16 SAVEGAME_VERSION = 133;
SavegameType _savegame_type; ///< type of savegame we are loading
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 8f6f8a0e6..5b70640db 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -1427,6 +1427,7 @@ static SettingsPage _settings_vehicles_servicing_page = {_settings_vehicles_serv
static SettingEntry _settings_vehicles_trains[] = {
SettingEntry("vehicle.train_acceleration_model"),
+ SettingEntry("vehicle.train_slope_steepness"),
SettingEntry("vehicle.mammoth_trains"),
SettingEntry("gui.lost_train_warn"),
SettingEntry("vehicle.wagon_speed_limits"),
diff --git a/src/settings_type.h b/src/settings_type.h
index 801ca05f5..383b89e7d 100644
--- a/src/settings_type.h
+++ b/src/settings_type.h
@@ -307,6 +307,7 @@ struct OrderSettings {
struct VehicleSettings {
bool mammoth_trains; ///< allow very long trains
uint8 train_acceleration_model; ///< realistic acceleration for trains
+ uint8 train_slope_steepness; ///< Steepness of hills for trains when using realistic acceleration
bool wagon_speed_limits; ///< enable wagon speed limits
bool disable_elrails; ///< when true, the elrails are disabled
UnitID max_trains; ///< max trains in game per company
diff --git a/src/table/settings.h b/src/table/settings.h
index 8c2e6b5e1..232e55355 100644
--- a/src/table/settings.h
+++ b/src/table/settings.h
@@ -372,6 +372,7 @@ const SettingDesc _settings[] = {
SDT_CONDVAR(GameSettings, economy.found_town, SLE_UINT8,128, SL_MAX_VERSION, 0,MS,TF_FORBIDDEN,TF_BEGIN,TF_END - 1, 1, STR_CONFIG_SETTING_TOWN_FOUNDING, TownFoundingChanged),
SDT_VAR(GameSettings, vehicle.train_acceleration_model, SLE_UINT8, 0,MS, 0, 0, 1, 1, STR_CONFIG_SETTING_TRAIN_ACCELERATION_MODEL, TrainAccelerationModelChanged),
+ SDT_CONDVAR(GameSettings, vehicle.train_slope_steepness, SLE_UINT8,133, SL_MAX_VERSION, 0, 0, 3, 0, 10, 1, STR_CONFIG_SETTING_TRAIN_SLOPE_STEEPNESS, NULL),
SDT_BOOL(GameSettings, pf.forbid_90_deg, 0, 0, false, STR_CONFIG_SETTING_FORBID_90_DEG, NULL),
SDT_BOOL(GameSettings, vehicle.mammoth_trains, 0,NN, true, STR_CONFIG_SETTING_MAMMOTHTRAINS, NULL),
SDT_BOOL(GameSettings, order.gotodepot, 0, 0, true, STR_CONFIG_SETTING_GOTODEPOT, NULL),
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index b30547991..a8f4dd2f1 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -523,9 +523,9 @@ static int GetTrainAcceleration(Train *v, bool mode)
if (u->track == TRACK_BIT_DEPOT) max_speed = min(max_speed, 61);
if (HasBit(u->flags, VRF_GOINGUP)) {
- incl += u->tcache.cached_veh_weight * 60; // 3% slope, quite a bit actually
+ incl += u->tcache.cached_veh_weight * 20 * _settings_game.vehicle.train_slope_steepness;
} else if (HasBit(u->flags, VRF_GOINGDOWN)) {
- incl -= u->tcache.cached_veh_weight * 60;
+ incl -= u->tcache.cached_veh_weight * 20 * _settings_game.vehicle.train_slope_steepness;
}
}