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);
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 = (
minu(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 =
minu(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;
210 static const Station *last_station;
213 static const StringID sorter_names[];
228 DEBUG(misc, 3,
"Building station list for company %d", owner);
230 this->stations.clear();
234 if (this->facilities & st->facilities) {
235 int num_waiting_cargo = 0;
237 if (st->goods[j].HasRating()) {
239 if (
HasBit(this->cargo_filter, j)) {
240 this->stations.push_back(st);
246 if (num_waiting_cargo == 0 && this->include_empty) {
247 this->stations.push_back(st);
253 this->stations.shrink_to_fit();
256 this->vscroll->
SetCount((uint)this->stations.size());
262 static char buf_cache[64];
266 GetString(buf, STR_STATION_NAME,
lastof(buf));
268 if (b != last_station) {
271 GetString(buf_cache, STR_STATION_NAME,
lastof(buf_cache));
291 FOR_EACH_SET_CARGO_ID(j, cargo_filter) {
304 FOR_EACH_SET_CARGO_ID(j, cargo_filter) {
318 FOR_EACH_SET_CARGO_ID(j, cargo_filter) {
323 return maxr1 < maxr2;
333 if (!
HasBit(cargo_filter, j))
continue;
338 return minr1 > minr2;
344 if (!this->stations.
Sort())
return;
347 this->last_station =
nullptr;
356 this->stations.
SetListing(this->last_sorting);
369 if (!
HasBit(this->cargo_filter, cs->
Index()))
continue;
373 if (this->cargo_filter == this->cargo_filter_max) this->cargo_filter =
_cargo_mask;
375 for (uint i = 0; i < 5; i++) {
385 this->last_sorting = this->stations.
GetListing();
394 d.height += padding.height;
404 d.width += padding.width;
405 d.height += padding.height;
427 d.width += padding.width + 2;
428 d.height += padding.height;
436 d.width += padding.width + 2;
437 d.height += padding.height;
465 const Station *st = this->stations[i];
499 if (this->vscroll->
GetCount() == 0) {
527 int cg_ofst =
HasBit(this->cargo_filter, cs->
Index()) ? 2 : 1;
528 GfxFillRect(r.left + cg_ofst, r.top + cg_ofst, r.right - 2 + cg_ofst, r.bottom - 2 + cg_ofst, cs->rating_colour);
549 if (id_v >= this->stations.size())
return;
551 const Station *st = this->stations[id_v];
600 this->include_empty =
true;
617 this->include_empty = !this->include_empty;
624 this->cargo_filter = 0;
625 this->include_empty =
true;
647 this->cargo_filter = 0;
648 this->include_empty =
false;
662 if (this->stations.
SortType() != index) {
701 Listing CompanyStationsWindow::last_sorting = {
false, 0};
703 bool CompanyStationsWindow::include_empty =
true;
704 const CargoTypes CompanyStationsWindow::cargo_filter_max = ALL_CARGOTYPES;
705 CargoTypes CompanyStationsWindow::cargo_filter = ALL_CARGOTYPES;
706 const Station *CompanyStationsWindow::last_station =
nullptr;
719 const StringID CompanyStationsWindow::sorter_names[] = {
721 STR_SORT_BY_FACILITY,
722 STR_SORT_BY_WAITING_TOTAL,
723 STR_SORT_BY_WAITING_AVAILABLE,
724 STR_SORT_BY_RATING_MAX,
725 STR_SORT_BY_RATING_MIN,
743 panel->
SetDataTip(0, STR_STATION_LIST_USE_CTRL_TO_SELECT_MORE);
744 container->
Add(panel);
750 static const NWidgetPart _nested_company_stations_widgets[] = {
767 NWidget(
WWT_PANEL, COLOUR_GREY,
WID_STL_NOCARGOWAITING),
SetMinimalSize(14, 11),
SetDataTip(0x0, STR_STATION_LIST_NO_WAITING_CARGO),
SetFill(0, 1),
EndContainer(),
777 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(),
786 WDP_AUTO,
"list_stations", 358, 162,
789 _nested_company_stations_widgets,
lengthof(_nested_company_stations_widgets)
801 AllocateWindowDescFront<CompanyStationsWindow>(&_company_stations_desc, company);
804 static const NWidgetPart _nested_station_view_widgets[] = {
814 NWidget(
WWT_DROPDOWN, COLOUR_GREY,
WID_SV_SORT_BY),
SetMinimalSize(168, 12),
SetResize(1, 0),
SetFill(0, 1),
SetDataTip(0x0, STR_TOOLTIP_SORT_CRITERIA),
818 NWidget(
WWT_DROPDOWN, COLOUR_GREY,
WID_SV_GROUP_BY),
SetMinimalSize(168, 12),
SetResize(1, 0),
SetFill(0, 1),
SetDataTip(0x0, STR_TOOLTIP_GROUP_ORDER),
828 SetDataTip(STR_BUTTON_LOCATION, STR_STATION_VIEW_CENTER_TOOLTIP),
830 SetDataTip(STR_STATION_VIEW_RATINGS_BUTTON, STR_STATION_VIEW_RATINGS_TOOLTIP),
832 SetDataTip(STR_BUTTON_RENAME, STR_STATION_VIEW_RENAME_TOOLTIP),
835 SetDataTip(STR_STATION_VIEW_CLOSE_AIRPORT, STR_STATION_VIEW_CLOSE_AIRPORT_TOOLTIP),
857 uint num =
min((waiting + (width / 2)) / width, (right - left) / width);
858 if (num == 0)
return;
895 bool SortId(Tid st1, Tid st2)
const;
897 bool SortStation (StationID st1, StationID st2)
const;
900 typedef std::set<CargoDataEntry *, CargoSorter> CargoDataSet;
919 return this->InsertOrRetrieve<StationID>(station);
929 return this->InsertOrRetrieve<CargoID>(cargo);
932 void Update(uint count);
962 return this->Retrieve(this->children->find(&t));
973 return this->Retrieve(this->children->find(&t));
1006 CargoDataSet::iterator
Begin()
const {
return this->children->begin(); }
1011 CargoDataSet::iterator
End()
const {
return this->children->end(); }
1037 void IncrementSize();
1052 CargoDataEntry::CargoDataEntry() :
1054 station(INVALID_STATION),
1076 CargoDataEntry::CargoDataEntry(StationID
station) :
1092 CargoDataEntry::~CargoDataEntry()
1104 for (CargoDataSet::iterator i = this->
children->begin(); i != this->
children->end(); ++i) {
1110 if (this->parent !=
nullptr) this->parent->
count -= this->
count;
1123 CargoDataSet::iterator i = this->
children->find(child);
1140 CargoDataSet::iterator i = this->
children->find(&tmp);
1158 this->count +=
count;
1159 if (this->parent !=
nullptr) this->parent->
Update(count);
1171 void CargoDataEntry::Resort(
CargoSortType type, SortOrder order)
1175 this->children = new_subs;
1190 switch (this->type) {
1196 return this->SortCount(cd1, cd2);
1205 bool CargoSorter::SortId(Tid st1, Tid st2)
const 1207 return (this->order == SO_ASCENDING) ? st1 < st2 : st2 < st1;
1216 }
else if (this->order == SO_ASCENDING) {
1223 bool CargoSorter::SortStation(StationID st1, StationID st2)
const 1229 return Station::IsValidID(st2) ? this->order == SO_ASCENDING : this->SortId(st1, st2);
1231 return order == SO_DESCENDING;
1235 GetString(buf1, STR_STATION_NAME,
lastof(buf1));
1237 GetString(buf2, STR_STATION_NAME,
lastof(buf2));
1241 return this->SortId(st1, st2);
1243 return (this->order == SO_ASCENDING) ? res < 0 : res > 0;
1275 typedef std::vector<RowDisplay> CargoDataVector;
1277 static const int NUM_COLUMNS = 4;
1328 SortOrder sort_orders[NUM_COLUMNS];
1340 scroll_to_row(INT_MAX), grouping_index(0)
1342 this->rating_lines = ALH_RATING;
1343 this->accepts_lines = ALH_ACCEPTS;
1345 this->CreateNestedTree();
1348 this->FinishInitNested(window_number);
1350 this->groupings[0] = GR_CARGO;
1354 this->sort_orders[0] = SO_ASCENDING;
1381 if (count == 0)
return;
1384 for (
int i = 0; i < NUM_COLUMNS && expand !=
nullptr; ++i) {
1385 switch (groupings[i]) {
1393 if (auto_distributed || source != this->window_number) {
1399 if (auto_distributed) {
1404 case GR_DESTINATION:
1405 if (auto_distributed) {
1443 BuildCargoList(&cargo, st);
1458 this->SetWidgetLoweredState(
WID_SV_CATCHMENT, _viewport_highlight_station == st);
1460 this->DrawWidgets();
1462 if (!this->IsShaded()) {
1466 if (this->GetWidget<NWidgetCore>(
WID_SV_ACCEPTS_RATINGS)->widget_data == STR_STATION_VIEW_RATINGS_BUTTON) {
1467 int lines = this->DrawAcceptedCargo(r);
1468 if (lines > this->accepts_lines) {
1469 this->accepts_lines = lines;
1474 int lines = this->DrawCargoRatings(r);
1475 if (lines > this->rating_lines) {
1476 this->rating_lines = lines;
1489 displayed_rows.clear();
1494 this->DrawEntries(&cargo, waiting_rect, pos, maxrows, 0);
1495 scroll_to_row = INT_MAX;
1515 cargo_entry->
Clear();
1518 for (FlowStatMap::const_iterator it = flows.begin(); it != flows.end(); ++it) {
1519 StationID from = it->first;
1521 const FlowStat::SharesMap *shares = it->second.GetShares();
1522 uint32 prev_count = 0;
1523 for (FlowStat::SharesMap::const_iterator flow_it = shares->begin(); flow_it != shares->end(); ++flow_it) {
1524 StationID via = flow_it->second;
1526 if (via == this->window_number) {
1529 EstimateDestinations(i, from, via, flow_it->first - prev_count, via_entry);
1531 prev_count = flow_it->first;
1550 FlowStatMap::const_iterator map_it = flowmap.find(source);
1551 if (map_it != flowmap.end()) {
1552 const FlowStat::SharesMap *shares = map_it->second.GetShares();
1553 uint32 prev_count = 0;
1554 for (FlowStat::SharesMap::const_iterator i = shares->begin(); i != shares->end(); ++i) {
1556 prev_count = i->first;
1563 uint sum_estimated = 0;
1564 while (sum_estimated < count) {
1565 for (CargoDataSet::iterator i = tmp.
Begin(); i != tmp.
End() && sum_estimated <
count; ++i) {
1568 if (estimate == 0) estimate = 1;
1570 sum_estimated += estimate;
1571 if (sum_estimated > count) {
1572 estimate -= sum_estimated -
count;
1573 sum_estimated =
count;
1580 EstimateDestinations(cargo, source, child->
GetStation(), estimate, dest);
1601 for (FlowStatMap::const_iterator it = flows.begin(); it != flows.end(); ++it) {
1602 StationID from = it->first;
1604 const FlowStat::SharesMap *shares = it->second.GetShares();
1605 for (FlowStat::SharesMap::const_iterator flow_it = shares->begin(); flow_it != shares->end(); ++flow_it) {
1607 for (CargoDataSet::iterator dest_it = via_entry->
Begin(); dest_it != via_entry->
End(); ++dest_it) {
1609 ShowCargo(cargo, i, from, flow_it->second, dest_entry->
GetStation(), dest_entry->
GetCount());
1626 StationID next = it.GetKey();
1629 if (source_entry ==
nullptr) {
1635 if (via_entry ==
nullptr) {
1640 for (CargoDataSet::iterator dest_it = via_entry->
Begin(); dest_it != via_entry->
End(); ++dest_it) {
1646 this->ShowCargo(cargo, i, NEW_STATION, NEW_STATION, NEW_STATION, packets.
ReservedCount());
1658 if (this->cached_destinations.
Retrieve(i) ==
nullptr) {
1659 this->RecalcDestinations(i);
1662 if (this->current_mode == MODE_WAITING) {
1663 this->BuildCargoList(i, st->
goods[i].
cargo, cargo);
1665 this->BuildFlowList(i, st->
goods[i].
flows, cargo);
1676 std::list<StationID> stations;
1691 while (!stations.empty()) {
1692 filter = filter->
Retrieve(stations.back());
1693 stations.pop_back();
1696 this->displayed_rows.push_back(
RowDisplay(filter, next));
1709 if (station == this->window_number) {
1711 }
else if (station == INVALID_STATION) {
1713 }
else if (station == NEW_STATION) {
1714 return STR_STATION_VIEW_RESERVED;
1717 return other_station;
1731 for (
int i = column - 1; i > 0; --i) {
1732 if (this->groupings[i] == GR_DESTINATION) {
1734 return STR_STATION_VIEW_NONSTOP;
1736 return STR_STATION_VIEW_VIA;
1742 if (this->groupings[column + 1] == GR_DESTINATION) {
1743 CargoDataSet::iterator begin = cd->
Begin();
1744 CargoDataSet::iterator end = cd->
End();
1746 return STR_STATION_VIEW_NONSTOP;
1748 return STR_STATION_VIEW_VIA;
1752 return STR_STATION_VIEW_VIA;
1768 if (this->groupings[column] != GR_CARGO) {
1772 entry->Resort(
ST_COUNT, this->sort_orders[column]);
1774 for (CargoDataSet::iterator i = entry->
Begin(); i != entry->
End(); ++i) {
1777 Grouping grouping = this->groupings[column];
1781 if (pos > -maxrows && pos <= 0) {
1787 if (this->groupings[column] == GR_CARGO) {
1788 str = STR_STATION_VIEW_WAITING_CARGO;
1791 if (!auto_distributed) grouping = GR_SOURCE;
1796 str = this->GetEntryString(station, STR_STATION_VIEW_FROM_HERE, STR_STATION_VIEW_FROM, STR_STATION_VIEW_FROM_ANY);
1799 str = this->GetEntryString(station, STR_STATION_VIEW_VIA_HERE, STR_STATION_VIEW_VIA, STR_STATION_VIEW_VIA_ANY);
1800 if (str == STR_STATION_VIEW_VIA) str = this->SearchNonStop(cd, station, column);
1802 case GR_DESTINATION:
1803 str = this->GetEntryString(station, STR_STATION_VIEW_TO_HERE, STR_STATION_VIEW_TO, STR_STATION_VIEW_TO_ANY);
1814 int text_left = rtl ? r.left + this->expand_shrink_width : r.left +
WD_FRAMERECT_LEFT + column * this->expand_shrink_width;
1815 int text_right = rtl ? r.right -
WD_FRAMERECT_LEFT - column * this->expand_shrink_width : r.right - this->expand_shrink_width;
1821 if (column < NUM_COLUMNS - 1) {
1822 const char *sym =
nullptr;
1825 }
else if (auto_distributed && str != STR_STATION_VIEW_RESERVED) {
1834 if (sym)
DrawString(shrink_left, shrink_right, y, sym, TC_YELLOW);
1836 this->SetDisplayedRow(cd);
1839 if (auto_distributed || column == 0) {
1840 pos = this->DrawEntries(cd, r, pos, maxrows, column + 1,
cargo);
1855 CargoTypes cargo_mask = 0;
1907 if (filter->
Retrieve(next) !=
nullptr) {
1920 if (row < 0 || (uint)row >= this->displayed_rows.size())
return;
1922 this->scroll_to_row = row;
1924 RowDisplay &display = this->displayed_rows[row];
1925 if (display.
filter == &this->expanded_rows) {
1926 this->HandleCargoWaitingClick<CargoID>(display.
filter, display.
next_cargo);
1957 if (this->GetWidget<NWidgetCore>(
WID_SV_ACCEPTS_RATINGS)->widget_data == STR_STATION_VIEW_RATINGS_BUTTON) {
1958 nwi->
SetDataTip(STR_STATION_VIEW_ACCEPTS_BUTTON, STR_STATION_VIEW_ACCEPTS_TOOLTIP);
1959 height_change = this->rating_lines - this->accepts_lines;
1961 nwi->
SetDataTip(STR_STATION_VIEW_RATINGS_BUTTON, STR_STATION_VIEW_RATINGS_TOOLTIP);
1962 height_change = this->accepts_lines - this->rating_lines;
1993 this->current_mode * 2 + (this->sortings[1] ==
ST_COUNT ? 1 : 0),
2004 this->SelectSortOrder(this->sort_orders[1] == SO_ASCENDING ? SO_DESCENDING : SO_ASCENDING);
2018 this->sort_orders[1] = this->sort_orders[2] = this->sort_orders[3] = order;
2030 switch (_sort_names[index]) {
2031 case STR_STATION_VIEW_WAITING_STATION:
2032 this->current_mode = MODE_WAITING;
2033 this->sortings[1] = this->sortings[2] = this->sortings[3] =
ST_AS_GROUPING;
2035 case STR_STATION_VIEW_WAITING_AMOUNT:
2036 this->current_mode = MODE_WAITING;
2037 this->sortings[1] = this->sortings[2] = this->sortings[3] =
ST_COUNT;
2039 case STR_STATION_VIEW_PLANNED_STATION:
2040 this->current_mode = MODE_PLANNED;
2041 this->sortings[1] = this->sortings[2] = this->sortings[3] =
ST_AS_GROUPING;
2043 case STR_STATION_VIEW_PLANNED_AMOUNT:
2044 this->current_mode = MODE_PLANNED;
2045 this->sortings[1] = this->sortings[2] = this->sortings[3] =
ST_COUNT;
2051 this->GetWidget<NWidgetCore>(
WID_SV_SORT_BY)->widget_data = _sort_names[index];
2061 this->grouping_index = index;
2063 this->GetWidget<NWidgetCore>(
WID_SV_GROUP_BY)->widget_data = _group_names[index];
2064 switch (_group_names[index]) {
2065 case STR_STATION_VIEW_GROUP_S_V_D:
2066 this->groupings[1] = GR_SOURCE;
2067 this->groupings[2] = GR_NEXT;
2068 this->groupings[3] = GR_DESTINATION;
2070 case STR_STATION_VIEW_GROUP_S_D_V:
2071 this->groupings[1] = GR_SOURCE;
2072 this->groupings[2] = GR_DESTINATION;
2073 this->groupings[3] = GR_NEXT;
2075 case STR_STATION_VIEW_GROUP_V_S_D:
2076 this->groupings[1] = GR_NEXT;
2077 this->groupings[2] = GR_SOURCE;
2078 this->groupings[3] = GR_DESTINATION;
2080 case STR_STATION_VIEW_GROUP_V_D_S:
2081 this->groupings[1] = GR_NEXT;
2082 this->groupings[2] = GR_DESTINATION;
2083 this->groupings[3] = GR_SOURCE;
2085 case STR_STATION_VIEW_GROUP_D_S_V:
2086 this->groupings[1] = GR_DESTINATION;
2087 this->groupings[2] = GR_SOURCE;
2088 this->groupings[3] = GR_NEXT;
2090 case STR_STATION_VIEW_GROUP_D_V_S:
2091 this->groupings[1] = GR_DESTINATION;
2092 this->groupings[2] = GR_NEXT;
2093 this->groupings[3] = GR_SOURCE;
2102 this->SelectSortBy(index);
2104 this->SelectGroupBy(index);
2110 if (str ==
nullptr)
return;
2138 STR_STATION_VIEW_WAITING_STATION,
2139 STR_STATION_VIEW_WAITING_AMOUNT,
2140 STR_STATION_VIEW_PLANNED_STATION,
2141 STR_STATION_VIEW_PLANNED_AMOUNT,
2146 STR_STATION_VIEW_GROUP_S_V_D,
2147 STR_STATION_VIEW_GROUP_S_D_V,
2148 STR_STATION_VIEW_GROUP_V_S_D,
2149 STR_STATION_VIEW_GROUP_V_D_S,
2150 STR_STATION_VIEW_GROUP_D_S_V,
2151 STR_STATION_VIEW_GROUP_D_V_S,
2156 WDP_AUTO,
"view_station", 249, 117,
2159 _nested_station_view_widgets,
lengthof(_nested_station_view_widgets)
2169 AllocateWindowDescFront<StationViewWindow>(&_station_view_desc,
station);
2178 static std::vector<TileAndStation> _deleted_stations_nearby;
2179 static std::vector<StationID> _stations_nearby_list;
2194 for (uint i = 0; i < _deleted_stations_nearby.size(); i++) {
2195 auto ts = _deleted_stations_nearby.begin() + i;
2196 if (ts->tile == tile) {
2197 _stations_nearby_list.push_back(_deleted_stations_nearby[i].
station);
2198 _deleted_stations_nearby.erase(ts);
2209 if (!T::IsValidID(sid))
return false;
2211 T *st = T::Get(sid);
2212 if (st->owner !=
_local_company || std::find(_stations_nearby_list.begin(), _stations_nearby_list.end(), sid) != _stations_nearby_list.end())
return false;
2214 if (st->rect.BeforeAddRect(ctx->
tile, ctx->
w, ctx->
h, StationRect::ADD_TEST).Succeeded()) {
2215 _stations_nearby_list.push_back(sid);
2235 _stations_nearby_list.clear();
2236 _deleted_stations_nearby.clear();
2245 if (T::IsExpected(st) && !st->IsInUse() && st->owner ==
_local_company) {
2248 _deleted_stations_nearby.push_back({st->xy, st->index});
2253 AddNearbyStation<T>(st->xy, &ctx);
2271 static const NWidgetPart _nested_select_station_widgets[] = {
2298 select_station_cmd(cmd),
2301 this->CreateNestedTree();
2302 this->vscroll = this->GetScrollbar(WID_JS_SCROLLBAR);
2303 this->GetWidget<NWidgetCore>(WID_JS_CAPTION)->widget_data = T::EXPECTED_FACIL ==
FACIL_WAYPOINT ? STR_JOIN_WAYPOINT_CAPTION : STR_JOIN_STATION_CAPTION;
2304 this->FinishInitNested(0);
2305 this->OnInvalidateData(0);
2319 if (widget != WID_JS_PANEL)
return;
2323 for (uint i = 0; i < _stations_nearby_list.size(); i++) {
2324 const T *st = T::Get(_stations_nearby_list[i]);
2330 resize->height = d.height;
2339 if (widget != WID_JS_PANEL)
return;
2344 y += this->resize.step_height;
2347 for (uint i = max<uint>(1, this->vscroll->
GetPosition()); i <= _stations_nearby_list.size(); ++i, y += this->resize.step_height) {
2351 const T *st = T::Get(_stations_nearby_list[i - 1]);
2360 if (widget != WID_JS_PANEL)
return;
2363 bool distant_join = (st_index > 0);
2364 if (distant_join) st_index--;
2366 if (distant_join && st_index >= _stations_nearby_list.size())
return;
2369 SB(this->select_station_cmd.
p2, 16, 16,
2370 (distant_join ? _stations_nearby_list[st_index] : NEW_STATION));
2381 if (_thd.
dirty & 2) {
2399 if (!gui_scope)
return;
2400 FindStationsNearby<T>(this->area,
true);
2401 this->vscroll->
SetCount((uint)_stations_nearby_list.size() + 1);
2407 if (widget != WID_JS_PANEL || T::EXPECTED_FACIL ==
FACIL_WAYPOINT) {
2414 if (st_index == 0 || st_index > _stations_nearby_list.size()) {
2424 WDP_AUTO,
"build_station_join", 200, 180,
2427 _nested_select_station_widgets,
lengthof(_nested_select_station_widgets)
2447 if (selection_window !=
nullptr) {
2449 delete selection_window;
2462 const T *st = FindStationsNearby<T>(ta,
false);
2475 if (StationJoinerNeeded<T>(cmd, ta)) {
2490 ShowSelectBaseStationIfNeeded<Station>(cmd, ta);
2500 ShowSelectBaseStationIfNeeded<Waypoint>(cmd, ta);
Functions related to OTTD's strings.
Owner
Enum for all companies/owners.
void HandleCargoWaitingClick(CargoDataEntry *filter, Tid next)
Expand or collapse a specific row.
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.
Base types for having sorted lists in GUIs.
StationFacility facilities
The facilities that this station has.
void RebuildDone()
Notify the sortlist that the rebuild is done.
CargoDataSet::iterator Begin() const
Get an iterator pointing to the begin of the set of children.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Definition of stuff that is very close to a company, like the company struct itself.
static Titem * GetIfValid(size_t index)
Returns Titem with given index.
int DrawAcceptedCargo(const Rect &r) const
Draw accepted cargo in the WID_SV_ACCEPT_RATING_LIST widget.
static uint minu(const uint a, const uint b)
Returns the minimum of two unsigned integers.
Select station (when joining stations); Window numbers:
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
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.
std::vector< const CargoSpec * > _sorted_cargo_specs
Cargo specifications sorted alphabetically by name.
Horizontally center the text.
The information about a vehicle list.
ResizeInfo resize
Resize information.
CargoTypes _cargo_mask
Bitmask of cargo types available.
CargoID next_cargo
ID of the cargo belonging to the entry actually displayed if it's cargo.
Window(WindowDesc *desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
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...
void Update(uint count)
Update the count for this entry and propagate the change to the parent entry if there is one...
void CheckRedrawStationCoverage(const Window *w)
Check whether we need to redraw the station coverage text.
Point pos
Location, in tile "units", of the northern tile of the selected area.
void SetWidgetLoweredState(byte widget_index, bool lowered_stat)
Sets the lowered/raised status of a widget.
open/close an airport to incoming aircraft
Window * parent
Parent window.
High level window description.
StationID next_station
ID of the station belonging to the entry actually displayed if it's to/from/via.
Functions and type for generating vehicle lists.
static bool StationNameSorter(const Station *const &a, const Station *const &b)
Sort stations by their name.
uint8 station_gui_group_order
the order of grouping cargo entries in the station gui
int left
x position of left edge of the window
CargoList that is used for stations.
void DrawWidgets() const
Paint all widgets of a window.
bool station_show_coverage
whether to highlight coverage area
Group by estimated final destination ("to").
CommandContainer select_station_cmd
Command to build new station.
static T ToggleBit(T &x, const uint8 y)
Toggles a bit in a variable.
int GetCharacterHeight(FontSize size)
Get height of a character for a given font size.
void ShowSelectStationIfNeeded(const CommandContainer &cmd, TileArea ta)
Show the station selection window when needed.
Contains enums and function declarations connected with stations GUI.
void SetWidgetDirty(byte widget_index) const
Invalidate a widget, i.e.
CargoArray GetAcceptanceAroundTiles(TileIndex tile, int w, int h, int rad, CargoTypes *always_accepted)
Get the acceptance of cargoes around the tile in 1/8.
Offset at top to draw the frame rectangular area.
Functions related to debugging.
static T SetBit(T &x, const uint8 y)
Set a bit in a variable.
Draw only passenger class cargoes.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
Window * FindWindowById(WindowClass cls, WindowNumber number)
Find a window by its class and window number.
void Remove(StationID station)
Remove a child associated with the given station.
void SetSortFuncs(SortFunction *const *n_funcs)
Hand the array of sort function pointers to the sort list.
void ShowQueryString(StringID str, StringID caption, uint maxsize, Window *parent, CharSetFilter afilter, QueryStringFlags flags)
Show a query popup window with a textbox in it.
bool distant_join_stations
allow to join non-adjacent stations
static int ScaleGUITrad(int value)
Scale traditional pixel dimensions to GUI zoom level.
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.
Maximal number of cargo types in a game.
void RecalcDestinations(CargoID i)
Rebuild the cache for estimated destinations which is used to quickly show the "destination" entries ...
static bool StationTypeSorter(const Station *const &a, const Station *const &b)
Sort stations by their type.
Specification of a cargo type.
VehicleType
Available vehicle types.
Point size
Size, in tile "units", of the white/red selection area.
static const StringID _group_names[]
Names of the grouping options in the dropdown.
void OnDropdownSelect(int widget, int index) override
A dropdown option associated to this window has been selected.
void SelectGroupBy(int index)
Select a new grouping mode for the cargo view.
CargoDataEntry cached_destinations
Cache for the flows passing through this station.
The station has no facilities at all.
uint TotalCount() const
Returns total count of cargo at the station, including cargo which is already reserved for loading...
void OnRealtimeTick(uint delta_ms) override
Called periodically.
void ShowCompanyStations(CompanyID company)
Opens window with list of company's stations.
static uint TileX(TileIndex tile)
Get the X component of a tile.
void SelectSortBy(int index)
Select a new sort criterium for the cargo view.
int DivideApprox(int a, int b)
Deterministic approximate division.
int scroll_to_row
If set, scroll the main viewport to the station pointed to by this row.
uint num_children
the number of subentries belonging to this entry.
CargoDataSet::iterator End() const
Get an iterator pointing to the end of the set of children.
byte station_spread
amount a station may spread
void ToggleWidgetLoweredState(byte widget_index)
Invert the lowered/raised status of a widget.
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.
Stores station stats for a single cargo.
Tindex index
Index of this pool item.
void BuildCargoList(CargoDataEntry *cargo, const Station *st)
Build up the cargo view for all cargoes.
Manual distribution. No link graph calculations are run.
void UpdateTileSelection()
Updates tile highlighting for all cases.
void SelectSortOrder(SortOrder order)
Select a new sort order for the cargo view.
TileArea area
Location of new station.
bool NeedResort()
Check if a resort is needed next loop If used the resort timer will decrease every call till 0...
void OnQueryTextFinished(char *str) override
The query window opened from this window has closed.
void ShowSelectWaypointIfNeeded(const CommandContainer &cmd, TileArea ta)
Show the waypoint selection window when needed.
StringID abbrev
Two letter abbreviation for this cargo type.
#define lastof(x)
Get the last element of an fixed size array.
Invalidation
Type of data invalidation.
CargoDataEntry * parent
the parent of this entry.
static Pool::IterateWrapper< Station > Iterate(size_t from=0)
Returns an iterable ensemble of all valid stations of type T.
A row being displayed in the cargo view (as opposed to being "hidden" behind a plus sign)...
Stuff related to the text buffer GUI.
static bool StationRatingMinSorter(const Station *const &a, const Station *const &b)
Sort stations by their rating.
A cargo data entry representing one possible row in the station view window's top part...
#define FOR_EACH_SET_BIT(bitpos_var, bitset_value)
Do an operation for each set set bit in a value.
bool persistent_buildingtools
keep the building tools active after usage
void SetTransfers(bool value)
Set the transfers state.
CommandFlags GetCommandFlags(uint32 cmd)
StationCargoList cargo
The cargo packets of cargo waiting in this station.
static T max(const T a, const T b)
Returns the maximum of two values.
The list of stations per company.
Town * town
The town this station is associated with.
bool HasRating() const
Does this cargo have a rating at this station?
void RaiseWidget(byte widget_index)
Marks a widget as raised.
uint16 w
The width of the area.
AcceptListHeight
Height of the WID_SV_ACCEPT_RATING_LIST widget for different views.
void CreateNestedTree(bool fill_nested=true)
Perform the first part of the initialization of a nested widget tree.
Functions related to the vehicle's GUIs.
void SetListing(Listing l)
Import sort conditions.
Large amount of vertical space between two paragraphs of text.
CargoDataVector displayed_rows
Parent entry of currently displayed rows (including collapsed ones).
StationSettings station
settings related to station management
GoodsEntry goods[NUM_CARGO]
Goods at this station.
static const uint TILE_SIZE
Tile size in world coordinates.
StringID name
Name of this type of cargo.
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 AddNearbyStation(TileIndex tile, void *user_data)
Add station on this tile to _stations_nearby_list if it's fully within the station spread...
bool NeedRebuild() const
Check if a rebuild is needed.
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.
Functions related to (drawing on) viewports.
void ForceRebuild()
Force that a rebuild is needed.
A connected component of a link graph.
Group by source of cargo ("from").
CargoDataEntry * InsertOrRetrieve(CargoID cargo)
Insert a new child or retrieve an existing child using a cargo ID as ID.
Data structure for an opened window.
bool _ctrl_pressed
Is Ctrl pressed?
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
CargoDataSet * children
the children of this entry.
static const uint8 PC_GREEN
Green palette colour.
static bool StationWaitingTotalSorter(const Station *const &a, const Station *const &b)
Sort stations by their waiting cargo.
enable the 'Default' button ("\0" is returned)
Functions related to low-level strings.
StringID GetEntryString(StationID station, StringID here, StringID other_station, StringID any)
Select the correct string for an entry referring to the specified station.
byte rating
Station rating for this cargo.
The tile has no ownership.
bool transfers
If there are transfers for this cargo.
void SortStationsList()
Sort the stations list.
void HandleCargoWaitingClick(int row)
Handle a click on a specific row in the cargo view.
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a given tiletype.
void OnResize() override
Called after the window got resized.
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)
#define FONT_HEIGHT_SMALL
Height of characters in the small (FS_SMALL) font.
CommandCost DoCommand(const CommandContainer *container, DoCommandFlag flags)
Shorthand for calling the long DoCommand with a container.
LinkGraphID link_graph
Link graph this station belongs to.
Group by next station ("via").
This window is used for construction; close it whenever changing company.
bool IsWidgetLowered(byte widget_index) const
Gets the lowered state of a widget.
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...
Listing GetListing() const
Export current sort conditions.
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
void DrawWidget(const Rect &r, int widget) const override
Draw the contents of a nested widget.
uint DistanceMax(TileIndex t0, TileIndex t1)
Gets the biggest distance component (x or y) between the two given tiles.
void OnPaint() override
The window must be repainted.
static Owner GetTileOwner(TileIndex tile)
Returns the owner of a tile.
Structure for buffering the build command when selecting a station to join.
#define FONT_HEIGHT_NORMAL
Height of characters in the normal (FS_NORMAL) font.
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
CargoID GetCargo() const
Get the cargo ID for this entry.
ClientSettings _settings_client
The current settings for this game.
byte status
Status of this cargo, see GoodsEntryStatus.
Container for cargo from the same location and time.
StationCoverageType
Types of cargo to display for station coverage.
#define TILE_AREA_LOOP(var, ta)
A loop which iterates over the tiles of a TileArea.
Definition of base types and functions in a cross-platform compatible way.
StationID SourceStation() const
Gets the ID of the station where the cargo was loaded for the first time.
the length of the string is counted in characters
int accepts_lines
Number of lines in the accepted cargo view.
#define TILE_ADDXY(tile, x, y)
Adds a given offset to a tile.
A number of safeguards to prevent using unsafe methods.
uint Monthly(uint base) const
Scale a value to its monthly equivalent, based on last compression.
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
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.
static const uint64 AIRPORT_CLOSED_block
Dummy block for indicating a closed airport.
bool HasTransfers() const
Has this entry transfers.
rectangle (stations, depots, ...)
static uint CeilDiv(uint a, uint b)
Computes ceil(a / b) for non-negative a and b.
bool HasStationInUse(StationID station, bool include_company, CompanyID company)
Tests whether the company's vehicles have this station in orders.
NodeID node
ID of node in link graph referring to this goods entry.
void DrawSortButtonState(int widget, SortButtonState state) const
Draw a sort button's up or down arrow symbol.
const Scrollbar * GetScrollbar(uint widnum) const
Return the Scrollbar to a widget index.
Represents the covered area of e.g.
void LowerWidget(byte widget_index)
Marks a widget as lowered.
HighLightStyle drawstyle
Lower bits 0-3 are reserved for detailed highlight information.
void SetViewportCatchmentStation(const Station *st, bool sel)
Select or deselect station for coverage area highlight.
static void FindStationsAroundSelection()
Find stations adjacent to the current tile highlight area, so that existing coverage area can be draw...
CargoDataEntry expanded_rows
Parent entry of currently expanded rows.
uint GetNumChildren() const
Get the number of children for this entry.
void BuildFlowList(CargoID i, const FlowStatMap &flows, CargoDataEntry *cargo)
Build up the cargo view for PLANNED mode and a specific cargo.
Road vehicle list; Window numbers:
void Clear()
Delete all subentries, reset count and num_children and adapt parent's count.
Offset at bottom to draw the frame rectangular area.
static DoCommandFlag CommandFlagsToDCFlags(CommandFlags cmd_flags)
Extracts the DC flags needed for DoCommand from the flags returned by GetCommandFlags.
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...
Station view; Window numbers:
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
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.
CargoDataEntry * filter
Parent of the cargo entry belonging to the row.
uint64 flags
stores which blocks on the airport are taken. was 16 bit earlier on, then 32
bool DoCommandP(const CommandContainer *container, bool my_cmd)
Shortcut for the long DoCommandP when having a container with the data.
#define lengthof(x)
Return the length of an fixed size array.
void BuildCargoList(CargoID i, const StationCargoList &packets, CargoDataEntry *cargo)
Build up the cargo view for WAITING mode and a specific cargo.
static T min(const T a, const T b)
Returns the minimum of two values.
int DrawCargoRatings(const Rect &r) const
Draw cargo ratings in the WID_SV_ACCEPT_RATING_LIST widget.
#define FOR_ALL_SORTED_STANDARD_CARGOSPECS(var)
Loop header for iterating over 'real' cargoes, sorted by name.
static bool IsCargoInClass(CargoID c, CargoClass cc)
Does cargo c have cargo class cc?
void OnResize() override
Called after the window got resized.
void SetSortType(uint8 n_type)
Set the sorttype of the list.
bool Sort(SortFunction *compare)
Sort the list.
static int SortButtonWidth()
Get width of up/down arrow of sort button state.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
bool Failed() const
Did this command fail?
StationID station
StationID.
uint ReservedCount() const
Returns sum of cargo reserved for loading onto vehicles.
Station list; Window numbers:
by the same principle the entries are being grouped
FlowStatMap flows
Planned flows through this station.
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
void ShowExtraViewPortWindow(TileIndex tile=INVALID_TILE)
Show a new Extra Viewport window.
#define DEBUG(name, level,...)
Output a line of debugging information.
Dimension GetStringBoundingBox(const char *str, FontSize start_fontsize)
Return the string dimension in pixels.
TileIndex tile
The base tile of the area.
void OnGameTick() override
Called once per (game) tick.
void ForceResort()
Force a resort next Sort call Reset the resort timer if used too.
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
No window, redirects to WC_MAIN_WINDOW.
void DeleteWindowById(WindowClass cls, WindowNumber number, bool force)
Delete a window by its class and window number (if it is open).
CargoArray GetProductionAroundTiles(TileIndex tile, int w, int h, int rad)
Get the cargo types being produced around the tile (in a rectangle).
void DrawWidget(const Rect &r, int widget) const override
Draw the contents of a nested widget.
Functions related to companies.
static bool StationRatingMaxSorter(const Station *const &a, const Station *const &b)
Sort stations by their rating.
uint8 _sorted_standard_cargo_specs_size
Number of standard cargo specifications stored in the _sorted_cargo_specs array.
static StationID GetStationIndex(TileIndex t)
Get StationID from a tile.
static TileIndex TileVirtXY(uint x, uint y)
Get a tile from the virtual XY-coordinate.
StringID SearchNonStop(CargoDataEntry *cd, StationID station, int column)
Determine if we need to show the special "non-stop" string.
static uint MapSize()
Get the size of the map.
Mode current_mode
Currently selected display mode of cargo view.
Class for storing amounts of cargo.
Show cargo waiting at the station.
static void DrawCargoIcons(CargoID i, uint waiting, int left, int right, int y)
Draws icons of waiting cargo in the StationView window.
Both numeric and alphabetic and spaces and stuff.
SpriteID GetCargoIcon() const
Get sprite for showing cargo of this type.
GUISettings gui
settings related to the GUI
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
int strnatcmp(const char *s1, const char *s2, bool ignore_garbage_at_front)
Compares two strings using case insensitive natural sort.
static const T * FindStationsNearby(TileArea ta, bool distant_join)
Circulate around the to-be-built station to find stations we could join.
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
static CargoSpec * Get(size_t index)
Retrieve cargo details for the given cargo ID.
StationCargoPacketMap ::const_iterator ConstIterator
The const iterator for our container.
Ships list; Window numbers:
TextColour GetContrastColour(uint8 background, uint8 threshold)
Determine a contrasty text colour for a coloured background.
uint32 TileIndex
The index/ID of a Tile.
void SetStringParameters(int widget) const override
Initialize string parameters for a widget.
Draw all non-passenger class cargoes.
static uint ToPercent8(uint i)
Converts a "fract" value 0..255 to "percent" value 0..100.
TextDirection _current_text_dir
Text direction of the currently selected language.
void ToggleSortOrder()
Toggle the sort order Since that is the worst condition for the sort function reverse the list here...
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 NWidgetBase * CargoWidgets(int *biggest_index)
Make a horizontal row of cargo buttons, starting at widget WID_STL_CARGOSTART.
static uint TileY(TileIndex tile)
Get the Y component of a tile.
CargoDataEntry * Retrieve(CargoID cargo) const
Retrieve a child for the given cargo.
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 * Retrieve(StationID station) const
Retrieve a child for the given station.
const Station * _viewport_highlight_station
Currently selected station for coverage area highlight.
void ShowStationViewWindow(StationID station)
Opens StationViewWindow for given station.
TileIndex xy
Base tile of the station.
void SetDisplayedRow(const CargoDataEntry *data)
Mark a specific row, characterized by its CargoDataEntry, as expanded.
static const uint8 PC_RED
Red palette colour.
Trains list; Window numbers:
Functions related to zooming.
void Remove(CargoID cargo)
Remove a child associated with the given cargo.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
uint8 station_gui_sort_by
sort cargo entries in the station gui by station name or amount
static bool StationJoinerNeeded(const CommandContainer &cmd, TileArea ta)
Check whether we need to show the station selection window.
static uint MapMaxY()
Gets the maximum Y coordinate within the map, including MP_VOID.
static Station * GetByTile(TileIndex tile)
Get the station belonging to a specific tile.
Functions related to the drop down widget.
uint8 exclusive_counter
months till the exclusivity expires
StationID GetStation() const
Get the station ID for this entry.
Aircraft list; Window numbers:
bool ScrollMainWindowToTile(TileIndex tile, bool instant)
Scrolls the viewport of the main window to a given location.
Mode
Display mode of the cargo view.
Functions related to commands.
Types/functions related to cargoes.
static bool IsValidID(size_t index)
Tests whether given index is a valid index for station of this type.
Coordinates of a point in 2D.
CargoID Index() const
Determines index of this cargospec.
Owner owner
The owner of this station.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
Data structure describing how to show the list (what sort direction and criteria).
bool freeze
Freeze highlight in place.
Index of the small font in the font tables.
bool adjacent_stations
allow stations to be built directly adjacent to other stations
Flow descriptions by origin stations.
Declaration of link graph classes used for cargo distribution.
static const StringID INVALID_STRING_ID
Constant representing an invalid string (16bit in case it is used in savegames)
Owner owner
The owner of the content shown in this window. Company colour is acquired from this variable...
Grouping
Type of grouping used in each of the "columns".
static TileIndex TileAddByDir(TileIndex tile, Direction dir)
Adds a Direction to a tile.
static const StringID _sort_names[]
Names of the sorting options in the dropdown.
Airport airport
Tile area the airport covers.
void OnPaint() override
The window must be repainted.
void ShowSelectBaseStationIfNeeded(const CommandContainer &cmd, TileArea ta)
Show the station selection window when needed.
Offset at right to draw the frame rectangular area.
static const uint MAX_LENGTH_STATION_NAME_CHARS
The maximum length of a station name in characters including '\0'.
int width
width of the window (number of pixels to the right in x direction)
StationID station
ID of the station this entry is associated with.
const Tcont * Packets() const
Returns a pointer to the cargo packet list (so you can iterate over it etc).
void OnMouseOver(Point pt, int widget) override
The mouse is currently moving over the window or has just moved outside of the window.
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
bool IsValid() const
Tests for validity of this cargospec.
static const TileIndex INVALID_TILE
The very nice invalid tile marker.
Window for selecting stations/waypoints to (distant) join to.
int rating_lines
Number of lines in the cargo ratings view.
bool IsDescSortOrder() const
Check if the sort order is descending.
Station with truck stops.
#define CMD_MSG(x)
Used to combine a StringID with the command.
uint count
sum of counts of all children or amount of cargo for this entry.
uint16 Count() const
Gets the number of 'items' in this packet.
int32 WindowNumber
Number to differentiate different windows of the same class.
uint AvailableCount() const
Returns sum of cargo still available for loading at the sation.
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows)...
Specification of a rectangle with absolute coordinates of all edges.
byte CargoID
Cargo slots to indicate a cargo type within a game.
Text is written right-to-left by default.
static uint MapMaxX()
Gets the maximum X coordinate within the map, including MP_VOID.
WindowNumber window_number
Window number within the window class.
Functions related to tile highlights.
Window functions not directly related to making/drawing windows.
void IncrementSize()
Increment.
void BuildStationsList(const Owner owner)
(Re)Build station list
Station with train station.
Find a place automatically.
void SetStringParameters(int widget) const override
Initialize string parameters for a widget.
uint expand_shrink_width
The width allocated to the expand/shrink 'button'.
GUI functions that shouldn't be here.
bool SortFunction(const T &, const T &)
Signature of sort function.
Base classes/functions for stations.
static Station * Get(size_t index)
Gets station with given index.
uint16 h
The height of the area.
uint GetCount() const
Get the cargo count for this entry.
uint8 station_gui_sort_order
the sort order of entries in the station gui - ascending or descending
CompanyID exclusivity
which company has exclusivity
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
CargoDataEntry * GetParent() const
Get the parent entry for this entry.
Dimensions (a width and height) of a rectangle in 2D.
int grouping_index
Currently selected entry in the grouping drop down.
Offset at left to draw the frame rectangular area.
Struct containing TileIndex and StationID.
Base class for all station-ish types.
uint32 cmd
command being executed.
LinkGraphSettings linkgraph
settings for link graph calculations
Set when the station accepts the cargo currently for final deliveries.
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 dirty
Whether the build station window needs to redraw due to the changed selection.
static TileIndex TileXY(uint x, uint y)
Returns the TileIndex of a coordinate.
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
CargoID cargo
ID of the cargo this entry is associated with.
CargoDataEntry * InsertOrRetrieve(StationID station)
Insert a new child or retrieve an existing child using a station ID as ID.
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.
static bool StationWaitingAvailableSorter(const Station *const &a, const Station *const &b)
Sort stations by their available waiting cargo.
uint8 SortType() const
Get the sorttype of the list.
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.