mirror of https://github.com/OpenTTD/OpenTTD
(svn r11831) -Fix: call TrainConsistChanged() when removing crashed train part to be consistent with saveload process
parent
cc52a56052
commit
b0c34f4d62
|
@ -3107,6 +3107,8 @@ reverse_train_direction:
|
||||||
*/
|
*/
|
||||||
static void DeleteLastWagon(Vehicle *v)
|
static void DeleteLastWagon(Vehicle *v)
|
||||||
{
|
{
|
||||||
|
Vehicle *first = v->First();
|
||||||
|
|
||||||
/* Go to the last wagon and delete the link pointing there
|
/* Go to the last wagon and delete the link pointing there
|
||||||
* *u is then the one-before-last wagon, and *v the last
|
* *u is then the one-before-last wagon, and *v the last
|
||||||
* one which will physicially be removed */
|
* one which will physicially be removed */
|
||||||
|
@ -3114,14 +3116,23 @@ static void DeleteLastWagon(Vehicle *v)
|
||||||
for (; v->Next() != NULL; v = v->Next()) u = v;
|
for (; v->Next() != NULL; v = v->Next()) u = v;
|
||||||
u->SetNext(NULL);
|
u->SetNext(NULL);
|
||||||
|
|
||||||
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
|
if (first == v) {
|
||||||
DeleteWindowById(WC_VEHICLE_VIEW, v->index);
|
/* Removing front vehicle (the last to go) */
|
||||||
RebuildVehicleLists();
|
DeleteWindowById(WC_VEHICLE_VIEW, v->index);
|
||||||
InvalidateWindow(WC_COMPANY, v->owner);
|
InvalidateWindow(WC_COMPANY, v->owner);
|
||||||
if (v->u.rail.track == TRACK_BIT_DEPOT) {
|
} else {
|
||||||
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
|
/* Recalculate cached train properties */
|
||||||
|
TrainConsistChanged(first);
|
||||||
|
InvalidateWindow(WC_VEHICLE_DETAILS, first->index);
|
||||||
|
/* Update the depot window if the first vehicle is in depot -
|
||||||
|
* if v == first, then it is updated in PreDestructor() */
|
||||||
|
if (first->u.rail.track == TRACK_BIT_DEPOT) {
|
||||||
|
InvalidateWindow(WC_VEHICLE_DEPOT, first->tile);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RebuildVehicleLists();
|
||||||
|
|
||||||
BeginVehicleMove(v);
|
BeginVehicleMove(v);
|
||||||
EndVehicleMove(v);
|
EndVehicleMove(v);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue