(svn r18963) -Codechange: Give AccelerationModel a generical name.

This commit is contained in:
terkhen 2010-01-30 16:27:35 +00:00
parent 815eede0be
commit 272f2cd93e
5 changed files with 15 additions and 12 deletions

View File

@ -479,7 +479,7 @@ static int DrawRailEnginePurchaseInfo(int left, int right, int y, EngineID engin
y += FONT_HEIGHT_NORMAL;
/* 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());
DrawString(left, right, y, STR_PURCHASE_INFO_MAX_TE);
y += FONT_HEIGHT_NORMAL;

View File

@ -161,7 +161,7 @@ static StringID GetTrainEngineInfoString(const Engine *e)
} else {
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)

View File

@ -392,7 +392,7 @@ int Train::GetCurveSpeedLimit() const
static const int absolute_max_speed = UINT16_MAX;
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};
@ -1989,7 +1989,7 @@ CommandCost CmdReverseTrainDirection(TileIndex tile, DoCommandFlag flags, uint32
v->force_proceed = 0;
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);
} else {
v->cur_speed = 0;
@ -2941,8 +2941,10 @@ int Train::UpdateSpeed()
switch (_settings_game.vehicle.train_acceleration_model) {
default: NOT_REACHED();
case TAM_ORIGINAL: accel = this->acceleration * (this->GetAccelerationStatus() == AS_BRAKE ? -4 : 2); break;
case TAM_REALISTIC:
case AM_ORIGINAL:
accel = this->acceleration * (this->GetAccelerationStatus() == AS_BRAKE ? -4 : 2);
break;
case AM_REALISTIC:
this->max_speed = this->GetCurrentMaxSpeed();
accel = this->GetAcceleration();
break;
@ -3055,7 +3057,7 @@ static const RailtypeSlowdownParams _railtype_slowdown[] = {
/** Modify the speed of the vehicle due to a change in altitude */
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];
@ -3451,7 +3453,7 @@ static void TrainController(Train *v, Vehicle *nomove)
update_signals_crossing = true;
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];
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;

View File

@ -1532,7 +1532,7 @@ struct VehicleDetailsWindow : Window {
SetDParam(1, Train::From(v)->tcache.cached_power);
SetDParam(0, Train::From(v)->tcache.cached_weight);
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);
break;

View File

@ -68,9 +68,10 @@ enum {
MAX_LENGTH_VEHICLE_NAME_PIXELS = 150, ///< The maximum length of a vehicle name in pixels
};
enum TrainAccelerationModel {
TAM_ORIGINAL,
TAM_REALISTIC,
/** Vehicle acceleration models. */
enum AccelerationModel {
AM_ORIGINAL,
AM_REALISTIC,
};
#endif /* VEHICLE_TYPE_H */