mirror of https://github.com/OpenTTD/OpenTTD
(svn r18963) -Codechange: Give AccelerationModel a generical name.
parent
815eede0be
commit
272f2cd93e
|
@ -479,7 +479,7 @@ static int DrawRailEnginePurchaseInfo(int left, int right, int y, EngineID engin
|
||||||
y += FONT_HEIGHT_NORMAL;
|
y += FONT_HEIGHT_NORMAL;
|
||||||
|
|
||||||
/* Max tractive effort - not applicable if old acceleration or maglev */
|
/* Max tractive effort - not applicable if old acceleration or maglev */
|
||||||
if (_settings_game.vehicle.train_acceleration_model != TAM_ORIGINAL && GetRailTypeInfo(rvi->railtype)->acceleration_type != 2) {
|
if (_settings_game.vehicle.train_acceleration_model != AM_ORIGINAL && GetRailTypeInfo(rvi->railtype)->acceleration_type != 2) {
|
||||||
SetDParam(0, e->GetDisplayMaxTractiveEffort());
|
SetDParam(0, e->GetDisplayMaxTractiveEffort());
|
||||||
DrawString(left, right, y, STR_PURCHASE_INFO_MAX_TE);
|
DrawString(left, right, y, STR_PURCHASE_INFO_MAX_TE);
|
||||||
y += FONT_HEIGHT_NORMAL;
|
y += FONT_HEIGHT_NORMAL;
|
||||||
|
|
|
@ -161,7 +161,7 @@ static StringID GetTrainEngineInfoString(const Engine *e)
|
||||||
} else {
|
} else {
|
||||||
SetDParam(5, CT_INVALID);
|
SetDParam(5, CT_INVALID);
|
||||||
}
|
}
|
||||||
return (_settings_game.vehicle.train_acceleration_model != TAM_ORIGINAL && GetRailTypeInfo(e->u.rail.railtype)->acceleration_type != 2) ? STR_ENGINE_PREVIEW_COST_WEIGHT_SPEED_POWER_MAX_TE : STR_ENGINE_PREVIEW_COST_WEIGHT_SPEED_POWER;
|
return (_settings_game.vehicle.train_acceleration_model != AM_ORIGINAL && GetRailTypeInfo(e->u.rail.railtype)->acceleration_type != 2) ? STR_ENGINE_PREVIEW_COST_WEIGHT_SPEED_POWER_MAX_TE : STR_ENGINE_PREVIEW_COST_WEIGHT_SPEED_POWER;
|
||||||
}
|
}
|
||||||
|
|
||||||
static StringID GetAircraftEngineInfoString(const Engine *e)
|
static StringID GetAircraftEngineInfoString(const Engine *e)
|
||||||
|
|
|
@ -392,7 +392,7 @@ int Train::GetCurveSpeedLimit() const
|
||||||
static const int absolute_max_speed = UINT16_MAX;
|
static const int absolute_max_speed = UINT16_MAX;
|
||||||
int max_speed = absolute_max_speed;
|
int max_speed = absolute_max_speed;
|
||||||
|
|
||||||
if (_settings_game.vehicle.train_acceleration_model == TAM_ORIGINAL) return max_speed;
|
if (_settings_game.vehicle.train_acceleration_model == AM_ORIGINAL) return max_speed;
|
||||||
|
|
||||||
int curvecount[2] = {0, 0};
|
int curvecount[2] = {0, 0};
|
||||||
|
|
||||||
|
@ -1989,7 +1989,7 @@ CommandCost CmdReverseTrainDirection(TileIndex tile, DoCommandFlag flags, uint32
|
||||||
v->force_proceed = 0;
|
v->force_proceed = 0;
|
||||||
SetWindowDirty(WC_VEHICLE_VIEW, v->index);
|
SetWindowDirty(WC_VEHICLE_VIEW, v->index);
|
||||||
|
|
||||||
if (_settings_game.vehicle.train_acceleration_model != TAM_ORIGINAL && v->cur_speed != 0) {
|
if (_settings_game.vehicle.train_acceleration_model != AM_ORIGINAL && v->cur_speed != 0) {
|
||||||
ToggleBit(v->flags, VRF_REVERSING);
|
ToggleBit(v->flags, VRF_REVERSING);
|
||||||
} else {
|
} else {
|
||||||
v->cur_speed = 0;
|
v->cur_speed = 0;
|
||||||
|
@ -2941,8 +2941,10 @@ int Train::UpdateSpeed()
|
||||||
|
|
||||||
switch (_settings_game.vehicle.train_acceleration_model) {
|
switch (_settings_game.vehicle.train_acceleration_model) {
|
||||||
default: NOT_REACHED();
|
default: NOT_REACHED();
|
||||||
case TAM_ORIGINAL: accel = this->acceleration * (this->GetAccelerationStatus() == AS_BRAKE ? -4 : 2); break;
|
case AM_ORIGINAL:
|
||||||
case TAM_REALISTIC:
|
accel = this->acceleration * (this->GetAccelerationStatus() == AS_BRAKE ? -4 : 2);
|
||||||
|
break;
|
||||||
|
case AM_REALISTIC:
|
||||||
this->max_speed = this->GetCurrentMaxSpeed();
|
this->max_speed = this->GetCurrentMaxSpeed();
|
||||||
accel = this->GetAcceleration();
|
accel = this->GetAcceleration();
|
||||||
break;
|
break;
|
||||||
|
@ -3055,7 +3057,7 @@ static const RailtypeSlowdownParams _railtype_slowdown[] = {
|
||||||
/** 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(Train *v, byte old_z)
|
static inline void AffectSpeedByZChange(Train *v, byte old_z)
|
||||||
{
|
{
|
||||||
if (old_z == v->z_pos || _settings_game.vehicle.train_acceleration_model != TAM_ORIGINAL) return;
|
if (old_z == v->z_pos || _settings_game.vehicle.train_acceleration_model != AM_ORIGINAL) return;
|
||||||
|
|
||||||
const RailtypeSlowdownParams *rsp = &_railtype_slowdown[v->railtype];
|
const RailtypeSlowdownParams *rsp = &_railtype_slowdown[v->railtype];
|
||||||
|
|
||||||
|
@ -3451,7 +3453,7 @@ static void TrainController(Train *v, Vehicle *nomove)
|
||||||
update_signals_crossing = true;
|
update_signals_crossing = true;
|
||||||
|
|
||||||
if (chosen_dir != v->direction) {
|
if (chosen_dir != v->direction) {
|
||||||
if (prev == NULL && _settings_game.vehicle.train_acceleration_model == TAM_ORIGINAL) {
|
if (prev == NULL && _settings_game.vehicle.train_acceleration_model == AM_ORIGINAL) {
|
||||||
const RailtypeSlowdownParams *rsp = &_railtype_slowdown[v->railtype];
|
const RailtypeSlowdownParams *rsp = &_railtype_slowdown[v->railtype];
|
||||||
DirDiff diff = DirDifference(v->direction, chosen_dir);
|
DirDiff diff = DirDifference(v->direction, chosen_dir);
|
||||||
v->cur_speed -= (diff == DIRDIFF_45RIGHT || diff == DIRDIFF_45LEFT ? rsp->small_turn : rsp->large_turn) * v->cur_speed >> 8;
|
v->cur_speed -= (diff == DIRDIFF_45RIGHT || diff == DIRDIFF_45LEFT ? rsp->small_turn : rsp->large_turn) * v->cur_speed >> 8;
|
||||||
|
|
|
@ -1532,7 +1532,7 @@ struct VehicleDetailsWindow : Window {
|
||||||
SetDParam(1, Train::From(v)->tcache.cached_power);
|
SetDParam(1, Train::From(v)->tcache.cached_power);
|
||||||
SetDParam(0, Train::From(v)->tcache.cached_weight);
|
SetDParam(0, Train::From(v)->tcache.cached_weight);
|
||||||
SetDParam(3, Train::From(v)->tcache.cached_max_te / 1000);
|
SetDParam(3, Train::From(v)->tcache.cached_max_te / 1000);
|
||||||
DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, (_settings_game.vehicle.train_acceleration_model != TAM_ORIGINAL && GetRailTypeInfo(Train::From(v)->railtype)->acceleration_type != 2) ?
|
DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, (_settings_game.vehicle.train_acceleration_model != AM_ORIGINAL && GetRailTypeInfo(Train::From(v)->railtype)->acceleration_type != 2) ?
|
||||||
STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE : STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED);
|
STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE : STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -68,9 +68,10 @@ 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 {
|
/** Vehicle acceleration models. */
|
||||||
TAM_ORIGINAL,
|
enum AccelerationModel {
|
||||||
TAM_REALISTIC,
|
AM_ORIGINAL,
|
||||||
|
AM_REALISTIC,
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* VEHICLE_TYPE_H */
|
#endif /* VEHICLE_TYPE_H */
|
||||||
|
|
Loading…
Reference in New Issue