summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-01-13 14:42:28 +0000
committersmatz <smatz@openttd.org>2008-01-13 14:42:28 +0000
commit8da51e5eb27264b6e11f25f1ccc95a04e49c9435 (patch)
treedace4c92573c25f8d5e8f59818e250f36bd0245a
parentdc87b05e8c61b03d5fb2246768ce58bf66edf93a (diff)
downloadopenttd-8da51e5eb27264b6e11f25f1ccc95a04e49c9435.tar.xz
(svn r11835) -Fix: mark depot, viewports, vehicle lists and vehicle details dirty when a train crashes
-rw-r--r--src/train_cmd.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index c2171d0fa..ff14739d9 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -2779,12 +2779,19 @@ static void SetVehicleCrashed(Vehicle *v)
v->u.rail.crash_anim_pos++;
- Vehicle *u = v;
+ InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
+ InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
+
+ if (v->u.rail.track == TRACK_BIT_DEPOT) {
+ InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
+ }
+
+ RebuildVehicleLists();
+
BEGIN_ENUM_WAGONS(v)
v->vehstatus |= VS_CRASHED;
+ MarkAllViewportsDirty(v->left_coord, v->top_coord, v->right_coord + 1, v->bottom_coord + 1);
END_ENUM_WAGONS(v)
-
- InvalidateWindowWidget(WC_VEHICLE_VIEW, u->index, STATUS_BAR);
}
static uint CountPassengersInTrain(const Vehicle* v)