mirror of https://github.com/OpenTTD/OpenTTD
(svn r15236) -Codechange: Rename realistic_acceleration patch option to train_acceleration_model, and change from boolean to value. Don't forget to update your settings.
parent
1879319f66
commit
3d404c2927
|
@ -539,7 +539,7 @@ static int DrawRailEnginePurchaseInfo(int x, int y, EngineID engine_number, cons
|
||||||
y += 10;
|
y += 10;
|
||||||
|
|
||||||
/* Max tractive effort - not applicable if old acceleration or maglev */
|
/* 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);
|
SetDParam(0, ((weight << multihead) * 10 * GetEngineProperty(engine_number, 0x1F, rvi->tractive_effort)) / 256);
|
||||||
DrawString(x, y, STR_PURCHASE_INFO_MAX_TE, TC_FROMSTRING);
|
DrawString(x, y, STR_PURCHASE_INFO_MAX_TE, TC_FROMSTRING);
|
||||||
y += 10;
|
y += 10;
|
||||||
|
|
|
@ -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_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_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_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_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_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}
|
STR_CONFIG_PATCHES_DISTANT_JOIN_STATIONS :{LTBLUE}Allow to join stations not directly adjacent: {ORANGE}{STRING1}
|
||||||
|
|
|
@ -935,7 +935,7 @@ static int32 EngineRenewMoneyUpdate(int32 p1)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32 RealisticAccelerationChanged(int32 p1)
|
static int32 TrainAccelerationModelChanged(int32 p1)
|
||||||
{
|
{
|
||||||
Vehicle *v;
|
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_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_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, 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, vehicle.mammoth_trains, 0,NN, true, STR_CONFIG_PATCHES_MAMMOTHTRAINS, NULL),
|
||||||
SDT_BOOL(GameSettings, order.gotodepot, 0, 0, true, STR_CONFIG_PATCHES_GOTODEPOT, NULL),
|
SDT_BOOL(GameSettings, order.gotodepot, 0, 0, true, STR_CONFIG_PATCHES_GOTODEPOT, NULL),
|
||||||
|
|
|
@ -283,7 +283,7 @@ struct OrderSettings {
|
||||||
/** Settings related to vehicles. */
|
/** Settings related to vehicles. */
|
||||||
struct VehicleSettings {
|
struct VehicleSettings {
|
||||||
bool mammoth_trains; ///< allow very long trains
|
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 wagon_speed_limits; ///< enable wagon speed limits
|
||||||
bool disable_elrails; ///< when true, the elrails are disabled
|
bool disable_elrails; ///< when true, the elrails are disabled
|
||||||
UnitID max_trains; ///< max trains in game per company
|
UnitID max_trains; ///< max trains in game per company
|
||||||
|
|
|
@ -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 (v->vehstatus & VS_CRASHED || v->breakdown_ctr != 0) return CMD_ERROR;
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
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);
|
ToggleBit(v->u.rail.flags, VRF_REVERSING);
|
||||||
} else {
|
} else {
|
||||||
v->cur_speed = 0;
|
v->cur_speed = 0;
|
||||||
|
@ -3280,16 +3280,16 @@ static int UpdateTrainSpeed(Vehicle *v)
|
||||||
uint accel;
|
uint accel;
|
||||||
|
|
||||||
if (v->vehstatus & VS_STOPPED || HasBit(v->u.rail.flags, VRF_REVERSING) || HasBit(v->u.rail.flags, VRF_TRAIN_STUCK)) {
|
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) {
|
switch (_settings_game.vehicle.train_acceleration_model) {
|
||||||
accel = GetTrainAcceleration(v, AM_BRAKE) * 2;
|
default: NOT_REACHED();
|
||||||
} else {
|
case TAM_ORIGINAL: accel = v->acceleration * -2; break;
|
||||||
accel = v->acceleration * -2;
|
case TAM_REALISTIC: accel = GetTrainAcceleration(v, AM_BRAKE) * 2; break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (_settings_game.vehicle.realistic_acceleration) {
|
switch (_settings_game.vehicle.train_acceleration_model) {
|
||||||
accel = GetTrainAcceleration(v, AM_ACCEL);
|
default: NOT_REACHED();
|
||||||
} else {
|
case TAM_ORIGINAL: accel = v->acceleration; break;
|
||||||
accel = v->acceleration;
|
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 */
|
/** Modify the speed of the vehicle due to a turn */
|
||||||
static inline void AffectSpeedByDirChange(Vehicle *v, Direction new_dir)
|
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);
|
DirDiff diff = DirDifference(v->direction, new_dir);
|
||||||
if (diff == DIRDIFF_SAME) return;
|
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 */
|
/** Modify the speed of the vehicle due to a change in altitude */
|
||||||
static inline void AffectSpeedByZChange(Vehicle *v, byte old_z)
|
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];
|
const RailtypeSlowdownParams *rsp = &_railtype_slowdown[v->u.rail.railtype];
|
||||||
|
|
||||||
|
|
|
@ -1425,7 +1425,7 @@ struct VehicleDetailsWindow : Window {
|
||||||
SetDParam(1, v->u.rail.cached_power);
|
SetDParam(1, v->u.rail.cached_power);
|
||||||
SetDParam(0, v->u.rail.cached_weight);
|
SetDParam(0, v->u.rail.cached_weight);
|
||||||
SetDParam(3, v->u.rail.cached_max_te / 1000);
|
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_MAX_TE :
|
||||||
STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED, TC_FROMSTRING);
|
STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED, TC_FROMSTRING);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -61,4 +61,9 @@ enum {
|
||||||
MAX_LENGTH_VEHICLE_NAME_PIXELS = 150, ///< The maximum length of a vehicle name in pixels
|
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 */
|
#endif /* VEHICLE_TYPE_H */
|
||||||
|
|
Loading…
Reference in New Issue