diff options
author | bjarni <bjarni@openttd.org> | 2006-09-01 10:24:15 +0000 |
---|---|---|
committer | bjarni <bjarni@openttd.org> | 2006-09-01 10:24:15 +0000 |
commit | d7e1d08d53d7d9885c747d7e1095d607f8f5cebe (patch) | |
tree | e86a7aeb29a672f565ab4b7aa38c5cb4a0010e93 /vehicle_gui.c | |
parent | 7d3685a8ad0661c43dda4deb8c2559226b3370fe (diff) | |
download | openttd-d7e1d08d53d7d9885c747d7e1095d607f8f5cebe.tar.xz |
(svn r6291) -Feature: Vehicle lists from the station window now also got the goto depot button
-Codechange: unified the code for mass goto depot to avoid duplicated code
-Fix: Vehicles already on the way to depots will not be cancelled by mass goto depot (made it really hard to send all vehicles at once)
Diffstat (limited to 'vehicle_gui.c')
-rw-r--r-- | vehicle_gui.c | 53 |
1 files changed, 9 insertions, 44 deletions
diff --git a/vehicle_gui.c b/vehicle_gui.c index 38255c4a5..6332da25b 100644 --- a/vehicle_gui.c +++ b/vehicle_gui.c @@ -1188,17 +1188,9 @@ void PlayerVehWndProc(Window *w, WindowEvent *e) SetDParam(0, w->vscroll.count); w->widget[1].unkA = STR_VEH_WITH_SHARED_ORDERS_LIST; - if (owner != _local_player) break; // only set up buttons for local player + if (owner != _local_player) break; // only set up buttons for local player w->widget[10].unkA = STR_EMPTY; SETBIT(w->disabled_state, 10); - - if (vehicle_type == VEH_Aircraft) { - w->widget[9].unkA = STR_SEND_TO_HANGARS; - w->widget[9].tooltips = STR_SEND_TO_HANGARS_TIP; - } else { - w->widget[9].unkA = STR_SEND_TO_DEPOTS; - w->widget[9].tooltips = STR_SEND_TO_DEPOTS_TIP; - } break; case VLW_STANDARD: @@ -1215,15 +1207,8 @@ void PlayerVehWndProc(Window *w, WindowEvent *e) default: NOT_REACHED(); break; } - if (owner != _local_player) break; // only set up buttons for local player + if (owner != _local_player) break; // only set up buttons for local player 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; - } else { - w->widget[9].unkA = STR_SEND_TO_DEPOTS; - w->widget[9].tooltips = STR_SEND_TO_DEPOTS_TIP; - } break; case VLW_STATION_LIST: @@ -1237,6 +1222,8 @@ void PlayerVehWndProc(Window *w, WindowEvent *e) case VEH_Aircraft: w->widget[1].unkA = STR_SCHEDULED_AIRCRAFT; break; default: NOT_REACHED(); break; } + if (owner != _local_player) break; // only set up buttons for local player + if (vl->list_length == 0) SETBIT(w->disabled_state, 9); break; default: NOT_REACHED(); break; @@ -1345,36 +1332,14 @@ void PlayerVehWndProc(Window *w, WindowEvent *e) } } break; - case 9: { /* Left button */ - uint16 window_type = w->window_number & VLW_FLAGS; + case 9: // Left button if (GB(w->window_number, 0, 8) /* OwnerID */ != _local_player) 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; - } - - 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; - } + assert(vl->list_length != 0); + DoCommandP(0, GB(w->window_number, 16, 16) /* StationID or OrderID (depending on VLW). Nomatter which one it is, it's needed here */, + (w->window_number & VLW_FLAGS) | DEPOT_MASS_SEND | (_ctrl_pressed ? DEPOT_SERVICE : 0), NULL, CMD_SEND_TO_DEPOT(vehicle_type)); break; - } - case 10: /* Right button */ + case 10: // Right button ShowReplaceVehicleWindow(vehicle_type); break; } |