(svn r19346) -Feature: Configurable slope steepness for road vehicles from 0% to 10%, default is 7%.

pull/155/head
terkhen 14 years ago
parent e6878d7ba1
commit f78a386b87

@ -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}

@ -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
}
/**

@ -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

@ -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);

@ -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)};

@ -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

@ -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),

Loading…
Cancel
Save