summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2007-03-19 12:40:51 +0000
committerpeter1138 <peter1138@openttd.org>2007-03-19 12:40:51 +0000
commit5a2236dd84bac889183e8d78c204fea81dfc51ea (patch)
treea10625a2d9e0cf0db16b2a3e0a79c409a64c197d /src
parentccd448b72fc1c3f0c39b90ce35c722de33e547c6 (diff)
downloadopenttd-5a2236dd84bac889183e8d78c204fea81dfc51ea.tar.xz
(svn r9322) -Codechange: Use cargo class to count crash/flood victims
Diffstat (limited to 'src')
-rw-r--r--src/aircraft_cmd.cpp2
-rw-r--r--src/train_cmd.cpp2
-rw-r--r--src/water_cmd.cpp5
3 files changed, 4 insertions, 5 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index b7c3de562..74ab23e66 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -1369,7 +1369,7 @@ static void CrashAirplane(Vehicle *v)
InvalidateWindow(WC_VEHICLE_VIEW, v->index);
uint amt = 2;
- if (v->cargo_type == CT_PASSENGERS) amt += v->cargo_count;
+ if (IsCargoInClass(v->cargo_type, CC_PASSENGERS)) amt += v->cargo_count;
SetDParam(0, amt);
v->cargo_count = 0;
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 955548264..676a43396 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -2815,7 +2815,7 @@ static uint CountPassengersInTrain(const Vehicle* v)
{
uint num = 0;
BEGIN_ENUM_WAGONS(v)
- if (v->cargo_type == CT_PASSENGERS) num += v->cargo_count;
+ if (IsCargoInClass(v->cargo_type, CC_PASSENGERS)) num += v->cargo_count;
END_ENUM_WAGONS(v)
return num;
}
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index 5643aa8fe..87713d0b5 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -614,8 +614,7 @@ static void FloodVehicle(Vehicle *v)
if (v->type == VEH_ROAD) { // flood bus/truck
pass = 1; // driver
- if (v->cargo_type == CT_PASSENGERS)
- pass += v->cargo_count;
+ if (IsCargoInClass(v->cargo_type, CC_PASSENGERS)) pass += v->cargo_count;
v->vehstatus |= VS_CRASHED;
v->u.road.crashed_ctr = 2000; // max 2220, disappear pretty fast
@@ -629,7 +628,7 @@ static void FloodVehicle(Vehicle *v)
// crash all wagons, and count passangers
BEGIN_ENUM_WAGONS(v)
- if (v->cargo_type == CT_PASSENGERS) pass += v->cargo_count;
+ if (IsCargoInClass(v->cargo_type, CC_PASSENGERS)) pass += v->cargo_count;
v->vehstatus |= VS_CRASHED;
MarkAllViewportsDirty(v->left_coord, v->top_coord, v->right_coord + 1, v->bottom_coord + 1);
END_ENUM_WAGONS(v)