From 457930c4831f6d842be11df407e19d86e27ebcf2 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Mon, 19 Mar 2007 12:40:51 +0000 Subject: (svn r9322) -Codechange: Use cargo class to count crash/flood victims --- src/aircraft_cmd.cpp | 2 +- src/train_cmd.cpp | 2 +- src/water_cmd.cpp | 5 ++--- 3 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src') 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) -- cgit v1.2.3-70-g09d2