summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-09-07 22:23:25 +0000
committersmatz <smatz@openttd.org>2008-09-07 22:23:25 +0000
commit8d85d8bf97c061cbcb04033bb74cfdf092e98365 (patch)
tree25ff74054214907b5660991fb9f82cf02eb305be /src
parent85b1ae6ad7bf2dbd9dd1556b71aa3a453922aed0 (diff)
downloadopenttd-8d85d8bf97c061cbcb04033bb74cfdf092e98365.tar.xz
(svn r14270) -Fix: make small UFO aware of articulated RVs
Diffstat (limited to 'src')
-rw-r--r--src/disaster_cmd.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/disaster_cmd.cpp b/src/disaster_cmd.cpp
index 4e4616d32..fba812766 100644
--- a/src/disaster_cmd.cpp
+++ b/src/disaster_cmd.cpp
@@ -40,6 +40,7 @@
#include "vehicle_base.h"
#include "sound_func.h"
#include "effectvehicle_func.h"
+#include "roadveh.h"
#include "table/strings.h"
#include "table/sprites.h"
@@ -330,7 +331,7 @@ static void DisasterTick_Ufo(Vehicle *v)
v->current_order.SetDestination(1);
FOR_ALL_VEHICLES(u) {
- if (u->type == VEH_ROAD && IsHumanPlayer(u->owner)) {
+ if (u->type == VEH_ROAD && IsRoadVehFront(u) && IsHumanPlayer(u->owner)) {
v->dest_tile = u->index;
v->age = 0;
return;
@@ -341,7 +342,7 @@ static void DisasterTick_Ufo(Vehicle *v)
} else {
/* Target a vehicle */
u = GetVehicle(v->dest_tile);
- if (u->type != VEH_ROAD) {
+ if (u->type != VEH_ROAD || !IsRoadVehFront(u)) {
DeleteDisasterVeh(v);
return;
}
@@ -364,12 +365,16 @@ static void DisasterTick_Ufo(Vehicle *v)
v->age++;
if (u->u.road.crashed_ctr == 0) {
u->u.road.crashed_ctr++;
- u->vehstatus |= VS_CRASHED;
AddNewsItem(STR_B001_ROAD_VEHICLE_DESTROYED,
NS_ACCIDENT_VEHICLE,
u->index,
0);
+
+ for (Vehicle *w = u; w != NULL; w = w->Next()) {
+ w->vehstatus |= VS_CRASHED;
+ MarkSingleVehicleDirty(w);
+ }
}
}