mirror of https://github.com/OpenTTD/OpenTTD
(svn r7386) -Codechange r7385: moved deletion of the vehicle highlight from DeleteVehicle to the sell commands as they are not called as often
Also added a return to the window loop prevent looking at the rest of the windows once the right depot window is foundrelease/0.5
parent
686a0d7750
commit
4adc6ba4f8
|
@ -417,6 +417,7 @@ static void DoDeleteAircraft(Vehicle *v)
|
||||||
DeleteWindowById(WC_VEHICLE_VIEW, v->index);
|
DeleteWindowById(WC_VEHICLE_VIEW, v->index);
|
||||||
RebuildVehicleLists();
|
RebuildVehicleLists();
|
||||||
InvalidateWindow(WC_COMPANY, v->owner);
|
InvalidateWindow(WC_COMPANY, v->owner);
|
||||||
|
DeleteDepotHighlightOfVehicle(v);
|
||||||
DeleteVehicleChain(v);
|
DeleteVehicleChain(v);
|
||||||
InvalidateWindowClasses(WC_AIRCRAFT_LIST);
|
InvalidateWindowClasses(WC_AIRCRAFT_LIST);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1049,5 +1049,6 @@ void DeleteDepotHighlightOfVehicle(const Vehicle *v)
|
||||||
WP(w, depot_d).sel = INVALID_VEHICLE;
|
WP(w, depot_d).sel = INVALID_VEHICLE;
|
||||||
ResetObjectToPlace();
|
ResetObjectToPlace();
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -283,6 +283,7 @@ int32 CmdSellRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
InvalidateWindow(WC_COMPANY, v->owner);
|
InvalidateWindow(WC_COMPANY, v->owner);
|
||||||
DeleteWindowById(WC_VEHICLE_VIEW, v->index);
|
DeleteWindowById(WC_VEHICLE_VIEW, v->index);
|
||||||
ClearSlot(v);
|
ClearSlot(v);
|
||||||
|
DeleteDepotHighlightOfVehicle(v);
|
||||||
DeleteVehicle(v);
|
DeleteVehicle(v);
|
||||||
if (IsLocalPlayer()) InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Road);
|
if (IsLocalPlayer()) InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Road);
|
||||||
}
|
}
|
||||||
|
|
|
@ -920,6 +920,7 @@ int32 CmdSellShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
RebuildVehicleLists();
|
RebuildVehicleLists();
|
||||||
InvalidateWindow(WC_COMPANY, v->owner);
|
InvalidateWindow(WC_COMPANY, v->owner);
|
||||||
DeleteWindowById(WC_VEHICLE_VIEW, v->index);
|
DeleteWindowById(WC_VEHICLE_VIEW, v->index);
|
||||||
|
DeleteDepotHighlightOfVehicle(v);
|
||||||
DeleteVehicle(v);
|
DeleteVehicle(v);
|
||||||
if (IsLocalPlayer())
|
if (IsLocalPlayer())
|
||||||
InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Ship); // updates the replace Ship window
|
InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Ship); // updates the replace Ship window
|
||||||
|
|
|
@ -1373,6 +1373,7 @@ int32 CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
cost -= rear->value;
|
cost -= rear->value;
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
UnlinkWagon(rear, first);
|
UnlinkWagon(rear, first);
|
||||||
|
DeleteDepotHighlightOfVehicle(rear);
|
||||||
DeleteVehicle(rear);
|
DeleteVehicle(rear);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1417,6 +1418,7 @@ int32 CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
cost -= v->value;
|
cost -= v->value;
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
first = UnlinkWagon(v, first);
|
first = UnlinkWagon(v, first);
|
||||||
|
DeleteDepotHighlightOfVehicle(v);
|
||||||
DeleteVehicle(v);
|
DeleteVehicle(v);
|
||||||
|
|
||||||
/* 4 If the second wagon was an engine, update it to front_engine
|
/* 4 If the second wagon was an engine, update it to front_engine
|
||||||
|
@ -1463,6 +1465,7 @@ int32 CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
cost -= rear->value;
|
cost -= rear->value;
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
first = UnlinkWagon(rear, first);
|
first = UnlinkWagon(rear, first);
|
||||||
|
DeleteDepotHighlightOfVehicle(rear);
|
||||||
DeleteVehicle(rear);
|
DeleteVehicle(rear);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1475,6 +1478,7 @@ int32 CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||||
cost -= v->value;
|
cost -= v->value;
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
first = UnlinkWagon(v, first);
|
first = UnlinkWagon(v, first);
|
||||||
|
DeleteDepotHighlightOfVehicle(v);
|
||||||
DeleteVehicle(v);
|
DeleteVehicle(v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -566,8 +566,6 @@ void DestroyVehicle(Vehicle *v)
|
||||||
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteDepotHighlightOfVehicle(v);
|
|
||||||
|
|
||||||
UpdateVehiclePosHash(v, INVALID_COORD, 0);
|
UpdateVehiclePosHash(v, INVALID_COORD, 0);
|
||||||
v->next_hash = INVALID_VEHICLE;
|
v->next_hash = INVALID_VEHICLE;
|
||||||
if (v->orders != NULL) DeleteVehicleOrders(v);
|
if (v->orders != NULL) DeleteVehicleOrders(v);
|
||||||
|
|
Loading…
Reference in New Issue