39 static const NWidgetPart _nested_group_widgets[] = {
60 SetDataTip(SPR_GROUP_CREATE_TRAIN, STR_GROUP_CREATE_TOOLTIP),
62 SetDataTip(SPR_GROUP_DELETE_TRAIN, STR_GROUP_DELETE_TOOLTIP),
64 SetDataTip(SPR_GROUP_RENAME_TRAIN, STR_GROUP_RENAME_TOOLTIP),
67 SetDataTip(SPR_GROUP_REPLACE_OFF_TRAIN, STR_GROUP_REPLACE_PROTECTION_TOOLTIP),
78 NWidget(
WWT_MATRIX, COLOUR_GREY,
WID_GL_LIST_VEHICLE),
SetMinimalSize(248, 0),
SetMatrixDataTip(1, 0, STR_NULL),
SetResize(1, 1),
SetFill(1, 0),
SetScrollbar(
WID_GL_LIST_VEHICLE_SCROLLBAR),
84 SetDataTip(STR_BLACK_STRING, STR_VEHICLE_LIST_AVAILABLE_ENGINES_TOOLTIP),
87 SetDataTip(STR_VEHICLE_LIST_MANAGE_LIST, STR_VEHICLE_LIST_MANAGE_LIST_TOOLTIP),
89 SetDataTip(SPR_FLAG_VEH_STOPPED, STR_VEHICLE_LIST_MASS_STOP_LIST_TOOLTIP),
91 SetDataTip(SPR_FLAG_VEH_RUNNING, STR_VEHICLE_LIST_MASS_START_LIST_TOOLTIP),
126 for (
const Group **g = source->
Begin(); g != source->
End(); g++) {
127 if ((*g)->parent == parent) {
130 AddParents(source, (*g)->index, indent + 1);
138 static const Group *last_group[2] = { NULL, NULL };
139 static char last_name[2][64] = {
"",
"" };
141 if (*a != last_group[0]) {
144 GetString(last_name[0], STR_GROUP_NAME,
lastof(last_name[0]));
147 if (*b != last_group[1]) {
150 GetString(last_name[1], STR_GROUP_NAME,
lastof(last_name[1]));
153 int r =
strnatcmp(last_name[0], last_name[1]);
154 if (r == 0)
return (*a)->index - (*b)->index;
206 static const SpriteID profit_sprites[] = {SPR_PROFIT_NA, SPR_PROFIT_NEGATIVE, SPR_PROFIT_SOME, SPR_PROFIT_LOT};
207 for (uint i = 0; i <
lengthof(profit_sprites); i++) {
254 str = STR_GROUP_ALL_TRAINS + this->
vli.
vtype;
255 }
else if (IsDefaultGroupID(g_id)) {
256 str = STR_GROUP_DEFAULT_TRAINS + this->
vli.
vtype;
259 str = STR_GROUP_NAME;
278 spr = SPR_PROFIT_NEGATIVE;
280 spr = SPR_PROFIT_SOME;
282 spr = SPR_PROFIT_LOT;
301 }
else if (IsDefaultGroupID(this->
group_over)) {
317 default: NOT_REACHED();
334 this->BuildVehicleList();
335 this->SortVehicleList();
341 this->GetWidget<NWidgetCore>(
WID_GL_CAPTION)->widget_data = STR_VEHICLE_LIST_TRAIN_CAPTION + this->
vli.
vtype;
388 d.height += padding.height;
396 size->height = 4 * resize->height;
401 d.height += padding.height;
402 d.width += padding.width;
469 this->BuildVehicleList();
470 this->SortVehicleList();
509 uint16 protect_sprite = SPR_GROUP_REPLACE_OFF_TRAIN;
536 assert(g->
owner == this->owner);
559 if (v->
group_id != this->vli.index) {
571 static void DeleteGroupCallback(
Window *win,
bool confirmed)
601 if (!IsDefaultGroupID(this->
vli.
index)) {
645 ShowQuery(STR_QUERY_GROUP_DELETE_CAPTION, STR_GROUP_DELETE_QUERY_TEXT,
this, DeleteGroupCallback);
650 this->ShowRenameGroupWindow(this->
vli.
index,
false);
679 void OnDragDrop_Group(
Point pt,
int widget)
711 void OnDragDrop_Vehicle(
Point pt,
int widget)
804 default: NOT_REACHED();
808 default: NOT_REACHED();
864 void ShowRenameGroupWindow(
GroupID group,
bool empty)
872 str = STR_GROUP_NAME;
893 _nested_group_widgets,
lengthof(_nested_group_widgets)
897 WDP_AUTO,
"list_groups_train", 525, 246,
900 _nested_group_widgets,
lengthof(_nested_group_widgets)
914 AllocateWindowDescFront<VehicleGroupWindow>(&_train_group_desc, num);
917 AllocateWindowDescFront<VehicleGroupWindow>(&_other_group_desc, num);
942 if (result.
Failed())
return;
946 if (w != NULL) w->ShowRenameGroupWindow(_new_group_id,
true);
958 if (result.
Failed())
return;