|
|
|
@ -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;
|
|
|
|
|
|
|
|
|
|