77 const StringID BaseVehicleListWindow::vehicle_sorter_names[] = {
81 STR_SORT_BY_PROFIT_THIS_YEAR,
82 STR_SORT_BY_PROFIT_LAST_YEAR,
83 STR_SORT_BY_TOTAL_CAPACITY_PER_CARGOTYPE,
84 STR_SORT_BY_RELIABILITY,
85 STR_SORT_BY_MAX_SPEED,
89 STR_SORT_BY_LIFE_TIME,
90 STR_SORT_BY_TIMETABLE_DELAY,
94 const StringID BaseVehicleListWindow::vehicle_depot_name[] = {
95 STR_VEHICLE_LIST_SEND_TRAIN_TO_DEPOT,
96 STR_VEHICLE_LIST_SEND_ROAD_VEHICLE_TO_DEPOT,
97 STR_VEHICLE_LIST_SEND_SHIP_TO_DEPOT,
98 STR_VEHICLE_LIST_SEND_AIRCRAFT_TO_HANGAR
110 unitnumber = max<uint>(unitnumber, (*v)->unitnumber);
113 if (unitnumber >= 10000)
return 5;
114 if (unitnumber >= 1000)
return 4;
115 if (unitnumber >= 100)
return 3;
125 void BaseVehicleListWindow::BuildVehicleList()
129 DEBUG(misc, 3,
"Building vehicle list type %d for company %d given index %d", this->
vli.
type, this->vli.company, this->vli.index);
184 static const Vehicle *_last_vehicle[2] = { NULL, NULL };
186 void BaseVehicleListWindow::SortVehicleList()
191 _last_vehicle[0] = _last_vehicle[1] = NULL;
196 if (list->
Length() < 2)
return;
209 spr = SPR_PROFIT_NEGATIVE;
211 spr = SPR_PROFIT_SOME;
213 spr = SPR_PROFIT_LOT;
244 byte ret_refit_cyc = 0;
245 bool success =
false;
246 if (subtypes.
Length() > 0) {
249 const Engine *e = v->GetEngine();
251 if (!
HasBit(e->info.refit_mask, dest_cargo_type) && v->cargo_type != dest_cargo_type)
continue;
253 CargoID old_cargo_type = v->cargo_type;
254 byte old_cargo_subtype = v->cargo_subtype;
257 v->cargo_type = dest_cargo_type;
261 v->cargo_subtype = refit_cyc;
264 v->First()->InvalidateNewGRFCache();
265 v->InvalidateNewGRFCache();
268 if (subtype == STR_EMPTY)
break;
270 if (!subtypes.
Contains(subtype))
continue;
273 ret_refit_cyc = refit_cyc;
279 v->cargo_type = old_cargo_type;
280 v->cargo_subtype = old_cargo_subtype;
283 v->First()->InvalidateNewGRFCache();
284 v->InvalidateNewGRFCache();
290 return ret_refit_cyc;
345 int textleft = r.left +
WD_MATRIX_LEFT + (rtl ? 0 : iconwidth + 4);
349 for (uint i = 0; current < pos + rows && i <
NUM_CARGO; i++) {
350 for (uint j = 0; current < pos + rows && j < list[i].
Length(); j++) {
354 if (sel[0] != (
int)i && refit.
subtype != 0xFF)
continue;
362 if (list[i].Length() > 1) {
366 GfxDrawLine(iconcenter, y -
WD_MATRIX_TOP, iconcenter, j == list[i].Length() - 1 ? ycenter : y -
WD_MATRIX_TOP + delta - 1, linecolour);
367 GfxDrawLine(iconcenter, ycenter, iconinner, ycenter, linecolour);
374 TextColour colour = (sel[0] == (int)i && (uint)sel[1] == j) ? TC_WHITE : TC_BLACK;
378 DrawString(textleft, textright, y, STR_JUST_STRING_STRING, colour);
409 for (uint i = 0; i <
NUM_CARGO; i++) this->list[i].Clear();
419 uint32 cmask = e->info.refit_mask;
428 int current_index = 0;
433 if (!
HasBit(cmask, cid)) {
438 bool first_vehicle = this->list[current_index].
Length() == 0;
444 option->
string = STR_EMPTY;
470 if (subtype == STR_EMPTY)
break;
476 this->list[current_index].
Include(option);
479 if (subtype == STR_EMPTY) {
481 SubtypeList &l = this->list[current_index];
483 for (uint i = 1; i < l.
Length(); i++) {
484 if (l[i].subtype >= refit_cyc) {
493 SubtypeList &l = this->list[current_index];
494 while (pos < l.
Length() && l[pos].subtype != refit_cyc) pos++;
495 if (pos < l.
Length() && l[pos].string != subtype) {
525 for (uint j = 0; j < this->list[i].
Length(); j++) {
529 if (this->
sel[0] != (
int)i && refit.
subtype != 0xFF)
continue;
531 if (this->
sel[0] == (
int)i && (uint)this->
sel[1] == j) scroll_row = row;
550 for (uint j = 0; j < this->list[i].
Length(); j++) {
554 if (this->
sel[0] != (
int)i && refit.
subtype != 0xFF)
continue;
556 if (row == click_row) {
576 if (this->
sel[0] < 0)
return NULL;
578 SubtypeList &l = this->list[this->
sel[0]];
579 if ((uint)this->sel[1] >= l.
Length())
return NULL;
581 return &l[this->sel[1]];
598 nwi->
tool_tip = STR_REFIT_TRAIN_REFIT_TOOLTIP + v->
type;
610 if (this->
cargo != NULL) {
620 for (uint j = 0; j < list[i].
Length(); j++) {
621 if (list[i][j] == current_refit_option) {
624 this->
cargo = &list[i][j];
645 int sprite_width =
max(0, ((
int)vehicle_panel_display->
current_x - this->vehicle_width) / 2);
664 size->height = resize->height * 8;
706 return STR_REFIT_NEW_CAPACITY_INCOME_FROM_AIRCRAFT_REFIT;
709 return STR_REFIT_NEW_CAPACITY_COST_OF_AIRCRAFT_REFIT;
714 return STR_REFIT_NEW_CAPACITY_INCOME_FROM_REFIT;
717 return STR_REFIT_NEW_CAPACITY_COST_OF_REFIT;
738 int left = INT32_MIN;
743 if (vehicles_to_refit.
Contains(u->index) && left == INT32_MIN) {
749 if ((!vehicles_to_refit.
Contains(u->index) || u->Next() == NULL) && left != INT32_MIN) {
750 if (u->Next() == NULL && vehicles_to_refit.
Contains(u->index)) {
751 int current_width = u->GetDisplayImageWidth();
752 width += current_width;
756 int right =
Clamp(left + width, 0, r.right);
761 left = right -
width;
771 int current_width = u->GetDisplayImageWidth();
772 width += current_width;
788 if (this->
cargo != NULL) {
817 if (!gui_scope)
break;
826 for (uint j = 0; j < this->list[i].
Length(); j++) {
830 max_width =
max(dim.width, max_width);
843 if (!gui_scope)
break;
850 int GetClickPosition(
int click_x)
860 void SetSelectedVehicles(
int drag_x)
862 drag_x = GetClickPosition(drag_x);
864 int left_x =
min(this->click_x, drag_x);
865 int right_x =
max(this->click_x, drag_x);
875 bool start_counting =
false;
876 for (; u != NULL; u = u->
Next()) {
878 left_x -= current_width;
879 right_x -= current_width;
881 if (left_x < 0 && !start_counting) {
883 start_counting =
true;
892 if (right_x < 0)
break;
918 this->click_x = GetClickPosition(pt.x - nwi->
pos_x);
919 this->SetSelectedVehicles(pt.x - nwi->
pos_x);
935 if (click_count == 1)
break;
940 if (this->
cargo != NULL) {
945 if (
DoCommandP(v->
tile, this->selected_vehicle, this->cargo->cargo | this->cargo->subtype << 8 | this->num_vehicles << 16, GetCmdRefitVeh(v)) && delete_window)
delete this;
960 this->SetSelectedVehicles(pt.x - nwi->
pos_x);
973 this->SetSelectedVehicles(pt.x - nwi->
pos_x);
988 static const NWidgetPart _nested_vehicle_refit_widgets[] = {
1004 NWidget(
WWT_MATRIX, COLOUR_GREY,
WID_VR_MATRIX),
SetMinimalSize(228, 112),
SetResize(1, 14),
SetFill(1, 1),
SetMatrixDataTip(1, 0, STR_NULL),
SetScrollbar(
WID_VR_SCROLLBAR),
1015 WDP_AUTO,
"view_vehicle_refit", 240, 174,
1018 _nested_vehicle_refit_widgets,
lengthof(_nested_vehicle_refit_widgets)
1046 if (cmask == lmask) {
1048 SetDParam(0, STR_PURCHASE_INFO_ALL_TYPES);
1054 SetDParam(0, STR_PURCHASE_INFO_ALL_BUT);
1083 return (*a)->unitnumber - (*b)->unitnumber;
1089 static char last_name[2][64];
1091 if (*a != _last_vehicle[0]) {
1092 _last_vehicle[0] = *a;
1094 GetString(last_name[0], STR_VEHICLE_NAME,
lastof(last_name[0]));
1097 if (*b != _last_vehicle[1]) {
1098 _last_vehicle[1] = *b;
1100 GetString(last_name[1], STR_VEHICLE_NAME,
lastof(last_name[1]));
1103 int r =
strnatcmp(last_name[0], last_name[1]);
1110 int r = (*a)->age - (*b)->age;
1117 int r =
ClampToI32((*a)->GetDisplayProfitThisYear() - (*b)->GetDisplayProfitThisYear());
1124 int r =
ClampToI32((*a)->GetDisplayProfitLastYear() - (*b)->GetDisplayProfitLastYear());
1150 int r = (*a)->reliability - (*b)->reliability;
1157 int r = (*a)->vcache.cached_max_speed - (*b)->vcache.cached_max_speed;
1164 int r = (*a)->engine_type - (*b)->engine_type;
1174 for (u = *a; u != NULL; u = u->
Next()) diff += u->
value;
1175 for (u = *b; u != NULL; u = u->
Next()) diff -= u->
value;
1184 int r = (*a)->GetGroundVehicleCache()->cached_total_length - (*b)->GetGroundVehicleCache()->cached_total_length;
1191 int r =
ClampToI32(((*a)->max_age - (*a)->age) - ((*b)->max_age - (*b)->age));
1198 int r = (*a)->lateness_counter - (*b)->lateness_counter;
1202 void InitializeGUI()
1245 static const NWidgetPart _nested_vehicle_list[] = {
1262 NWidget(
WWT_MATRIX, COLOUR_GREY,
WID_VL_LIST),
SetMinimalSize(248, 0),
SetFill(1, 0),
SetResize(1, 1),
SetMatrixDataTip(1, 0, STR_NULL),
SetScrollbar(
WID_VL_SCROLLBAR),
1270 SetDataTip(STR_BLACK_STRING, STR_VEHICLE_LIST_AVAILABLE_ENGINES_TOOLTIP),
1273 SetDataTip(STR_VEHICLE_LIST_MANAGE_LIST, STR_VEHICLE_LIST_MANAGE_LIST_TOOLTIP),
1275 SetDataTip(SPR_FLAG_VEH_STOPPED, STR_VEHICLE_LIST_MASS_STOP_LIST_TOOLTIP),
1277 SetDataTip(SPR_FLAG_VEH_RUNNING, STR_VEHICLE_LIST_MASS_START_LIST_TOOLTIP),
1286 static void DrawSmallOrderList(
const Vehicle *v,
int left,
int right,
int y,
VehicleOrderID start = 0)
1289 if (order == NULL)
return;
1292 int l_offset = rtl ? 0 :
UnScaleByZoom(4 * 6, ZOOM_LVL_GUI);
1293 int r_offset = rtl ?
UnScaleByZoom(4 * 6, ZOOM_LVL_GUI) : 0;
1300 if (order->
IsType(OT_GOTO_STATION)) {
1302 DrawString(left + l_offset, right - r_offset, y, STR_TINY_BLACK_STATION);
1305 if (++i == 4)
break;
1309 order = order->
next;
1310 if (order == NULL) {
1314 }
while (oid != start);
1333 default: NOT_REACHED();
1350 if (divisor == 1)
return base;
1353 uint rem = base % divisor;
1354 return base + (rem == 0 ? 0 : divisor - rem);
1371 int text_left = left + (rtl ? 0 : text_offset);
1372 int text_right = right - (rtl ? text_offset : 0);
1375 int orderlist_left = left + (rtl ? 0 :
max(
UnScaleByZoom(4 * 100, ZOOM_LVL_GUI) + text_offset, width / 2));
1376 int orderlist_right = right - (rtl ?
max(
UnScaleByZoom(4 * 100, ZOOM_LVL_GUI) + text_offset, width / 2) : 0);
1378 int image_left = (rtl && show_orderlist) ? orderlist_right : text_left;
1379 int image_right = (!rtl && show_orderlist) ? orderlist_left : text_right;
1381 int vehicle_button_x = rtl ? right -
GetSpriteSize(SPR_PROFIT_LOT).width :
left;
1395 if (v->
name != NULL) {
1398 DrawString(text_left, text_right, y, STR_TINY_BLACK_VEHICLE);
1402 DrawString(text_left, text_right, y, STR_TINY_GROUP, TC_BLACK);
1405 if (show_orderlist) DrawSmallOrderList(v, orderlist_left, orderlist_right, y, v->
cur_real_order_index);
1408 str = STR_BLUE_COMMA;
1450 default: NOT_REACHED();
1460 this->BuildVehicleList();
1461 this->SortVehicleList();
1464 this->GetWidget<NWidgetCore>(
WID_VL_LIST)->tool_tip = STR_VEHICLE_LIST_TRAIN_LIST_TOOLTIP + this->
vli.
vtype;
1466 if (this->
vli.
type == VL_SHARED_ORDERS) {
1467 this->GetWidget<NWidgetCore>(
WID_VL_CAPTION)->widget_data = STR_VEHICLE_LIST_SHARED_ORDERS_LIST_CAPTION;
1469 this->GetWidget<NWidgetCore>(
WID_VL_CAPTION)->widget_data = STR_VEHICLE_LIST_TRAIN_CAPTION + this->
vli.
vtype;
1490 size->height = 6 * resize->height;
1494 size->height = 4 * resize->height;
1496 default: NOT_REACHED();
1503 d.height += padding.height;
1504 *size =
maxdim(*size, d);
1510 d.height += padding.height;
1511 d.width += padding.width;
1512 *size =
maxdim(*size, d);
1527 case VL_SHARED_ORDERS:
1542 case VL_STATION_LIST:
1554 default: NOT_REACHED();
1577 this->BuildVehicleList();
1578 this->SortVehicleList();
1664 default: NOT_REACHED();
1667 default: NOT_REACHED();
1676 StationID station = (this->
vli.
type == VL_STATION_LIST) ? this->
vli.
index : INVALID_STATION;
1678 DEBUG(misc, 3,
"Periodic resort %d list company %d at station %d", this->
vli.
vtype, this->owner, station);
1695 if (!gui_scope &&
HasBit(data, 31) && this->
vli.
type == VL_SHARED_ORDERS) {
1698 this->window_number = this->
vli.
Pack();
1713 WDP_AUTO,
"list_vehicles", 260, 246,
1716 _nested_vehicle_list,
lengthof(_nested_vehicle_list)
1720 WDP_AUTO,
"list_vehicles_train", 325, 246,
1723 _nested_vehicle_list,
lengthof(_nested_vehicle_list)
1732 AllocateWindowDescFront<VehicleListWindow>(&_vehicle_list_train_desc, num);
1735 AllocateWindowDescFront<VehicleListWindow>(&_vehicle_list_other_desc, num);
1749 ShowVehicleListWindowLocal(company, VL_STANDARD, vehicle_type, company);
1753 void ShowVehicleListWindow(
const Vehicle *v)
1760 ShowVehicleListWindowLocal(company, VL_STATION_LIST, vehicle_type, station);
1765 uint16 depot_airport_index;
1772 ShowVehicleListWindowLocal(company, VL_DEPOT_LIST, vehicle_type, depot_airport_index);
1801 SetDataTip(STR_EMPTY, STR_SERVICE_INTERVAL_DROPDOWN_TOOLTIP),
1819 NWidget(
WWT_MATRIX, COLOUR_GREY,
WID_VD_MATRIX),
SetResize(1, 1),
SetMinimalSize(393, 45),
SetMatrixDataTip(1, 0, STR_NULL),
SetFill(1, 0),
SetScrollbar(
WID_VD_SCROLLBAR),
1828 SetDataTip(STR_EMPTY, STR_SERVICE_INTERVAL_DROPDOWN_TOOLTIP),
1835 SetDataTip(STR_VEHICLE_DETAIL_TAB_INFORMATION, STR_VEHICLE_DETAILS_TRAIN_INFORMATION_TOOLTIP),
SetFill(1, 0),
SetResize(1, 0),
1839 SetDataTip(STR_VEHICLE_DETAIL_TAB_TOTAL_CARGO, STR_VEHICLE_DETAILS_TRAIN_TOTAL_CARGO_TOOLTIP),
SetFill(1, 0),
SetResize(1, 0),
1851 static StringID _service_interval_dropdown[] = {
1852 STR_VEHICLE_DETAILS_DEFAULT,
1853 STR_VEHICLE_DETAILS_DAYS,
1854 STR_VEHICLE_DETAILS_PERCENT,
1874 this->owner = v->
owner;
1890 if (!gui_scope)
return;
1896 if (aimed_height != nwid_info->
current_y) {
1909 uint desired_height;
1914 for (
const Vehicle *u = v; u != NULL; u = u->
Next()) {
1920 return desired_height;
1931 static const StringID info_strings[] = {
1932 STR_VEHICLE_INFO_MAX_SPEED,
1933 STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED,
1934 STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE,
1935 STR_VEHICLE_INFO_PROFIT_THIS_YEAR_LAST_YEAR,
1936 STR_VEHICLE_INFO_RELIABILITY_BREAKDOWNS
1938 for (uint i = 0; i <
lengthof(info_strings); i++) {
1970 size->height = 4 * resize->height;
1974 StringID *strs = _service_interval_dropdown;
1978 size->width += padding.width;
1996 switch (vehicle_type) {
1997 default: NOT_REACHED();
2023 default: NOT_REACHED();
2042 SetDParam(0, (v->
age + DAYS_IN_YEAR < v->max_age) ? STR_VEHICLE_INFO_AGE : STR_VEHICLE_INFO_AGE_RED);
2059 string = STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED;
2061 string = STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE;
2067 string = STR_VEHICLE_INFO_MAX_SPEED_RANGE;
2069 string = STR_VEHICLE_INFO_MAX_SPEED;
2098 uint text_left = r.left + (rtl ? 0 : sprite_width);
2099 uint text_right = r.right - (rtl ? sprite_width : 0);
2105 uint sprite_left = rtl ? text_right : r.left;
2106 uint sprite_right = rtl ? r.right : text_left;
2119 v->ServiceIntervalIsPercent() ? STR_VEHICLE_DETAILS_SERVICING_INTERVAL_PERCENT : STR_VEHICLE_DETAILS_SERVICING_INTERVAL_DAYS);
2142 StringID str = v->ServiceIntervalIsCustom() ?
2143 (v->ServiceIntervalIsPercent() ? STR_VEHICLE_DETAILS_PERCENT : STR_VEHICLE_DETAILS_DAYS) :
2144 STR_VEHICLE_DETAILS_DEFAULT;
2168 if (mod == v->GetServiceInterval())
return;
2176 ShowDropDownMenu(
this, _service_interval_dropdown, v->ServiceIntervalIsCustom() ? (v->ServiceIntervalIsPercent() ? 2 : 1) : 0, widget, 0, 0);
2203 bool iscustom = index != 0;
2204 bool ispercent = iscustom ? (index == 2) :
Company::Get(v->
owner)->settings.vehicle.servint_ispercent;
2214 if (str == NULL)
return;
2230 WDP_AUTO,
"view_vehicle_details_train", 405, 178,
2233 _nested_train_vehicle_details_widgets,
lengthof(_nested_train_vehicle_details_widgets)
2238 WDP_AUTO,
"view_vehicle_details", 405, 113,
2241 _nested_nontrain_vehicle_details_widgets,
lengthof(_nested_nontrain_vehicle_details_widgets)
2268 NWidget(
NWID_VIEWPORT, INVALID_COLOUR,
WID_VV_VIEWPORT),
SetMinimalSize(226, 84),
SetResize(1, 1),
SetPadding(1, 1, 1, 1),
2279 SetDataTip(SPR_IGNORE_SIGNALS, STR_VEHICLE_VIEW_TRAIN_IGNORE_SIGNAL_TOOLTIP),
2283 SetDataTip(SPR_FORCE_VEHICLE_TURN, STR_VEHICLE_VIEW_ROAD_VEHICLE_REVERSE_TOOLTIP),
2298 WDP_AUTO,
"view_vehicle", 250, 116,
2301 _nested_vehicle_view_widgets,
lengthof(_nested_vehicle_view_widgets)
2309 WDP_AUTO,
"view_vehicle_train", 250, 134,
2312 _nested_vehicle_view_widgets,
lengthof(_nested_vehicle_view_widgets)
2332 static const int VV_INITIAL_VIEWPORT_WIDTH = 226;
2333 static const int VV_INITIAL_VIEWPORT_HEIGHT = 84;
2334 static const int VV_INITIAL_VIEWPORT_HEIGHT_TRAIN = 102;
2338 VCT_CMD_START_STOP = 0,
2340 VCT_CMD_TURN_AROUND,
2374 if (result.
Failed())
return;
2450 static const SpriteID vehicle_view_goto_depot_sprites[] = {
2451 SPR_SEND_TRAIN_TODEPOT,
2452 SPR_SEND_ROADVEH_TODEPOT,
2453 SPR_SEND_SHIP_TODEPOT,
2454 SPR_SEND_AIRCRAFT_TODEPOT,
2457 this->GetWidget<NWidgetCore>(
WID_VV_GOTO_DEPOT)->widget_data = vehicle_view_goto_depot_sprites[v->
type];
2460 static const SpriteID vehicle_view_clone_sprites[] = {
2466 this->GetWidget<NWidgetCore>(
WID_VV_CLONE)->widget_data = vehicle_view_clone_sprites[v->
type];
2470 this->GetWidget<NWidgetCore>(
WID_VV_TURN_AROUND)->tool_tip = STR_VEHICLE_VIEW_TRAIN_REVERSE_TOOLTIP;
2481 default: NOT_REACHED();
2485 this->GetWidget<NWidgetViewport>(
WID_VV_VIEWPORT)->InitializeViewport(
this, this->window_number | (1 << 31), _vehicle_view_zoom_levels[v->
type]);
2487 this->GetWidget<NWidgetCore>(
WID_VV_START_STOP)->tool_tip = STR_VEHICLE_VIEW_TRAIN_STATE_START_STOP_TOOLTIP + v->
type;
2489 this->GetWidget<NWidgetCore>(
WID_VV_REFIT)->tool_tip = STR_VEHICLE_VIEW_TRAIN_REFIT_TOOLTIP + v->
type;
2491 this->GetWidget<NWidgetCore>(
WID_VV_SHOW_ORDERS)->tool_tip = STR_VEHICLE_VIEW_TRAIN_ORDERS_TOOLTIP + v->
type;
2493 this->GetWidget<NWidgetCore>(
WID_VV_CLONE)->tool_tip = STR_VEHICLE_VIEW_CLONE_TRAIN_INFO + v->
type;
2520 size->width = VV_INITIAL_VIEWPORT_WIDTH;
2521 size->height = (v->
type ==
VEH_TRAIN) ? VV_INITIAL_VIEWPORT_HEIGHT_TRAIN : VV_INITIAL_VIEWPORT_HEIGHT;
2526 virtual void OnPaint()
2533 this->SetWidgetDisabledState(
WID_VV_REFIT, !refitable_and_stopped_in_depot || !is_localcompany);
2534 this->SetWidgetDisabledState(
WID_VV_CLONE, !is_localcompany);
2542 this->DrawWidgets();
2545 virtual void SetStringParameters(
int widget)
const
2553 virtual void DrawWidget(
const Rect &r,
int widget)
const
2560 str = STR_VEHICLE_STATUS_CRASHED;
2562 str = STR_VEHICLE_STATUS_BROKEN_DOWN;
2567 str = STR_VEHICLE_STATUS_TRAIN_NO_POWER;
2569 str = STR_VEHICLE_STATUS_STOPPED;
2573 str = STR_VEHICLE_STATUS_TRAIN_STOPPING_VEL;
2576 str = STR_VEHICLE_STATUS_STOPPED;
2579 str = STR_VEHICLE_STATUS_TRAIN_STUCK;
2581 str = STR_VEHICLE_STATUS_AIRCRAFT_TOO_FAR;
2584 case OT_GOTO_STATION: {
2587 str = STR_VEHICLE_STATUS_HEADING_FOR_STATION_VEL;
2591 case OT_GOTO_DEPOT: {
2604 str = STR_VEHICLE_STATUS_HEADING_FOR_DEPOT_VEL;
2606 str = STR_VEHICLE_STATUS_HEADING_FOR_DEPOT_SERVICE_VEL;
2612 str = STR_VEHICLE_STATUS_LOADING_UNLOADING;
2615 case OT_GOTO_WAYPOINT: {
2618 str = STR_VEHICLE_STATUS_HEADING_FOR_WAYPOINT_VEL;
2623 case OT_LEAVESTATION:
2625 str = STR_VEHICLE_STATUS_LEAVING;
2632 str = STR_VEHICLE_STATUS_NO_ORDERS_VEL;
2646 int image_left = (rtl ? text_right + 1 : r.left) +
WD_IMGBTN_LEFT;
2647 int image = ((v->
vehstatus &
VS_STOPPED) != 0) ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING;
2653 virtual void OnClick(
Point pt,
int widget,
int click_count)
2689 ShowOrdersWindow(v);
2701 _vehicle_command_translation_table[VCT_CMD_CLONE_VEH][v->
type],
2707 _vehicle_command_translation_table[VCT_CMD_TURN_AROUND][v->
type]);
2716 virtual void OnResize()
2718 if (this->viewport != NULL) {
2724 virtual void OnTick()
2732 PlaneSelections plane = veh_stopped ? SEL_DC_CLONE : SEL_DC_GOTO_DEPOT;
2734 if (nwi->
shown_plane + SEL_DC_BASEPLANE != plane) {
2735 this->SelectPlane(plane);
2740 PlaneSelections plane = veh_stopped ? SEL_RT_REFIT : SEL_RT_TURN_AROUND;
2742 if (nwi->
shown_plane + SEL_RT_BASEPLANE != plane) {
2743 this->SelectPlane(plane);
2754 virtual void OnInvalidateData(
int data = 0,
bool gui_scope =
true)
2797 void StopGlobalFollowVehicle(
const Vehicle *v)
2816 if (result.
Failed())
return;
2829 int vehicle_width = 0;
2853 return vehicle_width;