summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2010-01-30 16:27:35 +0000
committerterkhen <terkhen@openttd.org>2010-01-30 16:27:35 +0000
commit272f2cd93e2e979d742bc48e24d5d2ed7066a98d (patch)
tree84f5ecc3f95d2e875c7d8a9d32e4e2b6a7d8fc2b
parent815eede0be2fda9b3ab1fb312bd9e5e1e407894a (diff)
downloadopenttd-272f2cd93e2e979d742bc48e24d5d2ed7066a98d.tar.xz
(svn r18963) -Codechange: Give AccelerationModel a generical name.
-rw-r--r--src/build_vehicle_gui.cpp2
-rw-r--r--src/engine_gui.cpp2
-rw-r--r--src/train_cmd.cpp14
-rw-r--r--src/vehicle_gui.cpp2
-rw-r--r--src/vehicle_type.h7
5 files changed, 15 insertions, 12 deletions
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index b98792e45..a68ab9f23 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -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;
diff --git a/src/engine_gui.cpp b/src/engine_gui.cpp
index 41790b384..5ca6e873a 100644
--- a/src/engine_gui.cpp
+++ b/src/engine_gui.cpp
@@ -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)
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index b3f4f9801..6eecf5e5b 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -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;
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 76079d955..dba4e05eb 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -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;
diff --git a/src/vehicle_type.h b/src/vehicle_type.h
index 0ccc37e29..e384761db 100644
--- a/src/vehicle_type.h
+++ b/src/vehicle_type.h
@@ -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 */