summaryrefslogtreecommitdiff
path: root/vehicle_gui.c
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-08-30 21:39:01 +0000
committerbjarni <bjarni@openttd.org>2006-08-30 21:39:01 +0000
commit1d011b57d25b94028631a8ffa35c66b394c34916 (patch)
treee623f356bdcb29cc6664a3dd44ee29114e6db20e /vehicle_gui.c
parentd5ebb2b359cfbf797d5b6de64099344341406c6b (diff)
downloadopenttd-1d011b57d25b94028631a8ffa35c66b394c34916.tar.xz
(svn r6246) -Feature: added the many times requested "send all vehicle to depot" button
it's located in the vehicle list screen and does the same as in the shared orders window (send all vehicles in list to a depot) it will still not inform the player if a vehicle failed to find a depot, so don't take for granted that all of them go
Diffstat (limited to 'vehicle_gui.c')
-rw-r--r--vehicle_gui.c51
1 files changed, 31 insertions, 20 deletions
diff --git a/vehicle_gui.c b/vehicle_gui.c
index bec8e1516..dd9b39154 100644
--- a/vehicle_gui.c
+++ b/vehicle_gui.c
@@ -1268,6 +1268,14 @@ void PlayerVehWndProc(Window *w, WindowEvent *e)
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
SetDParam(2, w->vscroll.count);
+ 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;
+ }
+
switch (vehicle_type) {
case VEH_Train: w->widget[1].unkA = STR_881B_TRAINS; break;
case VEH_Road: w->widget[1].unkA = STR_9001_ROAD_VEHICLES; break;
@@ -1398,30 +1406,33 @@ void PlayerVehWndProc(Window *w, WindowEvent *e)
case 9: /* Left button */
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;
+ }
- switch (w->window_number & VLW_FLAGS) {
- 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, _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;
}
- case VLW_STANDARD:
- 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);