diff options
author | bjarni <bjarni@openttd.org> | 2006-08-30 23:01:45 +0000 |
---|---|---|
committer | bjarni <bjarni@openttd.org> | 2006-08-30 23:01:45 +0000 |
commit | 7922c9ff8496db84a24a62665437389fdaade34a (patch) | |
tree | 6a3d86da825371df4091d7d15c07bafed940be72 /vehicle_gui.c | |
parent | f91fce66cb78e5ab67e77a47c72242c0048e6514 (diff) | |
download | openttd-7922c9ff8496db84a24a62665437389fdaade34a.tar.xz |
(svn r6249) -Fix: fixed assert when pressing goto depot in an empty list (forgot to disable the button in this condition)
-Code cleanup r6246: simplified SendAllVehiclesToDepot() and moved an { in PlayerVehWndProc()
Diffstat (limited to 'vehicle_gui.c')
-rw-r--r-- | vehicle_gui.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/vehicle_gui.c b/vehicle_gui.c index dd9b39154..b79ae41d6 100644 --- a/vehicle_gui.c +++ b/vehicle_gui.c @@ -1268,6 +1268,7 @@ void PlayerVehWndProc(Window *w, WindowEvent *e) SetDParam(0, p->name_1); SetDParam(1, p->name_2); SetDParam(2, w->vscroll.count); + if (vl->list_length == 0) SETBIT(w->disabled_state, 9); if (vehicle_type == VEH_Aircraft) { w->widget[9].unkA = STR_SEND_TO_HANGARS; w->widget[9].tooltips = STR_SEND_TO_HANGARS_TIP; @@ -1404,35 +1405,34 @@ void PlayerVehWndProc(Window *w, WindowEvent *e) } } break; - case 9: /* Left button */ + case 9: { /* Left button */ + uint16 window_type = w->window_number & VLW_FLAGS; if (GB(w->window_number, 0, 8) /* OwnerID */ != _local_player) break; - { - uint16 window_type = w->window_number & VLW_FLAGS; - switch (window_type) { - case VLW_STANDARD: - case VLW_SHARED_ORDERS: { - /* Send to depot */ - const Vehicle *v; - assert(vl->list_length != 0); - v = vl->sort_list[0]; - DoCommandP(v->tile, v->index, window_type | _ctrl_pressed ? 3 : 2, NULL, CMD_SEND_TO_DEPOT(vehicle_type)); - break; - } - - case VLW_STATION_LIST: - /* Build new Vehicle */ - switch (vehicle_type) { - case VEH_Train: ShowBuildTrainWindow(0); break; - case VEH_Road: ShowBuildRoadVehWindow(0); break; - case VEH_Ship: ShowBuildShipWindow(0); break; - case VEH_Aircraft: ShowBuildAircraftWindow(0); break; - default: NOT_REACHED(); break; - } - break; - default: NOT_REACHED(); break; + switch (window_type) { + case VLW_STANDARD: + case VLW_SHARED_ORDERS: { + /* Send to depot */ + const Vehicle *v; + assert(vl->list_length != 0); + v = vl->sort_list[0]; + DoCommandP(v->tile, v->index, window_type | _ctrl_pressed ? 3 : 2, NULL, CMD_SEND_TO_DEPOT(vehicle_type)); + break; } - break; + + case VLW_STATION_LIST: + /* Build new Vehicle */ + switch (vehicle_type) { + case VEH_Train: ShowBuildTrainWindow(0); break; + case VEH_Road: ShowBuildRoadVehWindow(0); break; + case VEH_Ship: ShowBuildShipWindow(0); break; + case VEH_Aircraft: ShowBuildAircraftWindow(0); break; + default: NOT_REACHED(); break; + } + break; + default: NOT_REACHED(); break; } + break; + } case 10: /* Right button */ ShowReplaceVehicleWindow(vehicle_type); |