summaryrefslogtreecommitdiff
path: root/vehicle_gui.c
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-09-29 11:30:48 +0000
committerbjarni <bjarni@openttd.org>2006-09-29 11:30:48 +0000
commit5b60e371a6d9adaadb7b694f74123a8081d7da32 (patch)
tree303b41ba76cc12f8f97be259eccf0c887c78222c /vehicle_gui.c
parentf5d61a1c6fbec5a01e54d78636cd205e295cdd0b (diff)
downloadopenttd-5b60e371a6d9adaadb7b694f74123a8081d7da32.tar.xz
(svn r6570) -Feature: added "start all" and "stop all" buttons to the vehicle lists
Diffstat (limited to 'vehicle_gui.c')
-rw-r--r--vehicle_gui.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/vehicle_gui.c b/vehicle_gui.c
index c7a5ca6e7..cd153df9d 100644
--- a/vehicle_gui.c
+++ b/vehicle_gui.c
@@ -1224,6 +1224,8 @@ typedef enum VehicleListWindowWidgets {
VLW_WIDGET_OTHER_PLAYER_FILLER,
VLW_WIDGET_SEND_TO_DEPOT,
VLW_WIDGET_AUTOREPLACE,
+ VLW_WIDGET_STOP_ALL,
+ VLW_WIDGET_START_ALL,
VLW_WIDGET_RESIZE,
} VehicleListWindowWidget;
@@ -1240,6 +1242,8 @@ static const byte vehicle_list_widget_moves[] = {
WIDGET_MOVE_DOWN_STRETCH_RIGHT, // VLW_WIDGET_OTHER_PLAYER_FILLER
WIDGET_MOVE_DOWN, // VLW_WIDGET_SEND_TO_DEPOT
WIDGET_MOVE_DOWN, // VLW_WIDGET_AUTOREPLACE
+ WIDGET_MOVE_DOWN_RIGHT, // VLW_WIDGET_STOP_ALL
+ WIDGET_MOVE_DOWN_RIGHT, // VLW_WIDGET_START_ALL
WIDGET_MOVE_DOWN_RIGHT, // VLW_WIDGET_RESIZE
};
@@ -1256,6 +1260,8 @@ static const Widget _vehicle_list_widgets[] = {
{ WWT_PANEL, RESIZE_RTB, 14, 0, 247, 170, 181, 0x0, STR_NULL},
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 124, 170, 181, STR_SEND_TO_DEPOTS, STR_SEND_TO_DEPOTS_TIP},
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 125, 247, 170, 181, STR_REPLACE_VEHICLES, STR_REPLACE_HELP},
+ { WWT_PUSHIMGBTN, RESIZE_LRTB, 14, 224, 235, 170, 181, SPR_FLAG_VEH_STOPPED, STR_MASS_STOP_LIST_TIP},
+ { WWT_PUSHIMGBTN, RESIZE_LRTB, 14, 236, 247, 170, 181, SPR_FLAG_VEH_RUNNING, STR_MASS_START_LIST_TIP},
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 248, 259, 170, 181, 0x0, STR_RESIZE_BUTTON},
{ WIDGETS_END},
};
@@ -1263,7 +1269,7 @@ static const Widget _vehicle_list_widgets[] = {
/* Resize the bottom row of buttons to make them equal in size when resizing */
static void ResizeVehicleListWidgets(Window *w)
{
- w->widget[VLW_WIDGET_AUTOREPLACE].right = w->widget[VLW_WIDGET_RESIZE].left - 1;
+ w->widget[VLW_WIDGET_AUTOREPLACE].right = w->widget[VLW_WIDGET_STOP_ALL].left - 1;
w->widget[VLW_WIDGET_SEND_TO_DEPOT].right = w->widget[VLW_WIDGET_AUTOREPLACE].right / 2;
w->widget[VLW_WIDGET_AUTOREPLACE].left = w->widget[VLW_WIDGET_SEND_TO_DEPOT].right;
}
@@ -1284,6 +1290,8 @@ static void CreateVehicleListWindow(Window *w)
} else {
SETBIT(w->hidden_state, VLW_WIDGET_SEND_TO_DEPOT);
SETBIT(w->hidden_state, VLW_WIDGET_AUTOREPLACE);
+ SETBIT(w->hidden_state, VLW_WIDGET_STOP_ALL);
+ SETBIT(w->hidden_state, VLW_WIDGET_START_ALL);
}
/* Set up the window widgets */
@@ -1376,8 +1384,8 @@ static void CreateVehicleListWindow(Window *w)
* Aircraft and ships already got the right size widgets */
if (w->resize.step_height == PLY_WND_PRC__SIZE_OF_ROW_SMALL) {
ResizeWindowWidgets(w, vehicle_list_widget_moves, lengthof(vehicle_list_widget_moves), vl->vehicle_type == VEH_Train ? 65 : 0, 38);
- ResizeVehicleListWidgets(w);
}
+ ResizeVehicleListWidgets(w);
}
static void DrawVehicleListWindow(Window *w)
@@ -1548,15 +1556,20 @@ void PlayerVehWndProc(Window *w, WindowEvent *e)
}
} break;
- case VLW_WIDGET_SEND_TO_DEPOT: // Left button
+ case VLW_WIDGET_SEND_TO_DEPOT:
assert(vl->l.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_MASK) | DEPOT_MASS_SEND | (_ctrl_pressed ? DEPOT_SERVICE : 0), NULL, CMD_SEND_TO_DEPOT(vl->vehicle_type));
break;
- case VLW_WIDGET_AUTOREPLACE: // Right button
+ case VLW_WIDGET_AUTOREPLACE:
ShowReplaceVehicleWindow(vl->vehicle_type);
break;
+
+ case VLW_WIDGET_STOP_ALL:
+ case VLW_WIDGET_START_ALL:
+ DoCommandP(0, vl->vehicle_type, (w->window_number & VLW_MASK) | (1 << 1) | (e->we.click.widget == VLW_WIDGET_START_ALL ? 1 : 0), NULL, CMD_MASS_START_STOP);
+ break;
}
} break;