diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/build_vehicle_gui.cpp | 2 | ||||
-rw-r--r-- | src/lang/english.txt | 4 | ||||
-rw-r--r-- | src/settings.cpp | 4 | ||||
-rw-r--r-- | src/settings_type.h | 2 | ||||
-rw-r--r-- | src/train_cmd.cpp | 22 | ||||
-rw-r--r-- | src/vehicle_gui.cpp | 2 | ||||
-rw-r--r-- | src/vehicle_type.h | 5 |
7 files changed, 24 insertions, 17 deletions
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index 70bface53..7d321577f 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -539,7 +539,7 @@ static int DrawRailEnginePurchaseInfo(int x, int y, EngineID engine_number, cons y += 10; /* Max tractive effort - not applicable if old acceleration or maglev */ - if (_settings_game.vehicle.realistic_acceleration && rvi->railtype != RAILTYPE_MAGLEV) { + if (_settings_game.vehicle.train_acceleration_model != TAM_ORIGINAL && rvi->railtype != RAILTYPE_MAGLEV) { SetDParam(0, ((weight << multihead) * 10 * GetEngineProperty(engine_number, 0x1F, rvi->tractive_effort)) / 256); DrawString(x, y, STR_PURCHASE_INFO_MAX_TE, TC_FROMSTRING); y += 10; diff --git a/src/lang/english.txt b/src/lang/english.txt index ef2b19d0b..a2f760fc5 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1025,7 +1025,9 @@ STR_CONFIG_PATCHES_AUTOSLOPE :{LTBLUE}Allow t STR_CONFIG_PATCHES_CATCHMENT :{LTBLUE}Allow more realistically sized catchment areas: {ORANGE}{STRING1} STR_CONFIG_PATCHES_EXTRADYNAMITE :{LTBLUE}Allow removal of more town-owned roads, bridges, etc: {ORANGE}{STRING1} STR_CONFIG_PATCHES_MAMMOTHTRAINS :{LTBLUE}Enable building very long trains: {ORANGE}{STRING1} -STR_CONFIG_PATCHES_REALISTICACCEL :{LTBLUE}Enable realistic acceleration for trains: {ORANGE}{STRING1} +STR_CONFIG_PATCHES_TRAIN_ACCELERATION_MODEL :{LTBLUE}Train acceleration model: {ORANGE}{STRING1} +STR_CONFIG_PATCHES_TRAIN_ACCELERATION_MODEL_ORIGINAL :Original +STR_CONFIG_PATCHES_TRAIN_ACCELERATION_MODEL_REALISTIC :Realistic STR_CONFIG_PATCHES_FORBID_90_DEG :{LTBLUE}Forbid trains and ships to make 90 deg turns: {ORANGE}{STRING1} {LTBLUE} (not with NTP) STR_CONFIG_PATCHES_JOINSTATIONS :{LTBLUE}Join train stations built next to each other: {ORANGE}{STRING1} STR_CONFIG_PATCHES_DISTANT_JOIN_STATIONS :{LTBLUE}Allow to join stations not directly adjacent: {ORANGE}{STRING1} diff --git a/src/settings.cpp b/src/settings.cpp index fc653f167..02497e1f4 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -935,7 +935,7 @@ static int32 EngineRenewMoneyUpdate(int32 p1) return 0; } -static int32 RealisticAccelerationChanged(int32 p1) +static int32 TrainAccelerationModelChanged(int32 p1) { Vehicle *v; @@ -1321,7 +1321,7 @@ const SettingDesc _patch_settings[] = { SDT_BOOL(GameSettings, station.always_small_airport, 0,NN, false, STR_CONFIG_PATCHES_SMALL_AIRPORTS, NULL), SDT_CONDVAR(GameSettings, economy.town_layout, SLE_UINT8, 59, SL_MAX_VERSION, 0,MS,TL_ORIGINAL,TL_NO_ROADS,NUM_TLS-1,1, STR_CONFIG_PATCHES_TOWN_LAYOUT, CheckTownLayout), - SDT_BOOL(GameSettings, vehicle.realistic_acceleration, 0, 0, false, STR_CONFIG_PATCHES_REALISTICACCEL, RealisticAccelerationChanged), + SDT_VAR(GameSettings, vehicle.train_acceleration_model, SLE_UINT8, 0,MS, 0, 0, 1, 1, STR_CONFIG_PATCHES_TRAIN_ACCELERATION_MODEL, TrainAccelerationModelChanged), SDT_BOOL(GameSettings, pf.forbid_90_deg, 0, 0, false, STR_CONFIG_PATCHES_FORBID_90_DEG, NULL), SDT_BOOL(GameSettings, vehicle.mammoth_trains, 0,NN, true, STR_CONFIG_PATCHES_MAMMOTHTRAINS, NULL), SDT_BOOL(GameSettings, order.gotodepot, 0, 0, true, STR_CONFIG_PATCHES_GOTODEPOT, NULL), diff --git a/src/settings_type.h b/src/settings_type.h index a67128787..96a92fd11 100644 --- a/src/settings_type.h +++ b/src/settings_type.h @@ -283,7 +283,7 @@ struct OrderSettings { /** Settings related to vehicles. */ struct VehicleSettings { bool mammoth_trains; ///< allow very long trains - bool realistic_acceleration; ///< realistic acceleration for trains + uint8 train_acceleration_model; ///< realistic acceleration for trains 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/train_cmd.cpp b/src/train_cmd.cpp index d79a66dd5..258daabc0 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -1965,7 +1965,7 @@ CommandCost CmdReverseTrainDirection(TileIndex tile, uint32 flags, uint32 p1, ui if (v->vehstatus & VS_CRASHED || v->breakdown_ctr != 0) return CMD_ERROR; if (flags & DC_EXEC) { - if (_settings_game.vehicle.realistic_acceleration && v->cur_speed != 0) { + if (_settings_game.vehicle.train_acceleration_model != TAM_ORIGINAL && v->cur_speed != 0) { ToggleBit(v->u.rail.flags, VRF_REVERSING); } else { v->cur_speed = 0; @@ -3280,16 +3280,16 @@ static int UpdateTrainSpeed(Vehicle *v) uint accel; if (v->vehstatus & VS_STOPPED || HasBit(v->u.rail.flags, VRF_REVERSING) || HasBit(v->u.rail.flags, VRF_TRAIN_STUCK)) { - if (_settings_game.vehicle.realistic_acceleration) { - accel = GetTrainAcceleration(v, AM_BRAKE) * 2; - } else { - accel = v->acceleration * -2; + switch (_settings_game.vehicle.train_acceleration_model) { + default: NOT_REACHED(); + case TAM_ORIGINAL: accel = v->acceleration * -2; break; + case TAM_REALISTIC: accel = GetTrainAcceleration(v, AM_BRAKE) * 2; break; } } else { - if (_settings_game.vehicle.realistic_acceleration) { - accel = GetTrainAcceleration(v, AM_ACCEL); - } else { - accel = v->acceleration; + switch (_settings_game.vehicle.train_acceleration_model) { + default: NOT_REACHED(); + case TAM_ORIGINAL: accel = v->acceleration; break; + case TAM_REALISTIC: accel = GetTrainAcceleration(v, AM_ACCEL); break; } } @@ -3439,7 +3439,7 @@ static const RailtypeSlowdownParams _railtype_slowdown[] = { /** Modify the speed of the vehicle due to a turn */ static inline void AffectSpeedByDirChange(Vehicle *v, Direction new_dir) { - if (_settings_game.vehicle.realistic_acceleration) return; + if (_settings_game.vehicle.train_acceleration_model != TAM_ORIGINAL) return; DirDiff diff = DirDifference(v->direction, new_dir); if (diff == DIRDIFF_SAME) return; @@ -3451,7 +3451,7 @@ static inline void AffectSpeedByDirChange(Vehicle *v, Direction new_dir) /** Modify the speed of the vehicle due to a change in altitude */ static inline void AffectSpeedByZChange(Vehicle *v, byte old_z) { - if (old_z == v->z_pos || _settings_game.vehicle.realistic_acceleration) return; + if (old_z == v->z_pos || _settings_game.vehicle.train_acceleration_model != TAM_ORIGINAL) return; const RailtypeSlowdownParams *rsp = &_railtype_slowdown[v->u.rail.railtype]; diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index b0f91f937..76a26f3fa 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -1425,7 +1425,7 @@ struct VehicleDetailsWindow : Window { SetDParam(1, v->u.rail.cached_power); SetDParam(0, v->u.rail.cached_weight); SetDParam(3, v->u.rail.cached_max_te / 1000); - DrawString(2, 25, (_settings_game.vehicle.realistic_acceleration && v->u.rail.railtype != RAILTYPE_MAGLEV) ? + DrawString(2, 25, (_settings_game.vehicle.train_acceleration_model != TAM_ORIGINAL && v->u.rail.railtype != RAILTYPE_MAGLEV) ? STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE : STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED, TC_FROMSTRING); break; diff --git a/src/vehicle_type.h b/src/vehicle_type.h index 6a9d7c060..b05e374c4 100644 --- a/src/vehicle_type.h +++ b/src/vehicle_type.h @@ -61,4 +61,9 @@ enum { MAX_LENGTH_VEHICLE_NAME_PIXELS = 150, ///< The maximum length of a vehicle name in pixels }; +enum TrainAccelerationModel { + TAM_ORIGINAL, + TAM_REALISTIC, +}; + #endif /* VEHICLE_TYPE_H */ |