summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-03-03 21:42:37 +0000
committerpeter1138 <peter1138@openttd.org>2008-03-03 21:42:37 +0000
commit6bb37edfb6c6bdcff75a284d536e4ce52e022af8 (patch)
treef720e4d3bebcc64d42356d23598cfac47b36e2ee
parentb64f637c720add4799c38c62b82c2858cdae9e0a (diff)
downloadopenttd-6bb37edfb6c6bdcff75a284d536e4ce52e022af8.tar.xz
(svn r12332) -Fix (r12331): Invalidate cached data and update image after setting flag.
-rw-r--r--src/train_cmd.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index f513fbc01..38c35609a 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -1786,14 +1786,17 @@ static void ReverseTrainDirection(Vehicle *v)
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
}
- /* update all images */
- for (Vehicle *u = v; u != NULL; u = u->Next()) {
- ToggleBit(u->u.rail.flags, VRF_TOGGLE_REVERSE);
- u->cur_image = u->GetImage(u->direction);
- }
+ /* set reversed flag on all parts */
+ for (Vehicle *u = v; u != NULL; u = u->Next()) ToggleBit(u->u.rail.flags, VRF_TOGGLE_REVERSE);
ClrBit(v->u.rail.flags, VRF_REVERSING);
+ /* recalculate cached data */
+ TrainConsistChanged(v);
+
+ /* update all images */
+ for (Vehicle *u = v; u != NULL; u = u->Next()) u->cur_image = u->GetImage(u->direction);
+
/* update crossing we were approaching */
if (crossing != INVALID_TILE) UpdateLevelCrossing(crossing);