diff options
author | peter1138 <peter1138@openttd.org> | 2008-03-03 21:42:37 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2008-03-03 21:42:37 +0000 |
commit | 11c8050e3ff4a9cd222769a73a5b142f6ecfe3f6 (patch) | |
tree | f720e4d3bebcc64d42356d23598cfac47b36e2ee /src | |
parent | d9d601b1cae5071922d9b3255af611c19c5a4edc (diff) | |
download | openttd-11c8050e3ff4a9cd222769a73a5b142f6ecfe3f6.tar.xz |
(svn r12332) -Fix (r12331): Invalidate cached data and update image after setting flag.
Diffstat (limited to 'src')
-rw-r--r-- | src/train_cmd.cpp | 13 |
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); |