summaryrefslogtreecommitdiff
path: root/src/water_cmd.cpp
diff options
context:
space:
mode:
authormaedhros <maedhros@openttd.org>2007-06-11 14:00:16 +0000
committermaedhros <maedhros@openttd.org>2007-06-11 14:00:16 +0000
commit3e326085fa69da20e0a81182cbea4466016eb566 (patch)
tree890b370c5bc0ffbb3bd5a9eb55a4b0a3117acd29 /src/water_cmd.cpp
parentbe0f5cf877bb2d7a74855f8988e50ca09624aabe (diff)
downloadopenttd-3e326085fa69da20e0a81182cbea4466016eb566.tar.xz
(svn r10097) -Feature: Add support for articulated road vehicles, or callbacks 11 and 17 for
road vehicles for those who prefer the technical explanation.
Diffstat (limited to 'src/water_cmd.cpp')
-rw-r--r--src/water_cmd.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index 3d8758c01..e7841196a 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -23,6 +23,7 @@
#include "depot.h"
#include "vehicle_gui.h"
#include "train.h"
+#include "roadveh.h"
#include "water_map.h"
#include "newgrf.h"
#include "newgrf_canal.h"
@@ -641,21 +642,13 @@ static void FloodVehicle(Vehicle *v)
if (!(v->vehstatus & VS_CRASHED)) {
uint16 pass = 0;
- if (v->type == VEH_ROAD) { // flood bus/truck
- pass = 1; // driver
- 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
- RebuildVehicleLists();
- } else if (v->type == VEH_TRAIN) {
+ if (v->type == VEH_TRAIN || v->type == VEH_ROAD) {
Vehicle *u;
v = GetFirstVehicleInChain(v);
u = v;
- if (IsFrontEngine(v)) pass = 4; // driver
- /* crash all wagons, and count passangers */
+ /* crash all wagons, and count passengers */
BEGIN_ENUM_WAGONS(v)
if (IsCargoInClass(v->cargo_type, CC_PASSENGERS)) pass += v->cargo_count;
v->vehstatus |= VS_CRASHED;
@@ -663,7 +656,15 @@ static void FloodVehicle(Vehicle *v)
END_ENUM_WAGONS(v)
v = u;
- v->u.rail.crash_anim_pos = 4000; // max 4440, disappear pretty fast
+
+ if (v->type == VEH_TRAIN) {
+ if (IsFrontEngine(v)) pass += 4; // driver
+ v->u.rail.crash_anim_pos = 4000; // max 4440, disappear pretty fast
+ } else {
+ if (IsRoadVehFront(v)) pass += 1; // driver
+ v->u.road.crashed_ctr = 2000; // max 2220, disappear pretty fast
+ }
+
RebuildVehicleLists();
} else {
return;