(svn r9322) -Codechange: Use cargo class to count crash/flood victims
This commit is contained in:
@@ -1369,7 +1369,7 @@ static void CrashAirplane(Vehicle *v)
|
|||||||
InvalidateWindow(WC_VEHICLE_VIEW, v->index);
|
InvalidateWindow(WC_VEHICLE_VIEW, v->index);
|
||||||
|
|
||||||
uint amt = 2;
|
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);
|
SetDParam(0, amt);
|
||||||
|
|
||||||
v->cargo_count = 0;
|
v->cargo_count = 0;
|
||||||
|
@@ -2815,7 +2815,7 @@ static uint CountPassengersInTrain(const Vehicle* v)
|
|||||||
{
|
{
|
||||||
uint num = 0;
|
uint num = 0;
|
||||||
BEGIN_ENUM_WAGONS(v)
|
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)
|
END_ENUM_WAGONS(v)
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
@@ -614,8 +614,7 @@ static void FloodVehicle(Vehicle *v)
|
|||||||
|
|
||||||
if (v->type == VEH_ROAD) { // flood bus/truck
|
if (v->type == VEH_ROAD) { // flood bus/truck
|
||||||
pass = 1; // driver
|
pass = 1; // driver
|
||||||
if (v->cargo_type == CT_PASSENGERS)
|
if (IsCargoInClass(v->cargo_type, CC_PASSENGERS)) pass += v->cargo_count;
|
||||||
pass += v->cargo_count;
|
|
||||||
|
|
||||||
v->vehstatus |= VS_CRASHED;
|
v->vehstatus |= VS_CRASHED;
|
||||||
v->u.road.crashed_ctr = 2000; // max 2220, disappear pretty fast
|
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
|
// crash all wagons, and count passangers
|
||||||
BEGIN_ENUM_WAGONS(v)
|
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;
|
v->vehstatus |= VS_CRASHED;
|
||||||
MarkAllViewportsDirty(v->left_coord, v->top_coord, v->right_coord + 1, v->bottom_coord + 1);
|
MarkAllViewportsDirty(v->left_coord, v->top_coord, v->right_coord + 1, v->bottom_coord + 1);
|
||||||
END_ENUM_WAGONS(v)
|
END_ENUM_WAGONS(v)
|
||||||
|
Reference in New Issue
Block a user