summaryrefslogtreecommitdiff
path: root/src/ground_vehicle.hpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2011-01-21 16:20:55 +0000
committersmatz <smatz@openttd.org>2011-01-21 16:20:55 +0000
commite308c348f0f1dad5d18349aba5c19a2a4b372df3 (patch)
tree0820ee7eec787cc4745488959df4a7100b8e7107 /src/ground_vehicle.hpp
parent46dfdfd72b08191d408ad1a1417d8077020893a7 (diff)
downloadopenttd-e308c348f0f1dad5d18349aba5c19a2a4b372df3.tar.xz
(svn r21879) -Codechange: reset vehicle's GOINGUP/DOWN bits when it crashes
Diffstat (limited to 'src/ground_vehicle.hpp')
-rw-r--r--src/ground_vehicle.hpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/ground_vehicle.hpp b/src/ground_vehicle.hpp
index 503cddf13..7e2894f5b 100644
--- a/src/ground_vehicle.hpp
+++ b/src/ground_vehicle.hpp
@@ -87,6 +87,21 @@ struct GroundVehicle : public SpecializedVehicle<T, Type> {
int GetAcceleration() const;
/**
+ * Common code executed for crashed ground vehicles
+ * @param flooded was this vehicle flooded?
+ * @return number of victims
+ */
+ /* virtual */ uint Crash(bool flooded)
+ {
+ /* Crashed vehicles aren't going up or down */
+ for (T *v = T::From(this); v != NULL; v = v->Next()) {
+ ClrBit(v->gv_flags, GVF_GOINGUP_BIT);
+ ClrBit(v->gv_flags, GVF_GOINGDOWN_BIT);
+ }
+ return this->Vehicle::Crash(flooded);
+ }
+
+ /**
* Calculates the total slope resistance for this vehicle.
* @return Slope resistance.
*/