(svn r12332) -Fix (r12331): Invalidate cached data and update image after setting flag.

This commit is contained in:
peter1138 2008-03-03 21:42:37 +00:00
parent b64f637c72
commit 6bb37edfb6

View File

@ -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);