OpenTTD Source
1.11.0-beta2
|
Go to the documentation of this file.
37 #include "table/strings.h"
57 CargoTypes cargo_mask = 0;
72 default: NOT_REACHED();
74 if (cargoes[i] >= (supplies ? 1U : 8U))
SetBit(cargo_mask, i);
78 return DrawStringMultiLine(left, right, top, INT32_MAX, supplies ? STR_STATION_BUILD_SUPPLIES_CARGO : STR_STATION_BUILD_ACCEPTS_CARGO);
101 TileArea ta(
TileXY(std::max<int>(0, x - max_c), std::max<int>(0, y - max_c)),
TileXY(std::min<int>(
MapMaxX(), x + location.
w + max_c), std::min<int>(
MapMaxY(), y + location.
h + max_c)));
109 if (st ==
nullptr)
continue;
110 if (adjacent !=
nullptr && st != adjacent) {
129 static bool _last_ctrl_pressed;
135 if (_thd.
dirty & 1) {
162 static const uint units_full = 576;
163 static const uint rating_full = 224;
168 int colour = cs->rating_colour;
170 uint w = (std::min(amount, units_full) + 5) / 36;
175 if (w != 0)
GfxFillRect(left, y, left + w - 1, y + height, colour);
180 uint rest = amount / 5;
183 GfxFillRect(w, y + height - rest, w, y + height, colour);
192 rating = std::min<uint>(rating, rating_full) / 16;
206 static byte facilities;
207 static bool include_empty;
208 static const CargoTypes cargo_filter_max;
209 static CargoTypes cargo_filter;
212 static const StringID sorter_names[];
227 DEBUG(misc, 3,
"Building station list for company %d",
owner);
229 this->stations.clear();
233 if (this->facilities & st->facilities) {
234 int num_waiting_cargo = 0;
236 if (st->goods[j].HasRating()) {
238 if (
HasBit(this->cargo_filter, j)) {
239 this->stations.push_back(st);
245 if (num_waiting_cargo == 0 && this->include_empty) {
246 this->stations.push_back(st);
252 this->stations.shrink_to_fit();
255 this->vscroll->
SetCount((uint)this->stations.size());
261 int r =
strnatcmp(a->GetCachedName(), b->GetCachedName());
278 FOR_EACH_SET_CARGO_ID(j, cargo_filter) {
291 FOR_EACH_SET_CARGO_ID(j, cargo_filter) {
305 FOR_EACH_SET_CARGO_ID(j, cargo_filter) {
310 return maxr1 < maxr2;
320 if (!
HasBit(cargo_filter, j))
continue;
325 return minr1 > minr2;
331 if (!this->stations.
Sort())
return;
340 this->stations.
SetListing(this->last_sorting);
353 if (!
HasBit(this->cargo_filter, cs->
Index()))
continue;
357 if (this->cargo_filter == this->cargo_filter_max) this->cargo_filter =
_cargo_mask;
359 for (uint i = 0; i < 5; i++) {
369 this->last_sorting = this->stations.
GetListing();
378 d.height += padding.height;
388 d.width += padding.width;
389 d.height += padding.height;
411 d.width += padding.width + 2;
412 d.height += padding.height;
420 d.width += padding.width + 2;
421 d.height += padding.height;
446 int max = std::min<size_t>(this->vscroll->
GetPosition() + this->vscroll->GetCapacity(), this->stations.size());
448 for (
int i = this->vscroll->
GetPosition(); i < max; ++i) {
449 const Station *st = this->stations[i];
483 if (this->vscroll->
GetCount() == 0) {
511 int cg_ofst =
HasBit(this->cargo_filter, cs->
Index()) ? 2 : 1;
512 GfxFillRect(r.left + cg_ofst, r.top + cg_ofst, r.right - 2 + cg_ofst, r.bottom - 2 + cg_ofst, cs->rating_colour);
533 if (id_v >= this->stations.size())
return;
535 const Station *st = this->stations[id_v];
584 this->include_empty =
true;
601 this->include_empty = !this->include_empty;
608 this->cargo_filter = 0;
609 this->include_empty =
true;
631 this->cargo_filter = 0;
632 this->include_empty =
false;
646 if (this->stations.
SortType() != index) {
659 DEBUG(misc, 3,
"Periodic rebuild station list company %d", this->window_number);
685 Listing CompanyStationsWindow::last_sorting = {
false, 0};
687 bool CompanyStationsWindow::include_empty =
true;
688 const CargoTypes CompanyStationsWindow::cargo_filter_max = ALL_CARGOTYPES;
689 CargoTypes CompanyStationsWindow::cargo_filter = ALL_CARGOTYPES;
695 &StationWaitingTotalSorter,
696 &StationWaitingAvailableSorter,
697 &StationRatingMaxSorter,
698 &StationRatingMinSorter
702 const StringID CompanyStationsWindow::sorter_names[] = {
704 STR_SORT_BY_FACILITY,
705 STR_SORT_BY_WAITING_TOTAL,
706 STR_SORT_BY_WAITING_AVAILABLE,
707 STR_SORT_BY_RATING_MAX,
708 STR_SORT_BY_RATING_MIN,
726 panel->
SetDataTip(0, STR_STATION_LIST_USE_CTRL_TO_SELECT_MORE);
727 container->
Add(panel);
733 static const NWidgetPart _nested_company_stations_widgets[] = {
750 NWidget(
WWT_PANEL, COLOUR_GREY,
WID_STL_NOCARGOWAITING),
SetMinimalSize(14, 11),
SetDataTip(0x0, STR_STATION_LIST_NO_WAITING_CARGO),
SetFill(0, 1),
EndContainer(),
760 NWidget(
WWT_PANEL, COLOUR_GREY,
WID_STL_LIST),
SetMinimalSize(346, 125),
SetResize(1, 10),
SetDataTip(0x0, STR_STATION_LIST_TOOLTIP),
SetScrollbar(
WID_STL_SCROLLBAR),
EndContainer(),
769 WDP_AUTO,
"list_stations", 358, 162,
772 _nested_company_stations_widgets,
lengthof(_nested_company_stations_widgets)
784 AllocateWindowDescFront<CompanyStationsWindow>(&_company_stations_desc, company);
787 static const NWidgetPart _nested_station_view_widgets[] = {
799 NWidget(
WWT_DROPDOWN, COLOUR_GREY,
WID_SV_GROUP_BY),
SetMinimalSize(168, 12),
SetResize(1, 0),
SetFill(0, 1),
SetDataTip(0x0, STR_TOOLTIP_GROUP_ORDER),
803 NWidget(
WWT_DROPDOWN, COLOUR_GREY,
WID_SV_SORT_BY),
SetMinimalSize(168, 12),
SetResize(1, 0),
SetFill(0, 1),
SetDataTip(0x0, STR_TOOLTIP_SORT_CRITERIA),
812 SetDataTip(STR_STATION_VIEW_RATINGS_BUTTON, STR_STATION_VIEW_RATINGS_TOOLTIP),
814 SetDataTip(STR_STATION_VIEW_CLOSE_AIRPORT, STR_STATION_VIEW_CLOSE_AIRPORT_TOOLTIP),
815 NWidget(
WWT_TEXTBTN, COLOUR_GREY,
WID_SV_CATCHMENT),
SetMinimalSize(45, 12),
SetResize(1, 0),
SetFill(1, 1),
SetDataTip(STR_BUTTON_CATCHMENT, STR_TOOLTIP_CATCHMENT),
836 uint num = std::min<uint>((waiting + (width / 2)) / width, (right - left) / width);
837 if (num == 0)
return;
874 bool SortId(Tid st1, Tid st2)
const;
876 bool SortStation (StationID st1, StationID st2)
const;
879 typedef std::set<CargoDataEntry *, CargoSorter> CargoDataSet;
898 return this->InsertOrRetrieve<StationID>(
station);
908 return this->InsertOrRetrieve<CargoID>(
cargo);
990 CargoDataSet::iterator
End()
const {
return this->
children->end(); }
1031 CargoDataEntry::CargoDataEntry() :
1033 station(INVALID_STATION),
1044 children(new CargoDataSet)
1047 CargoDataEntry::CargoDataEntry(StationID station, uint count,
CargoDataEntry *parent) :
1052 children(new CargoDataSet)
1055 CargoDataEntry::CargoDataEntry(StationID station) :
1063 CargoDataEntry::CargoDataEntry(
CargoID cargo) :
1071 CargoDataEntry::~CargoDataEntry()
1083 for (CargoDataSet::iterator i = this->
children->begin(); i != this->children->end(); ++i) {
1102 CargoDataSet::iterator i = this->
children->find(child);
1119 CargoDataSet::iterator i = this->
children->find(&tmp);
1137 this->count +=
count;
1150 void CargoDataEntry::Resort(
CargoSortType type, SortOrder order)
1152 CargoDataSet *new_subs =
new CargoDataSet(this->
children->begin(), this->children->end(),
CargoSorter(type, order));
1169 switch (this->type) {
1175 return this->SortCount(cd1, cd2);
1184 bool CargoSorter::SortId(Tid st1, Tid st2)
const
1186 return (this->order == SO_ASCENDING) ? st1 < st2 : st2 < st1;
1195 }
else if (this->order == SO_ASCENDING) {
1202 bool CargoSorter::SortStation(StationID st1, StationID st2)
const
1205 return Station::IsValidID(st2) ? this->order == SO_ASCENDING : this->SortId(st1, st2);
1207 return order == SO_DESCENDING;
1212 return this->SortId(st1, st2);
1214 return (this->order == SO_ASCENDING) ? res < 0 : res > 0;
1246 typedef std::vector<RowDisplay> CargoDataVector;
1325 this->sort_orders[0] = SO_ASCENDING;
1352 if (count == 0)
return;
1355 for (
int i = 0; i <
NUM_COLUMNS && expand !=
nullptr; ++i) {
1364 if (auto_distributed || source != this->window_number) {
1370 if (auto_distributed) {
1376 if (auto_distributed) {
1437 if (this->GetWidget<NWidgetCore>(
WID_SV_ACCEPTS_RATINGS)->widget_data == STR_STATION_VIEW_RATINGS_BUTTON) {
1439 if (lines > this->accepts_lines) {
1440 this->accepts_lines = lines;
1446 if (lines > this->rating_lines) {
1447 this->rating_lines = lines;
1465 this->
DrawEntries(&cargo, waiting_rect, pos, maxrows, 0);
1486 cargo_entry->
Clear();
1489 for (FlowStatMap::const_iterator it = flows.begin(); it != flows.end(); ++it) {
1490 StationID from = it->first;
1492 const FlowStat::SharesMap *shares = it->second.GetShares();
1493 uint32 prev_count = 0;
1494 for (FlowStat::SharesMap::const_iterator flow_it = shares->begin(); flow_it != shares->end(); ++flow_it) {
1495 StationID via = flow_it->second;
1497 if (via == this->window_number) {
1502 prev_count = flow_it->first;
1521 FlowStatMap::const_iterator map_it = flowmap.find(source);
1522 if (map_it != flowmap.end()) {
1523 const FlowStat::SharesMap *shares = map_it->second.GetShares();
1524 uint32 prev_count = 0;
1525 for (FlowStat::SharesMap::const_iterator i = shares->begin(); i != shares->end(); ++i) {
1527 prev_count = i->first;
1534 uint sum_estimated = 0;
1535 while (sum_estimated < count) {
1536 for (CargoDataSet::iterator i = tmp.
Begin(); i != tmp.
End() && sum_estimated < count; ++i) {
1539 if (estimate == 0) estimate = 1;
1541 sum_estimated += estimate;
1542 if (sum_estimated > count) {
1543 estimate -= sum_estimated - count;
1544 sum_estimated = count;
1572 for (FlowStatMap::const_iterator it = flows.begin(); it != flows.end(); ++it) {
1573 StationID from = it->first;
1575 const FlowStat::SharesMap *shares = it->second.GetShares();
1576 for (FlowStat::SharesMap::const_iterator flow_it = shares->begin(); flow_it != shares->end(); ++flow_it) {
1578 for (CargoDataSet::iterator dest_it = via_entry->
Begin(); dest_it != via_entry->
End(); ++dest_it) {
1597 StationID next = it.GetKey();
1600 if (source_entry ==
nullptr) {
1606 if (via_entry ==
nullptr) {
1611 for (CargoDataSet::iterator dest_it = via_entry->
Begin(); dest_it != via_entry->
End(); ++dest_it) {
1629 if (this->cached_destinations.
Retrieve(i) ==
nullptr) {
1647 std::list<StationID> stations;
1649 if (
parent->GetParent() ==
nullptr) {
1655 while (
parent->GetParent()->GetParent() !=
nullptr) {
1656 stations.push_back(
parent->GetStation());
1662 while (!stations.empty()) {
1663 filter = filter->
Retrieve(stations.back());
1664 stations.pop_back();
1667 this->displayed_rows.push_back(
RowDisplay(filter, next));
1680 if (station == this->window_number) {
1682 }
else if (station == INVALID_STATION) {
1684 }
else if (station == NEW_STATION) {
1685 return STR_STATION_VIEW_RESERVED;
1688 return other_station;
1702 for (
int i = column - 1; i > 0; --i) {
1704 if (
parent->GetStation() == station) {
1705 return STR_STATION_VIEW_NONSTOP;
1707 return STR_STATION_VIEW_VIA;
1714 CargoDataSet::iterator begin = cd->
Begin();
1715 CargoDataSet::iterator end = cd->
End();
1716 if (begin != end && ++(cd->
Begin()) == end && (*(begin))->GetStation() == station) {
1717 return STR_STATION_VIEW_NONSTOP;
1719 return STR_STATION_VIEW_VIA;
1723 return STR_STATION_VIEW_VIA;
1739 if (this->groupings[column] !=
GR_CARGO) {
1743 entry->Resort(
ST_COUNT, this->sort_orders[column]);
1745 for (CargoDataSet::iterator i = entry->
Begin(); i != entry->
End(); ++i) {
1748 Grouping grouping = this->groupings[column];
1752 if (pos > -maxrows && pos <= 0) {
1758 if (this->groupings[column] ==
GR_CARGO) {
1759 str = STR_STATION_VIEW_WAITING_CARGO;
1762 if (!auto_distributed) grouping =
GR_SOURCE;
1767 str = this->
GetEntryString(station, STR_STATION_VIEW_FROM_HERE, STR_STATION_VIEW_FROM, STR_STATION_VIEW_FROM_ANY);
1770 str = this->
GetEntryString(station, STR_STATION_VIEW_VIA_HERE, STR_STATION_VIEW_VIA, STR_STATION_VIEW_VIA_ANY);
1771 if (str == STR_STATION_VIEW_VIA) str = this->
SearchNonStop(cd, station, column);
1774 str = this->
GetEntryString(station, STR_STATION_VIEW_TO_HERE, STR_STATION_VIEW_TO, STR_STATION_VIEW_TO_ANY);
1793 const char *sym =
nullptr;
1796 }
else if (auto_distributed && str != STR_STATION_VIEW_RESERVED) {
1805 if (sym)
DrawString(shrink_left, shrink_right, y, sym, TC_YELLOW);
1810 if (auto_distributed || column == 0) {
1811 pos = this->
DrawEntries(cd, r, pos, maxrows, column + 1, cargo);
1826 CargoTypes cargo_mask = 0;
1878 if (filter->
Retrieve(next) !=
nullptr) {
1891 if (row < 0 || (uint)row >= this->displayed_rows.size())
return;
1893 this->scroll_to_row = row;
1895 RowDisplay &display = this->displayed_rows[row];
1896 if (display.
filter == &this->expanded_rows) {
1897 this->HandleCargoWaitingClick<CargoID>(display.
filter, display.
next_cargo);
1928 if (this->GetWidget<NWidgetCore>(
WID_SV_ACCEPTS_RATINGS)->widget_data == STR_STATION_VIEW_RATINGS_BUTTON) {
1929 nwi->
SetDataTip(STR_STATION_VIEW_ACCEPTS_BUTTON, STR_STATION_VIEW_ACCEPTS_TOOLTIP);
1932 nwi->
SetDataTip(STR_STATION_VIEW_RATINGS_BUTTON, STR_STATION_VIEW_RATINGS_TOOLTIP);
1933 height_change = this->accepts_lines - this->
rating_lines;
1964 this->current_mode * 2 + (this->sortings[1] ==
ST_COUNT ? 1 : 0),
1975 this->
SelectSortOrder(this->sort_orders[1] == SO_ASCENDING ? SO_DESCENDING : SO_ASCENDING);
1989 this->sort_orders[1] = this->sort_orders[2] = this->sort_orders[3] = order;
2002 case STR_STATION_VIEW_WAITING_STATION:
2004 this->sortings[1] = this->sortings[2] = this->sortings[3] =
ST_AS_GROUPING;
2006 case STR_STATION_VIEW_WAITING_AMOUNT:
2008 this->sortings[1] = this->sortings[2] = this->sortings[3] =
ST_COUNT;
2010 case STR_STATION_VIEW_PLANNED_STATION:
2012 this->sortings[1] = this->sortings[2] = this->sortings[3] =
ST_AS_GROUPING;
2014 case STR_STATION_VIEW_PLANNED_AMOUNT:
2016 this->sortings[1] = this->sortings[2] = this->sortings[3] =
ST_COUNT;
2032 this->grouping_index = index;
2036 case STR_STATION_VIEW_GROUP_S_V_D:
2041 case STR_STATION_VIEW_GROUP_S_D_V:
2046 case STR_STATION_VIEW_GROUP_V_S_D:
2051 case STR_STATION_VIEW_GROUP_V_D_S:
2056 case STR_STATION_VIEW_GROUP_D_S_V:
2061 case STR_STATION_VIEW_GROUP_D_V_S:
2081 if (str ==
nullptr)
return;
2109 STR_STATION_VIEW_WAITING_STATION,
2110 STR_STATION_VIEW_WAITING_AMOUNT,
2111 STR_STATION_VIEW_PLANNED_STATION,
2112 STR_STATION_VIEW_PLANNED_AMOUNT,
2117 STR_STATION_VIEW_GROUP_S_V_D,
2118 STR_STATION_VIEW_GROUP_S_D_V,
2119 STR_STATION_VIEW_GROUP_V_S_D,
2120 STR_STATION_VIEW_GROUP_V_D_S,
2121 STR_STATION_VIEW_GROUP_D_S_V,
2122 STR_STATION_VIEW_GROUP_D_V_S,
2127 WDP_AUTO,
"view_station", 249, 117,
2130 _nested_station_view_widgets,
lengthof(_nested_station_view_widgets)
2140 AllocateWindowDescFront<StationViewWindow>(&_station_view_desc, station);
2149 static std::vector<TileAndStation> _deleted_stations_nearby;
2150 static std::vector<StationID> _stations_nearby_list;
2165 for (uint i = 0; i < _deleted_stations_nearby.size(); i++) {
2166 auto ts = _deleted_stations_nearby.begin() + i;
2167 if (ts->tile == tile) {
2168 _stations_nearby_list.push_back(_deleted_stations_nearby[i].station);
2169 _deleted_stations_nearby.erase(ts);
2180 if (!T::IsValidID(sid))
return false;
2182 T *st = T::Get(sid);
2183 if (st->owner !=
_local_company || std::find(_stations_nearby_list.begin(), _stations_nearby_list.end(), sid) != _stations_nearby_list.end())
return false;
2185 if (st->rect.BeforeAddRect(ctx->
tile, ctx->
w, ctx->
h, StationRect::ADD_TEST).Succeeded()) {
2186 _stations_nearby_list.push_back(sid);
2206 _stations_nearby_list.clear();
2207 _deleted_stations_nearby.clear();
2216 if (T::IsExpected(st) && !st->IsInUse() && st->owner ==
_local_company) {
2219 _deleted_stations_nearby.push_back({st->xy, st->index});
2224 AddNearbyStation<T>(st->xy, &ctx);
2242 static const NWidgetPart _nested_select_station_widgets[] = {
2274 this->GetWidget<NWidgetCore>(WID_JS_CAPTION)->widget_data = T::EXPECTED_FACIL ==
FACIL_WAYPOINT ? STR_JOIN_WAYPOINT_CAPTION : STR_JOIN_STATION_CAPTION;
2290 if (widget != WID_JS_PANEL)
return;
2294 for (uint i = 0; i < _stations_nearby_list.size(); i++) {
2295 const T *st = T::Get(_stations_nearby_list[i]);
2301 resize->height = d.height;
2310 if (widget != WID_JS_PANEL)
return;
2318 for (uint i = std::max<uint>(1, this->vscroll->
GetPosition()); i <= _stations_nearby_list.size(); ++i, y += this->resize.step_height) {
2320 if (i - this->vscroll->
GetPosition() >= this->vscroll->GetCapacity())
break;
2322 const T *st = T::Get(_stations_nearby_list[i - 1]);
2331 if (widget != WID_JS_PANEL)
return;
2334 bool distant_join = (st_index > 0);
2335 if (distant_join) st_index--;
2337 if (distant_join && st_index >= _stations_nearby_list.size())
return;
2340 SB(this->select_station_cmd.
p2, 16, 16,
2341 (distant_join ? _stations_nearby_list[st_index] : NEW_STATION));
2352 if (_thd.
dirty & 2) {
2370 if (!gui_scope)
return;
2371 FindStationsNearby<T>(this->area,
true);
2372 this->vscroll->
SetCount((uint)_stations_nearby_list.size() + 1);
2378 if (widget != WID_JS_PANEL || T::EXPECTED_FACIL ==
FACIL_WAYPOINT) {
2385 if (st_index == 0 || st_index > _stations_nearby_list.size()) {
2395 WDP_AUTO,
"build_station_join", 200, 180,
2398 _nested_select_station_widgets,
lengthof(_nested_select_station_widgets)
2418 if (selection_window !=
nullptr) {
2420 delete selection_window;
2433 const T *st = FindStationsNearby<T>(ta,
false);
2446 if (StationJoinerNeeded<T>(cmd, ta)) {
2461 ShowSelectBaseStationIfNeeded<Station>(cmd, ta);
2471 ShowSelectBaseStationIfNeeded<Waypoint>(cmd, ta);
@ VEH_AIRCRAFT
Aircraft vehicle type.
int grouping_index
Currently selected entry in the grouping drop down.
void HandleCargoWaitingClick(CargoDataEntry *filter, Tid next)
Expand or collapse a specific row.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
StationFacility facilities
The facilities that this station has.
void SetTimeout()
Set the timeout flag of the window and initiate the timer.
StationCargoPacketMap ::const_iterator ConstIterator
The const iterator for our container.
@ WD_FRAMERECT_TOP
Offset at top to draw the frame rectangular area.
@ WC_ROADVEH_LIST
Road vehicle list; Window numbers:
#define CMD_MSG(x)
Used to combine a StringID with the command.
uint32 TileIndex
The index/ID of a Tile.
uint32 cmd
command being executed.
static bool StationRatingMaxSorter(const Station *const &a, const Station *const &b)
Sort stations by their rating.
Point size
Size, in tile "units", of the white/red selection area.
GoodsEntry goods[NUM_CARGO]
Goods at this station.
#define FOR_ALL_SORTED_STANDARD_CARGOSPECS(var)
Loop header for iterating over 'real' cargoes, sorted by name.
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
CommandCost DoCommand(const CommandContainer *container, DoCommandFlag flags)
Shorthand for calling the long DoCommand with a container.
uint8 SortType() const
Get the sorttype of the list.
bool station_show_coverage
whether to highlight coverage area
bool ScrollMainWindowToTile(TileIndex tile, bool instant)
Scrolls the viewport of the main window to a given location.
StationSettings station
settings related to station management
@ ALH_ACCEPTS
Height of the accepted cargo view.
void UpdateTileSelection()
Updates tile highlighting for all cases.
A connected component of a link graph.
void ShowExtraViewportWindow(TileIndex tile=INVALID_TILE)
Show a new Extra Viewport window.
CargoDataEntry * filter
Parent of the cargo entry belonging to the row.
int DivideApprox(int a, int b)
Deterministic approximate division.
static uint ToPercent8(uint i)
Converts a "fract" value 0..255 to "percent" value 0..100.
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.
uint8 station_gui_sort_by
sort cargo entries in the station gui by station name or amount
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.
@ WDF_CONSTRUCTION
This window is used for construction; close it whenever changing company.
The information about a vehicle list.
CargoDataEntry * InsertOrRetrieve(StationID station)
Insert a new child or retrieve an existing child using a station ID as ID.
std::vector< const CargoSpec * > _sorted_cargo_specs
Cargo specifications sorted alphabetically by name.
void ReInit(int rx=0, int ry=0)
Re-initialize a window, and optionally change its size.
@ INV_FLOWS
The planned flows have been recalculated and everything has to be updated.
const Tcont * Packets() const
Returns a pointer to the cargo packet list (so you can iterate over it etc).
CargoID cargo
ID of the cargo this entry is associated with.
Town * town
The town this station is associated with.
void SetStringParameters(int widget) const override
Initialize string parameters for a widget.
TextColour GetContrastColour(uint8 background, uint8 threshold)
Determine a contrasty text colour for a coloured background.
The list of stations per company.
@ FACIL_TRUCK_STOP
Station with truck stops.
void BuildStationsList(const Owner owner)
(Re)Build station list
void CheckRedrawStationCoverage(const Window *w)
Check whether we need to redraw the station coverage text.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
uint8 station_gui_group_order
the order of grouping cargo entries in the station gui
void OnDropdownSelect(int widget, int index) override
A dropdown option associated to this window has been selected.
void OnResize() override
Called after the window got resized.
static const uint8 PC_RED
Red palette colour.
static TileIndex TileAddByDir(TileIndex tile, Direction dir)
Adds a Direction to a tile.
void CreateNestedTree(bool fill_nested=true)
Perform the first part of the initialization of a nested widget tree.
Tindex index
Index of this pool item.
static CargoSpec * Get(size_t index)
Retrieve cargo details for the given cargo ID.
Class for storing amounts of cargo.
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
@ DT_MANUAL
Manual distribution. No link graph calculations are run.
CargoDataEntry cached_destinations
Cache for the flows passing through this station.
A row being displayed in the cargo view (as opposed to being "hidden" behind a plus sign).
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.
CargoID GetCargo() const
Get the cargo ID for this entry.
void SelectSortBy(int index)
Select a new sort criterium for the cargo view.
int DrawEntries(CargoDataEntry *entry, Rect &r, int pos, int maxrows, int column, CargoID cargo=CT_INVALID)
Draw the given cargo entries in the station GUI.
bool _ctrl_pressed
Is Ctrl pressed?
CargoList that is used for stations.
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.
void BuildCargoList(CargoID i, const StationCargoList &packets, CargoDataEntry *cargo)
Build up the cargo view for WAITING mode and a specific cargo.
static void DrawCargoIcons(CargoID i, uint waiting, int left, int right, int y)
Draws icons of waiting cargo in the StationView window.
void ShowSelectBaseStationIfNeeded(const CommandContainer &cmd, TileArea ta)
Show the station selection window when needed.
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
@ FACIL_NONE
The station has no facilities at all.
static const uint TILE_SIZE
Tile size in world coordinates.
void BuildCargoList(CargoDataEntry *cargo, const Station *st)
Build up the cargo view for all cargoes.
int DrawCargoRatings(const Rect &r) const
Draw cargo ratings in the WID_SV_ACCEPT_RATING_LIST widget.
void ShowCompanyStations(CompanyID company)
Opens window with list of company's stations.
Structure for buffering the build command when selecting a station to join.
static bool AddNearbyStation(TileIndex tile, void *user_data)
Add station on this tile to _stations_nearby_list if it's fully within the station spread.
static Station * Get(size_t index)
Gets station with given index.
ClientSettings _settings_client
The current settings for this game.
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.
void OnQueryTextFinished(char *str) override
The query window opened from this window has closed.
Specification of a cargo type.
static bool IsValidID(size_t index)
Tests whether given index is a valid index for station of this type.
uint GetCount() const
Get the cargo count for this entry.
static uint TileY(TileIndex tile)
Get the Y component of a tile.
Owner owner
The owner of the content shown in this window. Company colour is acquired from this variable.
static void FindStationsAroundSelection()
Find stations adjacent to the current tile highlight area, so that existing coverage area can be draw...
int32 WindowNumber
Number to differentiate different windows of the same class.
@ WC_STATION_VIEW
Station view; Window numbers:
SpriteID GetCargoIcon() const
Get sprite for showing cargo of this type.
static const StringID _sort_names[]
Names of the sorting options in the dropdown.
@ VEH_ROAD
Road vehicle type.
@ CC_PASSENGERS
Passengers.
void OnPaint() override
The window must be repainted.
@ SA_HOR_CENTER
Horizontally center the text.
void SetSortType(uint8 n_type)
Set the sorttype of the list.
@ GR_DESTINATION
Group by estimated final destination ("to").
StringID SearchNonStop(CargoDataEntry *cd, StationID station, int column)
Determine if we need to show the special "non-stop" string.
TileArea area
Location of new station.
Owner
Enum for all companies/owners.
Owner owner
The owner of this station.
uint expand_shrink_width
The width allocated to the expand/shrink 'button'.
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.
@ MODE_PLANNED
Show cargo planned to pass through the station.
CargoDataSet * children
the children of this entry.
byte status
Status of this cargo, see GoodsEntryStatus.
@ GR_SOURCE
Group by source of cargo ("from").
AcceptListHeight
Height of the WID_SV_ACCEPT_RATING_LIST widget for different views.
void ShowStationViewWindow(StationID station)
Opens StationViewWindow for given station.
uint TotalCount() const
Returns total count of cargo at the station, including cargo which is already reserved for loading.
Dimension GetStringBoundingBox(const char *str, FontSize start_fontsize)
Return the string dimension in pixels.
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
@ INV_CARGO
Some cargo has been added or removed.
static uint TileX(TileIndex tile)
Get the X component of a tile.
void SetStringParameters(int widget) const override
Initialize string parameters for a widget.
static bool StationWaitingAvailableSorter(const Station *const &a, const Station *const &b)
Sort stations by their available waiting cargo.
int DrawStringMultiLine(int left, int right, int top, int bottom, const char *str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly over multiple lines.
@ QSF_LEN_IN_CHARS
the length of the string is counted in characters
CargoDataEntry * InsertOrRetrieve(CargoID cargo)
Insert a new child or retrieve an existing child using a cargo ID as ID.
static Pool::IterateWrapper< Station > Iterate(size_t from=0)
Returns an iterable ensemble of all valid stations of type T.
@ ST_STATION_ID
by station id
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
Mode current_mode
Currently selected display mode of cargo view.
@ CMD_OPEN_CLOSE_AIRPORT
open/close an airport to incoming aircraft
static const int NUM_COLUMNS
Number of "columns" in the cargo view: cargo, from, via, to.
High level window description.
void OnResize() override
Called after the window got resized.
StationCargoList cargo
The cargo packets of cargo waiting in this station.
uint num_children
the number of subentries belonging to this entry.
@ FACIL_BUS_STOP
Station with bus stops.
CargoID Index() const
Determines index of this cargospec.
StringID GetEntryString(StationID station, StringID here, StringID other_station, StringID any)
Select the correct string for an entry referring to the specified station.
bool IsDescSortOrder() const
Check if the sort order is descending.
@ WDP_AUTO
Find a place automatically.
Data structure describing how to show the list (what sort direction and criteria).
@ SCT_PASSENGERS_ONLY
Draw only passenger class cargoes.
static uint MapSize()
Get the size of the map.
ResizeInfo resize
Resize information.
CargoSortType sortings[NUM_COLUMNS]
Sort types of the different 'columns'.
uint GetNumChildren() const
Get the number of children for this entry.
#define TILE_AREA_LOOP(var, ta)
A loop which iterates over the tiles of a TileArea.
bool CircularTileSearch(TileIndex *tile, uint size, TestTileOnSearchProc proc, void *user_data)
Function performing a search around a center tile and going outward, thus in circle.
bool DoCommandP(const CommandContainer *container, bool my_cmd)
Shortcut for the long DoCommandP when having a container with the data.
StationID SourceStation() const
Gets the ID of the station where the cargo was loaded for the first time.
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.
int DrawAcceptedCargo(const Rect &r) const
Draw accepted cargo in the WID_SV_ACCEPT_RATING_LIST widget.
StationCoverageType
Types of cargo to display for station coverage.
void SetDisplayedRow(const CargoDataEntry *data)
Mark a specific row, characterized by its CargoDataEntry, as expanded.
void ShowCargo(CargoDataEntry *data, CargoID cargo, StationID source, StationID next, StationID dest, uint count)
Show a certain cargo entry characterized by source/next/dest station, cargo ID and amount of cargo at...
StationID next_station
ID of the station belonging to the entry actually displayed if it's to/from/via.
bool HasRating() const
Does this cargo have a rating at this station?
void OnResize() override
Called after the window got resized.
#define DEBUG(name, level,...)
Output a line of debugging information.
bool SortFunction(const const Station * &, const const Station * &)
Signature of sort function.
bool IsValid() const
Tests for validity of this cargospec.
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
void SetListing(Listing l)
Import sort conditions.
void HandleCargoWaitingClick(int row)
Handle a click on a specific row in the cargo view.
@ WD_FRAMERECT_LEFT
Offset at left to draw the frame rectangular area.
CargoArray GetProductionAroundTiles(TileIndex tile, int w, int h, int rad)
Get the cargo types being produced around the tile (in a rectangle).
@ FS_SMALL
Index of the small font in the font tables.
static T SB(T &x, const uint8 s, const uint8 n, const U d)
Set n bits in x starting at bit s to d.
static bool IsInsideBS(const T x, const size_t base, const size_t size)
Checks if a value is between a window started at some base point.
@ CMD_RENAME_STATION
rename a station
void OnPaint() override
The window must be repainted.
uint16 w
The width of the area.
NodeID node
ID of node in link graph referring to this goods entry.
@ WD_FRAMERECT_RIGHT
Offset at right to draw the frame rectangular area.
@ WD_FRAMERECT_BOTTOM
Offset at bottom to draw the frame rectangular area.
bool Failed() const
Did this command fail?
static void StationsWndShowStationRating(int left, int right, int y, CargoID type, uint amount, byte rating)
Draw small boxes of cargo amount and ratings data at the given coordinates.
CargoTypes _cargo_mask
Bitmask of cargo types available.
Airport airport
Tile area the airport covers.
Represents the covered area of e.g.
static NWidgetBase * CargoWidgets(int *biggest_index)
Make a horizontal row of cargo buttons, starting at widget WID_STL_CARGOSTART.
static bool StationTypeSorter(const Station *const &a, const Station *const &b)
Sort stations by their type.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
void BuildFlowList(CargoID i, const FlowStatMap &flows, CargoDataEntry *cargo)
Build up the cargo view for PLANNED mode and a specific cargo.
Window for selecting stations/waypoints to (distant) join to.
void SetWidgetDisabledState(byte widget_index, bool disab_stat)
Sets the enabled/disabled status of a widget.
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.
CargoDataEntry * Retrieve(CargoID cargo) const
Retrieve a child for the given cargo.
uint64 flags
stores which blocks on the airport are taken. was 16 bit earlier on, then 32
@ WC_SHIPS_LIST
Ships list; Window numbers:
StationID station
ID of the station this entry is associated with.
Grouping groupings[NUM_COLUMNS]
Grouping modes for the different columns.
void RecalcDestinations(CargoID i)
Rebuild the cache for estimated destinations which is used to quickly show the "destination" entries ...
uint16 Count() const
Gets the number of 'items' in this packet.
Point pos
Location, in tile "units", of the northern tile of the selected area.
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
@ MODE_WAITING
Show cargo waiting at the station.
void Remove(StationID station)
Remove a child associated with the given station.
byte rating
Station rating for this cargo.
Coordinates of a point in 2D.
LinkGraphSettings linkgraph
settings for link graph calculations
@ WC_TRAINS_LIST
Trains list; Window numbers:
uint AvailableCount() const
Returns sum of cargo still available for loading at the sation.
CargoDataEntry * GetParent() const
Get the parent entry for this entry.
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.
@ FACIL_DOCK
Station with a dock.
byte station_spread
amount a station may spread
static bool StationWaitingTotalSorter(const Station *const &a, const Station *const &b)
Sort stations by their waiting cargo.
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.
CommandFlags GetCommandFlags(uint32 cmd)
LinkGraphID link_graph
Link graph this station belongs to.
void OnMouseOver(Point pt, int widget) override
The mouse is currently moving over the window or has just moved outside of the window.
uint step_height
Step-size of height resize changes.
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.
void SortStationsList()
Sort the stations list.
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
uint8 _sorted_standard_cargo_specs_size
Number of standard cargo specifications stored in the _sorted_cargo_specs array.
static const StringID _group_names[]
Names of the grouping options in the dropdown.
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a given tiletype.
@ FACIL_WAYPOINT
Station is a waypoint.
void ShowSelectStationIfNeeded(const CommandContainer &cmd, TileArea ta)
Show the station selection window when needed.
static Owner GetTileOwner(TileIndex tile)
Returns the owner of a tile.
#define FONT_HEIGHT_SMALL
Height of characters in the small (FS_SMALL) font.
uint16 h
The height of the area.
uint DistanceMax(TileIndex t0, TileIndex t1)
Gets the biggest distance component (x or y) between the two given tiles.
uint ReservedCount() const
Returns sum of cargo reserved for loading onto vehicles.
static const uint MAX_LENGTH_STATION_NAME_CHARS
The maximum length of a station name in characters including '\0'.
byte dirty
Whether the build station window needs to redraw due to the changed selection.
bool NeedRebuild() const
Check if a rebuild is needed.
HighLightStyle drawstyle
Lower bits 0-3 are reserved for detailed highlight information.
int DrawStationCoverageAreaText(int left, int right, int top, StationCoverageType sct, int rad, bool supplies)
Calculates and draws the accepted or supplied cargo around the selected tile(s)
CommandContainer select_station_cmd
Command to build new station.
static const uint64 AIRPORT_CLOSED_block
Dummy block for indicating a closed airport.
@ SCT_ALL
Draw all cargoes.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
@ SBS_DOWN
Sort ascending.
void SetTransfers(bool value)
Set the transfers state.
Stores station stats for a single cargo.
@ WC_SELECT_STATION
Select station (when joining stations); Window numbers:
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
@ ST_STATION_STRING
by station name
Invalidation
Type of data invalidation.
CargoDataVector displayed_rows
Parent entry of currently displayed rows (including collapsed ones).
void DeleteWindowById(WindowClass cls, WindowNumber number, bool force)
Delete a window by its class and window number (if it is open).
static uint MapMaxY()
Gets the maximum Y coordinate within the map, including MP_VOID.
bool IsShaded() const
Is window shaded currently?
void Update(uint count)
Update the count for this entry and propagate the change to the parent entry if there is one.
static TileIndex TileXY(uint x, uint y)
Returns the TileIndex of a coordinate.
CargoDataEntry * Retrieve(StationID station) const
Retrieve a child for the given station.
void Clear()
Delete all subentries, reset count and num_children and adapt parent's count.
StationID GetStation() const
Get the station ID for this entry.
@ FACIL_TRAIN
Station with train station.
CargoID next_cargo
ID of the cargo belonging to the entry actually displayed if it's cargo.
#define FONT_HEIGHT_NORMAL
Height of characters in the normal (FS_NORMAL) font.
FlowStatMap flows
Planned flows through this station.
static int ScaleGUITrad(int value)
Scale traditional pixel dimensions to GUI zoom level.
SortOrder sort_orders[NUM_COLUMNS]
Sort order (ascending/descending) for the 'columns'.
@ SCT_NON_PASSENGERS_ONLY
Draw all non-passenger class cargoes.
TileIndex tile
The base tile of the area.
void DrawWidget(const Rect &r, int widget) const override
Draw the contents of a nested widget.
Flow descriptions by origin stations.
StationID station
StationID.
Listing GetListing() const
Export current sort conditions.
@ OWNER_NONE
The tile has no ownership.
bool IsWidgetLowered(byte widget_index) const
Gets the lowered state of a widget.
@ MP_STATION
A tile of a station.
uint8 station_gui_sort_order
the sort order of entries in the station gui - ascending or descending
@ NUM_CARGO
Maximal number of cargo types in a game.
@ GES_ACCEPTANCE
Set when the station accepts the cargo currently for final deliveries.
static StationID GetStationIndex(TileIndex t)
Get StationID from a tile.
static Station * GetByTile(TileIndex tile)
Get the station belonging to a specific tile.
@ HT_RECT
rectangle (stations, depots, ...)
CargoArray GetAcceptanceAroundTiles(TileIndex tile, int w, int h, int rad, CargoTypes *always_accepted)
Get the acceptance of cargoes around the tile in 1/8.
Mode
Display mode of the cargo view.
StringID name
Name of this type of cargo.
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
TileIndex xy
Base tile of the station.
Base class for all station-ish types.
bool HasStationInUse(StationID station, bool include_company, CompanyID company)
Tests whether the company's vehicles have this station in orders.
void SetViewportCatchmentStation(const Station *st, bool sel)
Select or deselect station for coverage area highlight.
bool HasTransfers() const
Has this entry transfers.
static uint MapMaxX()
Gets the maximum X coordinate within the map, including MP_VOID.
StringID abbrev
Two letter abbreviation for this cargo type.
void ForceResort()
Force a resort next Sort call Reset the resort timer if used too.
#define TILE_ADDXY(tile, x, y)
Adds a given offset to a tile.
bool distant_join_stations
allow to join non-adjacent stations
@ GR_NEXT
Group by next station ("via").
static bool StationJoinerNeeded(const CommandContainer &cmd, TileArea ta)
Check whether we need to show the station selection window.
@ ALH_RATING
Height of the cargo ratings view.
bool adjacent_stations
allow stations to be built directly adjacent to other stations
A cargo data entry representing one possible row in the station view window's top part.
void ForceRebuild()
Force that a rebuild is needed.
static DoCommandFlag CommandFlagsToDCFlags(CommandFlags cmd_flags)
Extracts the DC flags needed for DoCommand from the flags returned by GetCommandFlags.
static T ToggleBit(T &x, const uint8 y)
Toggles a bit in a variable.
void ToggleWidgetLoweredState(byte widget_index)
Invert the lowered/raised status of a widget.
int GetCharacterHeight(FontSize size)
Get height of a character for a given font size.
static T SetBit(T &x, const uint8 y)
Set a bit in a variable.
#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)
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
Container for cargo from the same location and time.
static int SortButtonWidth()
Get width of up/down arrow of sort button state.
void SelectSortOrder(SortOrder order)
Select a new sort order for the cargo view.
void SelectGroupBy(int index)
Select a new grouping mode for the cargo view.
uint count
sum of counts of all children or amount of cargo for this entry.
byte CargoID
Cargo slots to indicate a cargo type within a game.
int accepts_lines
Number of lines in the accepted cargo view.
static const TileIndex INVALID_TILE
The very nice invalid tile marker.
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.
CargoDataEntry * parent
the parent of this entry.
@ ST_AS_GROUPING
by the same principle the entries are being grouped
int scroll_to_row
If set, scroll the main viewport to the station pointed to by this row.
int strnatcmp(const char *s1, const char *s2, bool ignore_garbage_at_front)
Compares two strings using case insensitive natural sort.
void Remove(CargoID cargo)
Remove a child associated with the given cargo.
static uint CeilDiv(uint a, uint b)
Computes ceil(a / b) for non-negative a and b.
@ GR_CARGO
Group by cargo type.
Data structure for an opened window.
void RebuildDone()
Notify the sortlist that the rebuild is done.
void ShowSelectWaypointIfNeeded(const CommandContainer &cmd, TileArea ta)
Show the waypoint selection window when needed.
@ VEH_TRAIN
Train vehicle type.
@ ST_COUNT
by amount of cargo
void OnGameTick() override
Called once per (game) tick.
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.
int rating_lines
Number of lines in the cargo ratings view.
const Station * _viewport_highlight_station
Currently selected station for coverage area highlight.
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
void DrawWidgets() const
Paint all widgets of a window.
CargoDataEntry expanded_rows
Parent entry of currently expanded rows.
@ FACIL_AIRPORT
Station with an airport.
void DrawWidget(const Rect &r, int widget) const override
Draw the contents of a nested widget.
Grouping
Type of grouping used in each of the "columns".
static bool StationNameSorter(const Station *const &a, const Station *const &b)
Sort stations by their name.
static bool StationRatingMinSorter(const Station *const &a, const Station *const &b)
Sort stations by their rating.
@ CT_INVALID
Invalid cargo type.
static bool IsCargoInClass(CargoID c, CargoClass cc)
Does cargo c have cargo class cc?
void SetWidgetDirty(byte widget_index) const
Invalidate a widget, i.e.
void EstimateDestinations(CargoID cargo, StationID source, StationID next, uint count, CargoDataEntry *dest)
Estimate the amounts of cargo per final destination for a given cargo, source station and next hop an...
@ VEH_SHIP
Ship vehicle type.
Specification of a rectangle with absolute coordinates of all edges.
void LowerWidget(byte widget_index)
Marks a widget as lowered.
Struct containing TileIndex and StationID.
CompanyID exclusivity
which company has exclusivity
@ WC_AIRCRAFT_LIST
Aircraft list; Window numbers:
static const T * FindStationsNearby(TileArea ta, bool distant_join)
Circulate around the to-be-built station to find stations we could join.
@ QSF_ENABLE_DEFAULT
enable the 'Default' button ("\0" is returned)
uint8 exclusive_counter
months till the exclusivity expires
@ WC_STATION_LIST
Station list; Window numbers:
@ WD_PAR_VSEP_WIDE
Large amount of vertical space between two paragraphs of text.
void OnRealtimeTick(uint delta_ms) override
Called periodically.
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows).
static const uint8 PC_GREEN
Green palette colour.
void SetWidgetLoweredState(byte widget_index, bool lowered_stat)
Sets the lowered/raised status of a widget.
@ TD_RTL
Text is written right-to-left by default.
#define FOR_EACH_SET_BIT(bitpos_var, bitset_value)
Do an operation for each set set bit in a value.
TextDirection _current_text_dir
Text direction of the currently selected language.
bool freeze
Freeze highlight in place.
void OnDropdownSelect(int widget, int index) override
A dropdown option associated to this window has been selected.
CargoDataSet::iterator Begin() const
Get an iterator pointing to the begin of the set of children.
static const StringID INVALID_STRING_ID
Constant representing an invalid string (16bit in case it is used in savegames)
GUISettings gui
settings related to the GUI
uint Monthly(uint base) const
Scale a value to its monthly equivalent, based on last compression.
bool transfers
If there are transfers for this cargo.
void SetSortFuncs(SortFunction *const *n_funcs)
Hand the array of sort function pointers to the sort list.
bool persistent_buildingtools
keep the building tools active after usage
static TileIndex TileVirtXY(uint x, uint y)
Get a tile from the virtual XY-coordinate.
void IncrementSize()
Increment.
CargoDataSet::iterator End() const
Get an iterator pointing to the end of the set of children.