(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:
bjarni 2006-12-05 22:59:42 +00:00
parent 686a0d7750
commit 4adc6ba4f8
6 changed files with 8 additions and 2 deletions

View File

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

View File

@ -1049,5 +1049,6 @@ void DeleteDepotHighlightOfVehicle(const Vehicle *v)
WP(w, depot_d).sel = INVALID_VEHICLE;
ResetObjectToPlace();
}
return;
}
}

View File

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

View File

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

View File

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

View File

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