summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-12-05 22:59:42 +0000
committerbjarni <bjarni@openttd.org>2006-12-05 22:59:42 +0000
commit4adc6ba4f853d1b11994948f2653ddb618da36bb (patch)
tree7833c716fc42b444f89413faa48f18b9ce21ecea
parent686a0d7750405d10088a23732f33359728039aa5 (diff)
downloadopenttd-4adc6ba4f853d1b11994948f2653ddb618da36bb.tar.xz
(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
-rw-r--r--aircraft_cmd.c1
-rw-r--r--depot_gui.c1
-rw-r--r--roadveh_cmd.c1
-rw-r--r--ship_cmd.c1
-rw-r--r--train_cmd.c4
-rw-r--r--vehicle.c2
6 files changed, 8 insertions, 2 deletions
diff --git a/aircraft_cmd.c b/aircraft_cmd.c
index 9f65f72e3..4fa4fc3f9 100644
--- a/aircraft_cmd.c
+++ b/aircraft_cmd.c
@@ -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);
}
diff --git a/depot_gui.c b/depot_gui.c
index c0ee00ddc..7bb94e3e6 100644
--- a/depot_gui.c
+++ b/depot_gui.c
@@ -1049,5 +1049,6 @@ void DeleteDepotHighlightOfVehicle(const Vehicle *v)
WP(w, depot_d).sel = INVALID_VEHICLE;
ResetObjectToPlace();
}
+ return;
}
}
diff --git a/roadveh_cmd.c b/roadveh_cmd.c
index d9e365508..c53dbeb97 100644
--- a/roadveh_cmd.c
+++ b/roadveh_cmd.c
@@ -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);
}
diff --git a/ship_cmd.c b/ship_cmd.c
index b81ee457f..c7e6f9c3a 100644
--- a/ship_cmd.c
+++ b/ship_cmd.c
@@ -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
diff --git a/train_cmd.c b/train_cmd.c
index 69ae01daa..a1792deb5 100644
--- a/train_cmd.c
+++ b/train_cmd.c
@@ -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);
}
}
diff --git a/vehicle.c b/vehicle.c
index 0cf909efb..9c657483c 100644
--- a/vehicle.c
+++ b/vehicle.c
@@ -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);