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_PURCHASE_INFO_AIRCRAFT_CAPACITY;
707 }
else if (money <= 0) {
709 return STR_REFIT_NEW_CAPACITY_INCOME_FROM_AIRCRAFT_REFIT;
712 return STR_REFIT_NEW_CAPACITY_COST_OF_AIRCRAFT_REFIT;
718 return STR_PURCHASE_INFO_CAPACITY;
719 }
else if (money <= 0) {
721 return STR_REFIT_NEW_CAPACITY_INCOME_FROM_REFIT;
724 return STR_REFIT_NEW_CAPACITY_COST_OF_REFIT;
745 int left = INT32_MIN;
750 if (vehicles_to_refit.
Contains(u->index) && left == INT32_MIN) {
756 if ((!vehicles_to_refit.
Contains(u->index) || u->Next() == NULL) && left != INT32_MIN) {
757 if (u->Next() == NULL && vehicles_to_refit.
Contains(u->index)) {
758 int current_width = u->GetDisplayImageWidth();
759 width += current_width;
763 int right =
Clamp(left + width, 0, r.right);
768 left = right -
width;
778 int current_width = u->GetDisplayImageWidth();
779 width += current_width;
795 if (this->
cargo != NULL) {
824 if (!gui_scope)
break;
833 for (uint j = 0; j < this->list[i].
Length(); j++) {
837 max_width =
max(dim.width, max_width);
850 if (!gui_scope)
break;
857 int GetClickPosition(
int click_x)
867 void SetSelectedVehicles(
int drag_x)
869 drag_x = GetClickPosition(drag_x);
871 int left_x =
min(this->click_x, drag_x);
872 int right_x =
max(this->click_x, drag_x);
882 bool start_counting =
false;
883 for (; u != NULL; u = u->
Next()) {
885 left_x -= current_width;
886 right_x -= current_width;
888 if (left_x < 0 && !start_counting) {
890 start_counting =
true;
899 if (right_x < 0)
break;
925 this->click_x = GetClickPosition(pt.x - nwi->
pos_x);
926 this->SetSelectedVehicles(pt.x - nwi->
pos_x);
942 if (click_count == 1)
break;
947 if (this->
cargo != NULL) {
952 if (
DoCommandP(v->
tile, this->selected_vehicle, this->cargo->cargo | this->cargo->subtype << 8 | this->num_vehicles << 16, GetCmdRefitVeh(v)) && delete_window)
delete this;
967 this->SetSelectedVehicles(pt.x - nwi->
pos_x);
980 this->SetSelectedVehicles(pt.x - nwi->
pos_x);
995 static const NWidgetPart _nested_vehicle_refit_widgets[] = {
1011 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),
1022 WDP_AUTO,
"view_vehicle_refit", 240, 174,
1025 _nested_vehicle_refit_widgets,
lengthof(_nested_vehicle_refit_widgets)
1053 if (cmask == lmask) {
1055 SetDParam(0, STR_PURCHASE_INFO_ALL_TYPES);
1061 SetDParam(0, STR_PURCHASE_INFO_ALL_BUT);
1090 return (*a)->unitnumber - (*b)->unitnumber;
1096 static char last_name[2][64];
1098 if (*a != _last_vehicle[0]) {
1099 _last_vehicle[0] = *a;
1101 GetString(last_name[0], STR_VEHICLE_NAME,
lastof(last_name[0]));
1104 if (*b != _last_vehicle[1]) {
1105 _last_vehicle[1] = *b;
1107 GetString(last_name[1], STR_VEHICLE_NAME,
lastof(last_name[1]));
1110 int r =
strnatcmp(last_name[0], last_name[1]);
1117 int r = (*a)->age - (*b)->age;
1124 int r =
ClampToI32((*a)->GetDisplayProfitThisYear() - (*b)->GetDisplayProfitThisYear());
1131 int r =
ClampToI32((*a)->GetDisplayProfitLastYear() - (*b)->GetDisplayProfitLastYear());
1157 int r = (*a)->reliability - (*b)->reliability;
1164 int r = (*a)->vcache.cached_max_speed - (*b)->vcache.cached_max_speed;
1171 int r = (*a)->engine_type - (*b)->engine_type;
1181 for (u = *a; u != NULL; u = u->
Next()) diff += u->
value;
1182 for (u = *b; u != NULL; u = u->
Next()) diff -= u->
value;
1191 int r = (*a)->GetGroundVehicleCache()->cached_total_length - (*b)->GetGroundVehicleCache()->cached_total_length;
1198 int r =
ClampToI32(((*a)->max_age - (*a)->age) - ((*b)->max_age - (*b)->age));
1205 int r = (*a)->lateness_counter - (*b)->lateness_counter;
1209 void InitializeGUI()
1252 static const NWidgetPart _nested_vehicle_list[] = {
1269 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),
1277 SetDataTip(STR_BLACK_STRING, STR_VEHICLE_LIST_AVAILABLE_ENGINES_TOOLTIP),
1280 SetDataTip(STR_VEHICLE_LIST_MANAGE_LIST, STR_VEHICLE_LIST_MANAGE_LIST_TOOLTIP),
1282 SetDataTip(SPR_FLAG_VEH_STOPPED, STR_VEHICLE_LIST_MASS_STOP_LIST_TOOLTIP),
1284 SetDataTip(SPR_FLAG_VEH_RUNNING, STR_VEHICLE_LIST_MASS_START_LIST_TOOLTIP),
1293 static void DrawSmallOrderList(
const Vehicle *v,
int left,
int right,
int y,
VehicleOrderID start = 0)
1296 if (order == NULL)
return;
1307 if (order->
IsType(OT_GOTO_STATION)) {
1309 DrawString(left + l_offset, right - r_offset, y, STR_TINY_BLACK_STATION);
1312 if (++i == 4)
break;
1316 order = order->
next;
1317 if (order == NULL) {
1321 }
while (oid != start);
1340 default: NOT_REACHED();
1357 if (divisor == 1)
return base;
1360 uint rem = base % divisor;
1361 return base + (rem == 0 ? 0 : divisor - rem);
1378 int text_left = left + (rtl ? 0 : text_offset);
1379 int text_right = right - (rtl ? text_offset : 0);
1382 int orderlist_left = left + (rtl ? 0 :
max(
ScaleGUITrad(100) + text_offset, width / 2));
1383 int orderlist_right = right - (rtl ?
max(
ScaleGUITrad(100) + text_offset, width / 2) : 0);
1385 int image_left = (rtl && show_orderlist) ? orderlist_right : text_left;
1386 int image_right = (!rtl && show_orderlist) ? orderlist_left : text_right;
1388 int vehicle_button_x = rtl ? right -
GetSpriteSize(SPR_PROFIT_LOT).width :
left;
1402 if (v->
name != NULL) {
1405 DrawString(text_left, text_right, y, STR_TINY_BLACK_VEHICLE);
1409 DrawString(text_left, text_right, y, STR_TINY_GROUP, TC_BLACK);
1412 if (show_orderlist) DrawSmallOrderList(v, orderlist_left, orderlist_right, y, v->
cur_real_order_index);
1415 str = STR_BLUE_COMMA;
1457 default: NOT_REACHED();
1467 this->BuildVehicleList();
1468 this->SortVehicleList();
1471 this->GetWidget<NWidgetCore>(
WID_VL_LIST)->tool_tip = STR_VEHICLE_LIST_TRAIN_LIST_TOOLTIP + this->
vli.
vtype;
1473 if (this->
vli.
type == VL_SHARED_ORDERS) {
1474 this->GetWidget<NWidgetCore>(
WID_VL_CAPTION)->widget_data = STR_VEHICLE_LIST_SHARED_ORDERS_LIST_CAPTION;
1476 this->GetWidget<NWidgetCore>(
WID_VL_CAPTION)->widget_data = STR_VEHICLE_LIST_TRAIN_CAPTION + this->
vli.
vtype;
1497 size->height = 6 * resize->height;
1501 size->height = 4 * resize->height;
1503 default: NOT_REACHED();
1510 d.height += padding.height;
1511 *size =
maxdim(*size, d);
1517 d.height += padding.height;
1518 d.width += padding.width;
1519 *size =
maxdim(*size, d);
1534 case VL_SHARED_ORDERS:
1549 case VL_STATION_LIST:
1561 default: NOT_REACHED();
1584 this->BuildVehicleList();
1585 this->SortVehicleList();
1671 default: NOT_REACHED();
1674 default: NOT_REACHED();
1683 StationID station = (this->
vli.
type == VL_STATION_LIST) ? this->
vli.
index : INVALID_STATION;
1685 DEBUG(misc, 3,
"Periodic resort %d list company %d at station %d", this->
vli.
vtype, this->owner, station);
1702 if (!gui_scope &&
HasBit(data, 31) && this->
vli.
type == VL_SHARED_ORDERS) {
1705 this->window_number = this->
vli.
Pack();
1720 WDP_AUTO,
"list_vehicles", 260, 246,
1723 _nested_vehicle_list,
lengthof(_nested_vehicle_list)
1727 WDP_AUTO,
"list_vehicles_train", 325, 246,
1730 _nested_vehicle_list,
lengthof(_nested_vehicle_list)
1739 AllocateWindowDescFront<VehicleListWindow>(&_vehicle_list_train_desc, num);
1742 AllocateWindowDescFront<VehicleListWindow>(&_vehicle_list_other_desc, num);
1756 ShowVehicleListWindowLocal(company, VL_STANDARD, vehicle_type, company);
1760 void ShowVehicleListWindow(
const Vehicle *v)
1767 ShowVehicleListWindowLocal(company, VL_STATION_LIST, vehicle_type, station);
1772 uint16 depot_airport_index;
1779 ShowVehicleListWindowLocal(company, VL_DEPOT_LIST, vehicle_type, depot_airport_index);
1808 SetDataTip(STR_EMPTY, STR_SERVICE_INTERVAL_DROPDOWN_TOOLTIP),
1826 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),
1835 SetDataTip(STR_EMPTY, STR_SERVICE_INTERVAL_DROPDOWN_TOOLTIP),
1842 SetDataTip(STR_VEHICLE_DETAIL_TAB_INFORMATION, STR_VEHICLE_DETAILS_TRAIN_INFORMATION_TOOLTIP),
SetFill(1, 0),
SetResize(1, 0),
1846 SetDataTip(STR_VEHICLE_DETAIL_TAB_TOTAL_CARGO, STR_VEHICLE_DETAILS_TRAIN_TOTAL_CARGO_TOOLTIP),
SetFill(1, 0),
SetResize(1, 0),
1858 static StringID _service_interval_dropdown[] = {
1859 STR_VEHICLE_DETAILS_DEFAULT,
1860 STR_VEHICLE_DETAILS_DAYS,
1861 STR_VEHICLE_DETAILS_PERCENT,
1881 this->owner = v->
owner;
1897 if (!gui_scope)
return;
1903 if (aimed_height != nwid_info->
current_y) {
1916 uint desired_height;
1921 for (
const Vehicle *u = v; u != NULL; u = u->
Next()) {
1927 return desired_height;
1938 static const StringID info_strings[] = {
1939 STR_VEHICLE_INFO_MAX_SPEED,
1940 STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED,
1941 STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE,
1942 STR_VEHICLE_INFO_PROFIT_THIS_YEAR_LAST_YEAR,
1943 STR_VEHICLE_INFO_RELIABILITY_BREAKDOWNS
1945 for (uint i = 0; i <
lengthof(info_strings); i++) {
1977 size->height = 4 * resize->height;
1981 StringID *strs = _service_interval_dropdown;
1985 size->width += padding.width;
2003 switch (vehicle_type) {
2004 default: NOT_REACHED();
2030 default: NOT_REACHED();
2049 SetDParam(0, (v->
age + DAYS_IN_YEAR < v->max_age) ? STR_VEHICLE_INFO_AGE : STR_VEHICLE_INFO_AGE_RED);
2066 string = STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED;
2068 string = STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE;
2074 string = STR_VEHICLE_INFO_MAX_SPEED_RANGE;
2076 string = STR_VEHICLE_INFO_MAX_SPEED;
2105 uint text_left = r.left + (rtl ? 0 : sprite_width);
2106 uint text_right = r.right - (rtl ? sprite_width : 0);
2112 uint sprite_left = rtl ? text_right : r.left;
2113 uint sprite_right = rtl ? r.right : text_left;
2126 v->ServiceIntervalIsPercent() ? STR_VEHICLE_DETAILS_SERVICING_INTERVAL_PERCENT : STR_VEHICLE_DETAILS_SERVICING_INTERVAL_DAYS);
2149 StringID str = v->ServiceIntervalIsCustom() ?
2150 (v->ServiceIntervalIsPercent() ? STR_VEHICLE_DETAILS_PERCENT : STR_VEHICLE_DETAILS_DAYS) :
2151 STR_VEHICLE_DETAILS_DEFAULT;
2175 if (mod == v->GetServiceInterval())
return;
2183 ShowDropDownMenu(
this, _service_interval_dropdown, v->ServiceIntervalIsCustom() ? (v->ServiceIntervalIsPercent() ? 2 : 1) : 0, widget, 0, 0);
2210 bool iscustom = index != 0;
2211 bool ispercent = iscustom ? (index == 2) :
Company::Get(v->
owner)->settings.vehicle.servint_ispercent;
2221 if (str == NULL)
return;
2237 WDP_AUTO,
"view_vehicle_details_train", 405, 178,
2240 _nested_train_vehicle_details_widgets,
lengthof(_nested_train_vehicle_details_widgets)
2245 WDP_AUTO,
"view_vehicle_details", 405, 113,
2248 _nested_nontrain_vehicle_details_widgets,
lengthof(_nested_nontrain_vehicle_details_widgets)
2275 NWidget(
NWID_VIEWPORT, INVALID_COLOUR,
WID_VV_VIEWPORT),
SetMinimalSize(226, 84),
SetResize(1, 1),
SetPadding(1, 1, 1, 1),
2286 SetDataTip(SPR_IGNORE_SIGNALS, STR_VEHICLE_VIEW_TRAIN_IGNORE_SIGNAL_TOOLTIP),
2290 SetDataTip(SPR_FORCE_VEHICLE_TURN, STR_VEHICLE_VIEW_ROAD_VEHICLE_REVERSE_TOOLTIP),
2305 WDP_AUTO,
"view_vehicle", 250, 116,
2308 _nested_vehicle_view_widgets,
lengthof(_nested_vehicle_view_widgets)
2316 WDP_AUTO,
"view_vehicle_train", 250, 134,
2319 _nested_vehicle_view_widgets,
lengthof(_nested_vehicle_view_widgets)
2339 static const int VV_INITIAL_VIEWPORT_WIDTH = 226;
2340 static const int VV_INITIAL_VIEWPORT_HEIGHT = 84;
2341 static const int VV_INITIAL_VIEWPORT_HEIGHT_TRAIN = 102;
2345 VCT_CMD_START_STOP = 0,
2347 VCT_CMD_TURN_AROUND,
2381 if (result.
Failed())
return;
2457 static const SpriteID vehicle_view_goto_depot_sprites[] = {
2458 SPR_SEND_TRAIN_TODEPOT,
2459 SPR_SEND_ROADVEH_TODEPOT,
2460 SPR_SEND_SHIP_TODEPOT,
2461 SPR_SEND_AIRCRAFT_TODEPOT,
2464 this->GetWidget<NWidgetCore>(
WID_VV_GOTO_DEPOT)->widget_data = vehicle_view_goto_depot_sprites[v->
type];
2467 static const SpriteID vehicle_view_clone_sprites[] = {
2473 this->GetWidget<NWidgetCore>(
WID_VV_CLONE)->widget_data = vehicle_view_clone_sprites[v->
type];
2477 this->GetWidget<NWidgetCore>(
WID_VV_TURN_AROUND)->tool_tip = STR_VEHICLE_VIEW_TRAIN_REVERSE_TOOLTIP;
2488 default: NOT_REACHED();
2492 this->GetWidget<NWidgetViewport>(
WID_VV_VIEWPORT)->InitializeViewport(
this, this->window_number | (1 << 31), _vehicle_view_zoom_levels[v->
type]);
2494 this->GetWidget<NWidgetCore>(
WID_VV_START_STOP)->tool_tip = STR_VEHICLE_VIEW_TRAIN_STATE_START_STOP_TOOLTIP + v->
type;
2496 this->GetWidget<NWidgetCore>(
WID_VV_REFIT)->tool_tip = STR_VEHICLE_VIEW_TRAIN_REFIT_TOOLTIP + v->
type;
2498 this->GetWidget<NWidgetCore>(
WID_VV_SHOW_ORDERS)->tool_tip = STR_VEHICLE_VIEW_TRAIN_ORDERS_TOOLTIP + v->
type;
2500 this->GetWidget<NWidgetCore>(
WID_VV_CLONE)->tool_tip = STR_VEHICLE_VIEW_CLONE_TRAIN_INFO + v->
type;
2527 size->width = VV_INITIAL_VIEWPORT_WIDTH;
2528 size->height = (v->
type ==
VEH_TRAIN) ? VV_INITIAL_VIEWPORT_HEIGHT_TRAIN : VV_INITIAL_VIEWPORT_HEIGHT;
2533 virtual void OnPaint()
2540 this->SetWidgetDisabledState(
WID_VV_REFIT, !refitable_and_stopped_in_depot || !is_localcompany);
2541 this->SetWidgetDisabledState(
WID_VV_CLONE, !is_localcompany);
2549 this->DrawWidgets();
2552 virtual void SetStringParameters(
int widget)
const
2560 virtual void DrawWidget(
const Rect &r,
int widget)
const
2567 str = STR_VEHICLE_STATUS_CRASHED;
2569 str = STR_VEHICLE_STATUS_BROKEN_DOWN;
2574 str = STR_VEHICLE_STATUS_TRAIN_NO_POWER;
2576 str = STR_VEHICLE_STATUS_STOPPED;
2580 str = STR_VEHICLE_STATUS_TRAIN_STOPPING_VEL;
2583 str = STR_VEHICLE_STATUS_STOPPED;
2586 str = STR_VEHICLE_STATUS_TRAIN_STUCK;
2588 str = STR_VEHICLE_STATUS_AIRCRAFT_TOO_FAR;
2591 case OT_GOTO_STATION: {
2594 str = STR_VEHICLE_STATUS_HEADING_FOR_STATION_VEL;
2598 case OT_GOTO_DEPOT: {
2611 str = STR_VEHICLE_STATUS_HEADING_FOR_DEPOT_VEL;
2613 str = STR_VEHICLE_STATUS_HEADING_FOR_DEPOT_SERVICE_VEL;
2619 str = STR_VEHICLE_STATUS_LOADING_UNLOADING;
2622 case OT_GOTO_WAYPOINT: {
2625 str = STR_VEHICLE_STATUS_HEADING_FOR_WAYPOINT_VEL;
2630 case OT_LEAVESTATION:
2632 str = STR_VEHICLE_STATUS_LEAVING;
2639 str = STR_VEHICLE_STATUS_NO_ORDERS_VEL;
2653 int image_left = (rtl ? text_right + 1 : r.left) +
WD_IMGBTN_LEFT;
2654 int image = ((v->
vehstatus &
VS_STOPPED) != 0) ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING;
2660 virtual void OnClick(
Point pt,
int widget,
int click_count)
2696 ShowOrdersWindow(v);
2708 _vehicle_command_translation_table[VCT_CMD_CLONE_VEH][v->
type],
2714 _vehicle_command_translation_table[VCT_CMD_TURN_AROUND][v->
type]);
2723 virtual void OnResize()
2725 if (this->viewport != NULL) {
2731 virtual void OnTick()
2739 PlaneSelections plane = veh_stopped ? SEL_DC_CLONE : SEL_DC_GOTO_DEPOT;
2741 if (nwi->
shown_plane + SEL_DC_BASEPLANE != plane) {
2742 this->SelectPlane(plane);
2747 PlaneSelections plane = veh_stopped ? SEL_RT_REFIT : SEL_RT_TURN_AROUND;
2749 if (nwi->
shown_plane + SEL_RT_BASEPLANE != plane) {
2750 this->SelectPlane(plane);
2761 virtual void OnInvalidateData(
int data = 0,
bool gui_scope =
true)
2804 void StopGlobalFollowVehicle(
const Vehicle *v)
2823 if (result.
Failed())
return;
2861 int vehicle_width = 0;
2862 for (
const Vehicle *u = v; u != NULL; u = u->
Next()) {
2865 return vehicle_width;
2881 int total_width = 0;
2883 if (total_width >= 2 * (
int)VEHICLEINFO_FULL_VEHICLE_WIDTH)
break;
2891 for (uint i = 0; i < seq.count; ++i) {
2903 int offs = ((int)VEHICLEINFO_FULL_VEHICLE_WIDTH - total_width) / 2;
2904 if (rtl) offs = -offs;