diff options
author | terkhen <terkhen@openttd.org> | 2010-03-06 12:58:33 +0000 |
---|---|---|
committer | terkhen <terkhen@openttd.org> | 2010-03-06 12:58:33 +0000 |
commit | b443a3ee0a39f28be1fde279e67c82ee51814f4d (patch) | |
tree | 031d81ef75f3783bc28166caf7994ea97415434f | |
parent | c958c2c31f0f04cdf66dfae0b95743011202655a (diff) | |
download | openttd-b443a3ee0a39f28be1fde279e67c82ee51814f4d.tar.xz |
(svn r19346) -Feature: Configurable slope steepness for road vehicles from 0% to 10%, default is 7%.
-rw-r--r-- | src/lang/english.txt | 1 | ||||
-rw-r--r-- | src/roadveh.h | 3 | ||||
-rw-r--r-- | src/saveload/saveload.cpp | 2 | ||||
-rw-r--r-- | src/settings.cpp | 15 | ||||
-rw-r--r-- | src/settings_gui.cpp | 1 | ||||
-rw-r--r-- | src/settings_type.h | 1 | ||||
-rw-r--r-- | src/table/settings.h | 2 |
7 files changed, 22 insertions, 3 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt index cc54f7bef..d14b0f11f 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1087,6 +1087,7 @@ STR_CONFIG_SETTING_ROAD_VEHICLE_ACCELERATION_MODEL :{LTBLUE}Road ve STR_CONFIG_SETTING_ROAD_VEHICLE_ACCELERATION_MODEL_ORIGINAL :Original STR_CONFIG_SETTING_ROAD_VEHICLE_ACCELERATION_MODEL_REALISTIC :Realistic STR_CONFIG_SETTING_TRAIN_SLOPE_STEEPNESS :{LTBLUE}Slope steepness for trains {ORANGE}{STRING1}% +STR_CONFIG_SETTING_ROAD_VEHICLE_SLOPE_STEEPNESS :{LTBLUE}Slope steepness for road vehicles {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/roadveh.h b/src/roadveh.h index 1355bcc54..5983effba 100644 --- a/src/roadveh.h +++ b/src/roadveh.h @@ -255,8 +255,7 @@ protected: // These functions should not be called outside acceleration code. */ FORCEINLINE uint32 GetSlopeSteepness() const { - /* Road vehicles use by default a steeper slope than trains. */ - return 20 * 7; // 1% slope * slope steepness + return 20 * _settings_game.vehicle.roadveh_slope_steepness; // 1% slope * slope steepness } /** diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index 7a9c81e98..5e2c51fde 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -46,7 +46,7 @@ #include "saveload_internal.h" -extern const uint16 SAVEGAME_VERSION = 138; +extern const uint16 SAVEGAME_VERSION = 139; SavegameType _savegame_type; ///< type of savegame we are loading diff --git a/src/settings.cpp b/src/settings.cpp index b190292e4..e4379f2b2 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -794,6 +794,21 @@ static bool RoadVehAccelerationModelChanged(int32 p1) return true; } +/** + * This function updates the road vehicle acceleration cache after a steepness change. + * @param p1 Callback parameter. + * @return Always true. + */ +static bool RoadVehSlopeSteepnessChanged(int32 p1) +{ + RoadVehicle *rv; + FOR_ALL_ROADVEHICLES(rv) { + if (rv->IsRoadVehFront()) rv->CargoChanged(); + } + + return true; +} + static bool DragSignalsDensityChanged(int32) { InvalidateWindowData(WC_BUILD_SIGNAL, 0); diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 7ce4753e2..d8e610b5d 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1466,6 +1466,7 @@ static SettingEntry _settings_vehicles[] = { SettingEntry("order.timetabling"), SettingEntry("vehicle.dynamic_engines"), SettingEntry("vehicle.roadveh_acceleration_model"), + SettingEntry("vehicle.roadveh_slope_steepness"), }; /** Vehicles sub-page */ static SettingsPage _settings_vehicles_page = {_settings_vehicles, lengthof(_settings_vehicles)}; diff --git a/src/settings_type.h b/src/settings_type.h index 83bce21ad..4adabf0b5 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -312,6 +312,7 @@ struct VehicleSettings { uint8 train_acceleration_model; ///< realistic acceleration for trains uint8 roadveh_acceleration_model; ///< realistic acceleration for road vehicles uint8 train_slope_steepness; ///< Steepness of hills for trains when using realistic acceleration + uint8 roadveh_slope_steepness; ///< Steepness of hills for road vehicles 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 e96a1cf35..1afadeb4e 100644 --- a/src/table/settings.h +++ b/src/table/settings.h @@ -25,6 +25,7 @@ static bool CheckInterval(int32 p1); static bool TrainAccelerationModelChanged(int32 p1); static bool RoadVehAccelerationModelChanged(int32 p1); static bool TrainSlopeSteepnessChanged(int32 p1); +static bool RoadVehSlopeSteepnessChanged(int32 p1); static bool DragSignalsDensityChanged(int32); static bool TownFoundingChanged(int32 p1); static bool DifficultyReset(int32 level); @@ -374,6 +375,7 @@ const SettingDesc _settings[] = { 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.roadveh_acceleration_model, SLE_UINT8,139, SL_MAX_VERSION, 0,MS, 0, 0, 1, 1, STR_CONFIG_SETTING_ROAD_VEHICLE_ACCELERATION_MODEL, RoadVehAccelerationModelChanged), 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, TrainSlopeSteepnessChanged), + SDT_CONDVAR(GameSettings, vehicle.roadveh_slope_steepness, SLE_UINT8,139, SL_MAX_VERSION, 0, 0, 7, 0, 10, 1, STR_CONFIG_SETTING_ROAD_VEHICLE_SLOPE_STEEPNESS, RoadVehSlopeSteepnessChanged), 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), |