mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-14 18:19:11 +00:00
(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 found
This commit is contained in:
@@ -417,6 +417,7 @@ static void DoDeleteAircraft(Vehicle *v)
|
||||
DeleteWindowById(WC_VEHICLE_VIEW, v->index);
|
||||
RebuildVehicleLists();
|
||||
InvalidateWindow(WC_COMPANY, v->owner);
|
||||
DeleteDepotHighlightOfVehicle(v);
|
||||
DeleteVehicleChain(v);
|
||||
InvalidateWindowClasses(WC_AIRCRAFT_LIST);
|
||||
}
|
||||
|
@@ -1049,5 +1049,6 @@ void DeleteDepotHighlightOfVehicle(const Vehicle *v)
|
||||
WP(w, depot_d).sel = INVALID_VEHICLE;
|
||||
ResetObjectToPlace();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@@ -283,6 +283,7 @@ int32 CmdSellRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
InvalidateWindow(WC_COMPANY, v->owner);
|
||||
DeleteWindowById(WC_VEHICLE_VIEW, v->index);
|
||||
ClearSlot(v);
|
||||
DeleteDepotHighlightOfVehicle(v);
|
||||
DeleteVehicle(v);
|
||||
if (IsLocalPlayer()) InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Road);
|
||||
}
|
||||
|
@@ -920,6 +920,7 @@ int32 CmdSellShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
RebuildVehicleLists();
|
||||
InvalidateWindow(WC_COMPANY, v->owner);
|
||||
DeleteWindowById(WC_VEHICLE_VIEW, v->index);
|
||||
DeleteDepotHighlightOfVehicle(v);
|
||||
DeleteVehicle(v);
|
||||
if (IsLocalPlayer())
|
||||
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;
|
||||
if (flags & DC_EXEC) {
|
||||
UnlinkWagon(rear, first);
|
||||
DeleteDepotHighlightOfVehicle(rear);
|
||||
DeleteVehicle(rear);
|
||||
}
|
||||
}
|
||||
@@ -1417,6 +1418,7 @@ int32 CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
cost -= v->value;
|
||||
if (flags & DC_EXEC) {
|
||||
first = UnlinkWagon(v, first);
|
||||
DeleteDepotHighlightOfVehicle(v);
|
||||
DeleteVehicle(v);
|
||||
|
||||
/* 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;
|
||||
if (flags & DC_EXEC) {
|
||||
first = UnlinkWagon(rear, first);
|
||||
DeleteDepotHighlightOfVehicle(rear);
|
||||
DeleteVehicle(rear);
|
||||
}
|
||||
}
|
||||
@@ -1475,6 +1478,7 @@ int32 CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
||||
cost -= v->value;
|
||||
if (flags & DC_EXEC) {
|
||||
first = UnlinkWagon(v, first);
|
||||
DeleteDepotHighlightOfVehicle(v);
|
||||
DeleteVehicle(v);
|
||||
}
|
||||
}
|
||||
|
@@ -566,8 +566,6 @@ void DestroyVehicle(Vehicle *v)
|
||||
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
||||
}
|
||||
|
||||
DeleteDepotHighlightOfVehicle(v);
|
||||
|
||||
UpdateVehiclePosHash(v, INVALID_COORD, 0);
|
||||
v->next_hash = INVALID_VEHICLE;
|
||||
if (v->orders != NULL) DeleteVehicleOrders(v);
|
||||
|
Reference in New Issue
Block a user