mirror of https://github.com/OpenTTD/OpenTTD
(svn r12332) -Fix (r12331): Invalidate cached data and update image after setting flag.
parent
b64f637c72
commit
6bb37edfb6
|
@ -1786,14 +1786,17 @@ static void ReverseTrainDirection(Vehicle *v)
|
||||||
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* update all images */
|
/* set reversed flag on all parts */
|
||||||
for (Vehicle *u = v; u != NULL; u = u->Next()) {
|
for (Vehicle *u = v; u != NULL; u = u->Next()) ToggleBit(u->u.rail.flags, VRF_TOGGLE_REVERSE);
|
||||||
ToggleBit(u->u.rail.flags, VRF_TOGGLE_REVERSE);
|
|
||||||
u->cur_image = u->GetImage(u->direction);
|
|
||||||
}
|
|
||||||
|
|
||||||
ClrBit(v->u.rail.flags, VRF_REVERSING);
|
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 */
|
/* update crossing we were approaching */
|
||||||
if (crossing != INVALID_TILE) UpdateLevelCrossing(crossing);
|
if (crossing != INVALID_TILE) UpdateLevelCrossing(crossing);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue