|
OpenTTD Source
13.0-beta2
|
Go to the documentation of this file.
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),
66 SetDataTip(SPR_GROUP_LIVERY_TRAIN, STR_GROUP_LIVERY_TOOLTIP),
69 SetDataTip(SPR_GROUP_REPLACE_OFF_TRAIN, STR_GROUP_REPLACE_PROTECTION_TOOLTIP),
86 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),
92 SetDataTip(STR_BLACK_STRING, STR_VEHICLE_LIST_AVAILABLE_ENGINES_TOOLTIP),
95 SetDataTip(STR_VEHICLE_LIST_MANAGE_LIST, STR_VEHICLE_LIST_MANAGE_LIST_TOOLTIP),
97 SetDataTip(SPR_FLAG_VEH_STOPPED, STR_VEHICLE_LIST_MASS_STOP_LIST_TOOLTIP),
99 SetDataTip(SPR_FLAG_VEH_RUNNING, STR_VEHICLE_LIST_MASS_START_LIST_TOOLTIP),
134 for (
const Group *g : *source) {
135 if (g->parent !=
parent)
continue;
136 this->groups.push_back(g);
137 this->indents.push_back(indent);
140 auto child = std::find_if(source->begin(), source->end(), [g](
const Group *child){ return child->parent == g->index; });
141 bool has_children = child != source->end();
144 AddChildren(source, g->index, indent + 1);
158 this->groups.clear();
159 this->indents.clear();
164 if (g->owner ==
owner && g->vehicle_type == this->vli.vtype) {
172 const Group *last_group[2] = {
nullptr,
nullptr };
173 char last_name[2][64] = {
"",
"" };
175 if (a != last_group[0]) {
178 GetString(last_name[0], STR_GROUP_NAME,
lastof(last_name[0]));
181 if (b != last_group[1]) {
184 GetString(last_name[1], STR_GROUP_NAME,
lastof(last_name[1]));
187 int r =
strnatcmp(last_name[0], last_name[1]);
194 this->groups.shrink_to_fit();
205 this->tiny_step_height = this->column_size[
VGC_FOLD].height;
209 this->tiny_step_height = std::max(this->tiny_step_height, this->column_size[
VGC_NAME].
height);
212 this->tiny_step_height = std::max(this->tiny_step_height, this->column_size[
VGC_PROTECT].
height);
215 this->tiny_step_height = std::max(this->tiny_step_height, this->column_size[
VGC_AUTOREPLACE].
height);
219 static const SpriteID profit_sprites[] = {SPR_PROFIT_NA, SPR_PROFIT_NEGATIVE, SPR_PROFIT_SOME, SPR_PROFIT_LOT};
220 for (uint i = 0; i <
lengthof(profit_sprites); i++) {
224 this->tiny_step_height = std::max(this->tiny_step_height, this->column_size[
VGC_PROFIT].
height);
230 this->tiny_step_height = std::max(this->tiny_step_height, this->column_size[
VGC_NUMBER].
height);
254 void DrawGroupInfo(
int y,
int left,
int right,
GroupID g_id,
int indent = 0,
bool protection =
false,
bool has_children =
false)
const
257 if (g_id == this->group_over) {
271 DrawSprite(
Group::Get(g_id)->folded ? SPR_CIRCLE_FOLDED : SPR_CIRCLE_UNFOLDED, PAL_NONE, rtl ? x - indent : x + indent, y + (this->tiny_step_height - this->column_size[
VGC_FOLD].
height) / 2);
277 str = STR_GROUP_ALL_TRAINS + this->
vli.
vtype;
278 }
else if (IsDefaultGroupID(g_id)) {
279 str = STR_GROUP_DEFAULT_TRAINS + this->
vli.
vtype;
282 str = STR_GROUP_NAME;
285 DrawString(x + (rtl ? 0 : indent), x + this->column_size[
VGC_NAME].
width - 1 - (rtl ? indent : 0), y + (this->tiny_step_height - this->column_size[
VGC_NAME].
height) / 2, str, colour);
289 if (protection)
DrawSprite(SPR_GROUP_REPLACE_PROTECT, PAL_NONE, x, y + (this->tiny_step_height - this->column_size[
VGC_PROTECT].
height) / 2);
300 if (num_profit_vehicle == 0) {
302 }
else if (profit_last_year < 0) {
303 spr = SPR_PROFIT_NEGATIVE;
305 spr = SPR_PROFIT_SOME;
307 spr = SPR_PROFIT_LOT;
315 if (
IsAllGroupID(g_id) || IsDefaultGroupID(g_id) || num_vehicle_with_subgroups == num_vehicle) {
320 SetDParam(1, num_vehicle_with_subgroups - num_vehicle);
334 }
else if (IsDefaultGroupID(this->group_over)) {
354 this->BuildVehicleList();
355 this->SortVehicleList();
360 this->group_sb->
SetCount((uint)this->groups.size());
362 this->GetWidget<NWidgetCore>(
WID_GL_CAPTION)->widget_data = STR_VEHICLE_LIST_TRAIN_CAPTION + this->
vli.
vtype;
398 d.height += padding.height;
406 size->height = 4 *
resize->height;
411 d.height += padding.height;
412 d.width += padding.width;
483 this->BuildVehicleList();
484 this->SortVehicleList();
488 this->group_sb->
SetCount(
static_cast<int>(this->groups.size()));
524 uint16 protect_sprite = SPR_GROUP_REPLACE_OFF_TRAIN;
554 uint64 occupancy = 0;
557 assert(v->owner == this->owner);
559 this_year += v->GetDisplayProfitThisYear();
560 last_year += v->GetDisplayProfitLastYear();
561 occupancy += v->trip_occupancy;
566 DrawString(tr, STR_GROUP_PROFIT_THIS_YEAR, TC_BLACK);
571 DrawString(tr, STR_GROUP_PROFIT_LAST_YEAR, TC_BLACK);
576 DrawString(tr, STR_GROUP_OCCUPANCY, TC_BLACK);
577 const size_t vehicle_count = this->vehicles.size();
578 if (vehicle_count > 0) {
588 int max = std::min<size_t>(this->group_sb->
GetPosition() + this->group_sb->GetCapacity(), this->groups.size());
589 for (
int i = this->group_sb->
GetPosition(); i < max; ++i) {
590 const Group *g = this->groups[i];
592 assert(g->
owner == this->owner);
598 if ((uint)this->group_sb->
GetPosition() + this->group_sb->GetCapacity() > this->groups.size()) {
612 uint max =
static_cast<uint
>(std::min<size_t>(this->vscroll->
GetPosition() + this->vscroll->GetCapacity(), this->vehgroups.size()));
613 for (uint i = this->vscroll->
GetPosition(); i < max; ++i) {
615 if (v->
group_id != this->vli.index) {
627 static void DeleteGroupCallback(
Window *win,
bool confirmed)
665 if (!IsDefaultGroupID(this->
vli.
index)) {
674 if (id_g >= this->groups.size())
return;
676 if (
groups[id_g]->folded || (id_g + 1 < this->groups.size() && this->indents[id_g + 1] > this->indents[id_g])) {
678 NWidgetCore *group_display = this->GetWidget<NWidgetCore>(widget);
682 if (click_count > 1 || (pt.x >= x && pt.x < (
int)(x + this->column_size[
VGC_FOLD].width))) {
688 if (g ==
groups[id_g]->index) {
703 this->group_sel = this->
vli.
index = this->groups[id_g]->index;
714 if (id_v >= this->
vehgroups.size())
return;
722 const Vehicle *v2 = vehgroup.GetSingleVehicle();
728 case GB_SHARED_ORDERS: {
729 assert(vehgroup.NumVehicles() > 0);
772 this->group_confirm = this->
vli.
index;
773 ShowQuery(STR_QUERY_GROUP_DELETE_CAPTION, STR_GROUP_DELETE_QUERY_TEXT,
this, DeleteGroupCallback);
778 this->ShowRenameGroupWindow(this->
vli.
index,
false);
810 void OnDragDrop_Group(
Point pt,
int widget)
830 if (this->group_sel != new_g && g->
parent != new_g) {
842 void OnDragDrop_Vehicle(
Point pt,
int widget)
861 GroupID new_g = id_g >= this->groups.size() ?
NEW_GROUP : this->groups[id_g]->index;
874 if (id_v >= this->
vehgroups.size())
return;
879 const Vehicle *v = vehgroup.GetSingleVehicle();
886 case GB_SHARED_ORDERS: {
889 if (vindex == v->
index) {
890 if (vehgroup.NumVehicles() == 1) {
893 ShowVehicleListWindow(v);
911 if (this->group_sel !=
INVALID_GROUP) OnDragDrop_Group(pt, widget);
932 this->UpdateVehicleGroupBy(
static_cast<GroupBy
>(index));
966 default: NOT_REACHED();
970 default: NOT_REACHED();
978 if (this->groups.
NeedResort() || this->vehgroups.NeedResort()) {
1006 new_group_over = id_g >= this->groups.size() ?
NEW_GROUP : this->groups[id_g]->index;
1019 if (new_group_over != this->group_over) {
1021 this->group_over = new_group_over;
1026 void ShowRenameGroupWindow(
GroupID group,
bool empty)
1029 this->group_rename = group;
1034 str = STR_GROUP_NAME;
1069 this->group_sb->
SetCount((uint)this->groups.size());
1085 _nested_group_widgets,
lengthof(_nested_group_widgets)
1089 WDP_AUTO,
"list_groups_train", 525, 246,
1092 _nested_group_widgets,
lengthof(_nested_group_widgets)
1109 w = AllocateWindowDescFront<VehicleGroupWindow>(&_train_group_desc, num, need_existing_window);
1112 w = AllocateWindowDescFront<VehicleGroupWindow>(&_other_group_desc, num, need_existing_window);
1144 if (w !=
nullptr) w->ShowRenameGroupWindow(gid,
true);
1158 if (result.
Failed())
return;
1173 if (result.
Failed())
return;
@ VEH_AIRCRAFT
Aircraft vehicle type.
byte cargo_filter_criteria
Selected cargo filter index.
void SelectGroup(const GroupID g_id)
Selects the specified group in the list.
Dimension GetActionDropdownSize(bool show_autoreplace, bool show_group)
Compute the size for the Action dropdown.
@ WC_INVALID
Invalid window.
uint8 SortType() const
Get the sorttype of the list.
static Titem * Get(size_t index)
Returns Titem with given index.
@ GF_REPLACE_PROTECTION
If set to true, the global autoreplace has no effect on the group.
CompanyID company
The company associated with this list.
Dimensions (a width and height) of a rectangle in 2D.
void DrawSortButtonState(int widget, SortButtonState state) const
Draw a sort button's up or down arrow symbol.
static Titem * GetIfValid(size_t index)
Returns Titem with given index.
bool Sort(Comp compare)
Sort the list.
const Scrollbar * GetScrollbar(uint widnum) const
Return the Scrollbar to a widget index.
Commands
List of commands.
Rect Shrink(int s) const
Copy and shrink Rect by s pixels.
GroupBy grouping
How we want to group the list.
The information about a vehicle list.
SpecialMouseMode _special_mouse_mode
Mode of the mouse.
GroupID group_confirm
Group awaiting delete confirmation.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
uint tiny_step_height
Step height for the group list.
@ VGC_AUTOREPLACE
Autoreplace active icon.
bool vehchain
vehicle chain is dragged
GroupID group_rename
Group being renamed, INVALID_GROUP if none.
void CreateNestedTree(bool fill_nested=true)
Perform the first part of the initialization of a nested widget tree.
GroupID parent
Parent group.
Tindex index
Index of this pool item.
void DirtyHighlightedGroupWidget()
Mark the widget containing the currently highlighted group as dirty.
GroupID group_id
Index of group Pool array.
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
Window * FindWindowById(WindowClass cls, WindowNumber number)
Find a window by its class and window number.
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
Listing * sorting
Pointer to the vehicle type related sorting.
static constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
void ShowCompanyGroup(CompanyID company, VehicleType vehicle_type, GroupID group=INVALID_GROUP, bool need_existing_window=false)
Show the group window for the given company and vehicle type.
bool _ctrl_pressed
Is Ctrl pressed?
@ FILLRECT_CHECKER
Draw only every second pixel, used for greying-out.
bool autoreplace_finished
Have all autoreplacement finished?
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
void OnPaint() override
The window must be repainted.
void UnselectVehicle(VehicleID vehicle)
Tests whether a given vehicle is selected in the window, and unselects it if necessary.
VehicleList::const_iterator vehicles_begin
Pointer to beginning element of this vehicle group.
int DrawString(int left, int right, int top, const char *str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly truncated to make it fit in its allocated space.
WindowClass cls
Class of the window,.
static const uint MAX_LENGTH_GROUP_NAME_CHARS
The maximum length of a group name in characters including '\0'.
Owner owner
The owner of the content shown in this window. Company colour is acquired from this variable.
void OnGameTick() override
Called once per (game) tick.
int32 WindowNumber
Number to differentiate different windows of the same class.
@ SA_RIGHT
Right align the text (must be a single bit).
@ VGC_FOLD
Fold / Unfold button.
@ VEH_ROAD
Road vehicle type.
void SetSortType(uint8 n_type)
Set the sorttype of the list.
Owner owner
Which company owns the vehicle?
Owner
Enum for all companies/owners.
Dimension column_size[VGC_END]
Size of the columns in the group list.
static const GroupID NEW_GROUP
Sentinel for a to-be-created group.
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
Update size and resize step of a widget in the window.
byte _colour_gradient[COLOUR_END][8]
All 16 colour gradients 8 colours per gradient from darkest (0) to lightest (7)
Rect WithHeight(int height, bool end=false) const
Copy Rect and set its height.
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.
void SetCargoFilterIndex(byte index)
Set cargo filter list item index.
std::vector< int > indents
Indentation levels.
Dimension GetStringBoundingBox(const char *str, FontSize start_fontsize)
Return the string dimension in pixels.
uint16 num_vehicle
Number of vehicles.
@ QSF_LEN_IN_CHARS
the length of the string is counted in characters
@ Service
The vehicle will leave the depot right after arrival (service only)
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
static const GroupID ALL_GROUP
All vehicles are in this group.
High level window description.
@ Rename
Change group name.
Statistics and caches on the vehicles in a group.
VehicleListIdentifier vli
Identifier of the vehicle list we want to currently show.
@ WC_QUERY_STRING
Query string window; Window numbers:
DropDownList BuildActionDropdownList(bool show_autoreplace, bool show_group)
Display the Action dropdown window.
bool IsDescSortOrder() const
Check if the sort order is descending.
@ WDP_AUTO
Find a place automatically.
static const GroupID INVALID_GROUP
Sentinel for invalid groups.
ResizeInfo resize
Resize information.
Common return value for all commands.
Rect Translate(int x, int y) const
Copy and translate Rect by x,y pixels.
void ShowCompanyGroupForVehicle(const Vehicle *v)
Show the group window for the given vehicle.
int height
Height of the window (number of pixels down in y direction)
bool VehicleClicked(const Vehicle *v)
Dispatch a "vehicle selected" event if any window waits for it.
static const VehicleID INVALID_VEHICLE
Constant representing a non-existing vehicle.
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
void OnQueryTextFinished(char *str) override
The query window opened from this window has closed.
@ MassSend
Tells that it's a mass send to depot command (type in VLW flag)
@ FS_SMALL
Index of the small font in the font tables.
uint ComputeGroupInfoSize()
Compute tiny_step_height and column_size.
int find_index(std::vector< T > const &vec, T const &item)
Helper function to get the index of an item Consider using std::set, std::unordered_set or std::flat_...
bool Failed() const
Did this command fail?
void ShowDropDownList(Window *w, DropDownList &&list, int selected, int button, uint width, bool auto_width, bool instant_close)
Show a drop down list.
uint GetVehicleListHeight(VehicleType type, uint divisor)
Get the height of a vehicle in the vehicle list GUIs.
@ VGC_NUMBER
Number of vehicles in the group.
uint32 Pack() const
Pack a VehicleListIdentifier in a single uint32.
void OnDragDrop(Point pt, int widget) override
A dragged 'object' has been released.
@ SA_FORCE
Force the alignment, i.e. don't swap for RTL languages.
Window * parent
Parent window.
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
void ShowQueryString(StringID str, StringID caption, uint maxsize, Window *parent, CharSetFilter afilter, QueryStringFlags flags)
Show a query popup window with a textbox in it.
int left
x position of left edge of the window
static GroupStatistics & Get(CompanyID company, GroupID id_g, VehicleType type)
Returns the GroupStatistics for a specific group.
static const GroupID DEFAULT_GROUP
Ungrouped vehicles are in this group.
void SetMouseCursorVehicle(const Vehicle *v, EngineImageType image_type)
Set the mouse cursor to look like a vehicle.
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
static bool IsAllGroupID(GroupID id_g)
Checks if a GroupID stands for all vehicles of a company.
Coordinates of a point in 2D.
@ WC_TRAINS_LIST
Trains list; Window numbers:
@ WSM_DRAGDROP
Drag&drop an object.
void CcAddVehicleNewGroup(Commands cmd, const CommandCost &result, GroupID new_group, GroupID, VehicleID veh_id, bool)
Open rename window after adding a vehicle to a new group via drag and drop.
void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int button, uint32 disabled_mask, uint32 hidden_mask, uint width)
Show a dropdown menu window near a widget of the parent window.
WindowNumber window_number
Window number within the window class.
VehicleType
Available vehicle types.
void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectMode mode)
Applies a certain FillRectMode-operation to a rectangle [left, right] x [top, bottom] on the screen.
uint step_height
Step-size of height resize changes.
uint Vertical() const
Get total vertical padding of RectPadding.
void ToggleSortOrder()
Toggle the sort order Since that is the worst condition for the sort function reverse the list here.
bool NeedResort()
Check if a resort is needed next loop If used the resort timer will decrease every call till 0.
@ CS_ALPHANUMERAL
Both numeric and alphabetic and spaces and stuff.
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
@ VGC_PROTECT
Autoreplace protect icon.
uint32 index
A vehicle list type specific index.
bool autoreplace_defined
Are any autoreplace rules set?
@ HT_DRAG
dragging items in the depot windows
Dimension GetSpriteSize(SpriteID sprid, Point *offset, ZoomLevel zoom)
Get the size of a sprite.
bool NeedRebuild() const
Check if a rebuild is needed.
void DrawVehicleListItems(VehicleID selected_vehicle, int line_height, const Rect &r) const
Draw all the vehicle list items.
static WindowClass GetWindowClassForVehicleType(VehicleType vt)
Get WindowClass for vehicle list of given vehicle type.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
void ShowQuery(StringID caption, StringID message, Window *parent, QueryCallbackProc *callback)
Show a modal confirmation window with standard 'yes' and 'no' buttons The window is aligned to the ce...
@ SBS_DOWN
Sort ascending.
@ EIT_IN_LIST
Vehicle drawn in vehicle list, group list, ...
uint GetGroupNumProfitVehicle(CompanyID company, GroupID id_g, VehicleType type)
Get the number of vehicles above profit minimum age in the group with GroupID id_g and its sub-groups...
CompanyID _current_company
Company currently doing an action.
void DeleteGroupHighlightOfVehicle(const Vehicle *v)
Removes the highlight of a vehicle in a group window.
static const PaletteID PALETTE_CRASH
Recolour sprite greying of crashed vehicles.
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
uint16 GroupID
Type for all group identifiers.
GUIGroupList groups
List of groups.
int HideDropDownMenu(Window *pw)
Delete the drop-down menu from window pw.
void OnResize() override
Called after the window got resized.
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
GUIVehicleGroupList vehgroups
List of (groups of) vehicles. This stores iterators of vehicles, and should be rebuilt if vehicles is...
void ShowReplaceGroupVehicleWindow(GroupID id_g, VehicleType vehicletype)
Show the autoreplace configuration window for a particular group.
#define FONT_HEIGHT_NORMAL
Height of characters in the normal (FS_NORMAL) font.
VehicleType vtype
The vehicle type associated with this list.
void SetDParamMaxValue(uint n, uint64 max_value, uint min_count, FontSize size)
Set DParam n to some number that is suitable for string size computations.
void CloseWindowByClass(WindowClass cls)
Close all windows of a given class.
VehicleID vehicle_sel
Selected vehicle.
Listing GetListing() const
Export current sort conditions.
void CDECL SetWidgetsDisabledState(bool disab_stat, int widgets,...)
Sets the enabled/disabled status of a list of widgets.
GroupID group_over
Group over which a vehicle is dragged, INVALID_GROUP if none.
void DrawGroupInfo(int y, int left, int right, GroupID g_id, int indent=0, bool protection=false, bool has_children=false) const
Draw a row in the group list.
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
static void CcCreateGroup(GroupID gid, VehicleType veh_type)
Opens a 'Rename group' window for newly created group.
static VehicleGroupWindow * FindVehicleGroupWindow(VehicleType vt, Owner owner)
Finds a group list window determined by vehicle type and owner.
void ForceResort()
Force a resort next Sort call Reset the resort timer if used too.
void DrawWidget(const Rect &r, int widget) const override
Draw the contents of a nested widget.
uint32 VehicleID
The type all our vehicle IDs have.
void BuildGroupList(Owner owner)
(Re)Build the group list.
void ShowVehicleViewWindow(const Vehicle *v)
Shows the vehicle view window of the given vehicle.
@ SetParent
Change group parent.
void ForceRebuild()
Force that a rebuild is needed.
VehicleList vehicles
List of vehicles. This is the buffer for vehgroups to point into; if this is structurally modified,...
void OnDropdownSelect(int widget, int index) override
A dropdown option associated to this window has been selected.
#define lengthof(x)
Return the length of an fixed size array.
int width
width of the window (number of pixels to the right in x direction)
static int SortButtonWidth()
Get width of up/down arrow of sort button state.
uint GetGroupNumVehicle(CompanyID company, GroupID id_g, VehicleType type)
Get the number of vehicles in the group with GroupID id_g and its sub-groups.
void SetObjectToPlaceWnd(CursorID icon, PaletteID pal, HighLightStyle mode, Window *w)
Change the cursor and mouse click/drag handling to a mode for performing special operations like tile...
bool folded
NOSAVE: Is this group folded in the group view?
int strnatcmp(const char *s1, const char *s2, bool ignore_garbage_at_front)
Compares two strings using case insensitive natural sort.
static const CursorID SPR_CURSOR_MOUSE
Cursor sprite numbers.
void OnPlaceObjectAbort() override
The user cancelled a tile highlight mode that has been set.
StringID cargo_filter_texts[NUM_CARGO+4]
Texts for filter_cargo, terminated by INVALID_STRING_ID.
Data structure for an opened window.
void RebuildDone()
Notify the sortlist that the rebuild is done.
@ VEH_TRAIN
Train vehicle type.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
void RaiseWidget(byte widget_index)
Marks a widget as raised.
VehicleType type
Type of vehicle.
void DrawWidgets() const
Paint all widgets of a window.
void SetWidgetDirty(byte widget_index) const
Invalidate a widget, i.e.
Specification of a rectangle with absolute coordinates of all edges.
void OnMouseDrag(Point pt, int widget) override
An 'object' is being dragged at the provided position, highlight the target if possible.
@ QSF_ENABLE_DEFAULT
enable the 'Default' button ("\0" is returned)
#define lastof(x)
Get the last element of an fixed size array.
GroupID group_sel
Selected group (for drag/drop)
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows).
@ TD_RTL
Text is written right-to-left by default.
TextDirection _current_text_dir
Text direction of the currently selected language.
static const Money VEHICLE_PROFIT_THRESHOLD
Threshold for a vehicle to be considered making good profit.
void SetStringParameters(int widget) const override
Initialize string parameters for a widget.
Money GetGroupProfitLastYear(CompanyID company, GroupID id_g, VehicleType type)
Get last year's profit for the group with GroupID id_g and its sub-groups.