(svn r6647) -Fix: [vehicle list windows] Lists of shared orders are now no longer closed by a window event if the list is empty

The window is now closed when the order is deleted.
   This is because removing windows from a window event is asking for problems
This commit is contained in:
bjarni
2006-10-05 08:27:40 +00:00
parent ff6f83b56c
commit 55c7840710
2 changed files with 18 additions and 5 deletions

View File

@@ -1124,7 +1124,21 @@ void DeleteVehicleOrders(Vehicle *v)
v->orders = NULL;
v->num_orders = 0;
while (cur != NULL) {
if (cur != NULL) {
/* Delete the vehicle list of shared orders, if any */
int window_type = 0;
switch (v->type) {
case VEH_Train: window_type = WC_TRAINS_LIST; break;
case VEH_Road: window_type = WC_ROADVEH_LIST; break;
case VEH_Ship: window_type = WC_SHIPS_LIST; break;
case VEH_Aircraft: window_type = WC_AIRCRAFT_LIST; break;
default: NOT_REACHED();
}
DeleteWindowById(window_type, (cur->index << 16) | (v->type << 11) | VLW_SHARED_ORDERS | v->owner);
}
while (cur != NULL) {
next = cur->next;
DeleteOrder(cur);
cur = next;