summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-10-16 07:58:15 +0000
committertron <tron@openttd.org>2005-10-16 07:58:15 +0000
commitd318f3763ad44fff235ab132c11797090b5499c6 (patch)
tree5912bf3a8bf0bea7deea304df7fdeb59ea13ce19
parent10489083c7512fa91c427b02852fd88028a470d1 (diff)
downloadopenttd-d318f3763ad44fff235ab132c11797090b5499c6.tar.xz
(svn r3048) Replace 0/1/2 by RAILTYPE_RAIL/MONO/MAGLEV where appropriate
-rw-r--r--engine_gui.c9
-rw-r--r--train_cmd.c20
-rw-r--r--vehicle_gui.c2
3 files changed, 15 insertions, 16 deletions
diff --git a/engine_gui.c b/engine_gui.c
index 606b5909e..54d0395f7 100644
--- a/engine_gui.c
+++ b/engine_gui.c
@@ -19,12 +19,9 @@ static StringID GetEngineCategoryName(EngineID engine)
{
if (engine < NUM_TRAIN_ENGINES) {
switch (GetEngine(engine)->railtype) {
- case 0:
- return STR_8102_RAILROAD_LOCOMOTIVE;
- case 1:
- return STR_8106_MONORAIL_LOCOMOTIVE;
- case 2:
- return STR_8107_MAGLEV_LOCOMOTIVE;
+ case RAILTYPE_RAIL: return STR_8102_RAILROAD_LOCOMOTIVE;
+ case RAILTYPE_MONO: return STR_8106_MONORAIL_LOCOMOTIVE;
+ case RAILTYPE_MAGLEV: return STR_8107_MAGLEV_LOCOMOTIVE;
}
}
diff --git a/train_cmd.c b/train_cmd.c
index d01bfb767..b643505c5 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -291,7 +291,7 @@ static int GetTrainAcceleration(Vehicle *v, bool mode)
v->max_speed = max_speed;
- if (v->u.rail.railtype != 2) {
+ if (v->u.rail.railtype != RAILTYPE_MAGLEV) {
resistance = 13 * mass / 10;
resistance += 60 * num;
resistance += friction * mass * speed / 1000;
@@ -303,14 +303,14 @@ static int GetTrainAcceleration(Vehicle *v, bool mode)
if (speed > 0) {
switch (v->u.rail.railtype) {
- case 0:
- case 1:
+ case RAILTYPE_RAIL:
+ case RAILTYPE_MONO:
force = power / speed; //[N]
force *= 22;
force /= 10;
break;
- case 2:
+ case RAILTYPE_MAGLEV:
force = power / 25;
break;
}
@@ -321,7 +321,7 @@ static int GetTrainAcceleration(Vehicle *v, bool mode)
if (force <= 0) force = 10000;
- if (v->u.rail.railtype != 2) force = min(force, mass * 10 * 200);
+ if (v->u.rail.railtype != RAILTYPE_MAGLEV) force = min(force, mass * 10 * 200);
if (mode == AM_ACCEL) {
return (force - resistance) / (mass * 4);
@@ -1743,7 +1743,7 @@ static void HandleLocomotiveSmokeCloud(Vehicle *v)
// no smoke?
if (RailVehInfo(engtype)->flags & 2 ||
- GetEngine(engtype)->railtype > 0 ||
+ GetEngine(engtype)->railtype > RAILTYPE_RAIL ||
(v->vehstatus & VS_HIDDEN) || (v->u.rail.track & 0xC0))
continue;
@@ -1788,13 +1788,15 @@ static void TrainPlayLeaveStationSound(Vehicle *v)
EngineID engtype = v->engine_type;
switch (GetEngine(engtype)->railtype) {
- case 0:
+ case RAILTYPE_RAIL:
SndPlayVehicleFx(sfx[RailVehInfo(engtype)->engclass], v);
break;
- case 1:
+
+ case RAILTYPE_MONO:
SndPlayVehicleFx(SND_47_MAGLEV_2, v);
break;
- case 2:
+
+ case RAILTYPE_MAGLEV:
SndPlayVehicleFx(SND_41_MAGLEV, v);
break;
}
diff --git a/vehicle_gui.c b/vehicle_gui.c
index 475c73f5a..77a872752 100644
--- a/vehicle_gui.c
+++ b/vehicle_gui.c
@@ -175,7 +175,7 @@ void SortVehicleList(vehiclelist_d *vl)
/* General Vehicle GUI based procedures that are independent of vehicle types */
void InitializeVehiclesGuiList(void)
{
- _railtype_selected_in_replace_gui = 0;
+ _railtype_selected_in_replace_gui = RAILTYPE_RAIL;
}
// draw the vehicle profit button in the vehicle list window.