47#include "table/strings.h"
61static constexpr std::initializer_list<NWidgetPart> _nested_build_vehicle_widgets = {
77 NWidget(
WWT_IMGBTN, COLOUR_GREY,
WID_BV_CONFIGURE_BADGES),
SetAspect(WidgetDimensions::ASPECT_UP_DOWN_BUTTON),
SetResize(0, 0),
SetFill(0, 1),
SetSpriteTip(SPR_EXTRA_MENU, STR_BADGE_CONFIG_MENU_TOOLTIP),
80 NWidget(
WWT_EDITBOX, COLOUR_GREY,
WID_BV_FILTER),
SetResize(1, 0),
SetFill(1, 0),
SetPadding(2),
SetStringTip(STR_LIST_FILTER_OSKTITLE, STR_LIST_FILTER_TOOLTIP),
87 NWidget(
WWT_MATRIX, COLOUR_GREY,
WID_BV_LIST),
SetResize(1, 1),
SetFill(1, 0),
SetMatrixDataTip(1, 0),
SetScrollbar(
WID_BV_SCROLLBAR),
123 const auto r = va - vb;
131static EngineID _last_engine[2] = { EngineID::Invalid(), EngineID::Invalid() };
136 static std::string last_name[2] = { {}, {} };
160 const int r = va - vb;
251 double v_a = (double)p_a / (
double)r_a;
252 double v_b = (double)p_b / (
double)r_b;
284 int r = val_a - val_b;
330 uint16_t mail_a, mail_b;
413 STR_SORT_BY_ENGINE_ID,
415 STR_SORT_BY_MAX_SPEED,
417 STR_SORT_BY_TRACTIVE_EFFORT,
418 STR_SORT_BY_INTRO_DATE,
420 STR_SORT_BY_RUNNING_COST,
421 STR_SORT_BY_POWER_VS_RUNNING_COST,
422 STR_SORT_BY_RELIABILITY,
423 STR_SORT_BY_CARGO_CAPACITY,
426 STR_SORT_BY_ENGINE_ID,
428 STR_SORT_BY_MAX_SPEED,
430 STR_SORT_BY_TRACTIVE_EFFORT,
431 STR_SORT_BY_INTRO_DATE,
433 STR_SORT_BY_RUNNING_COST,
434 STR_SORT_BY_POWER_VS_RUNNING_COST,
435 STR_SORT_BY_RELIABILITY,
436 STR_SORT_BY_CARGO_CAPACITY,
439 STR_SORT_BY_ENGINE_ID,
441 STR_SORT_BY_MAX_SPEED,
442 STR_SORT_BY_INTRO_DATE,
444 STR_SORT_BY_RUNNING_COST,
445 STR_SORT_BY_RELIABILITY,
446 STR_SORT_BY_CARGO_CAPACITY,
449 STR_SORT_BY_ENGINE_ID,
451 STR_SORT_BY_MAX_SPEED,
452 STR_SORT_BY_INTRO_DATE,
454 STR_SORT_BY_RUNNING_COST,
455 STR_SORT_BY_RELIABILITY,
456 STR_SORT_BY_CARGO_CAPACITY,
486 if (cap[cargo] != 0) {
488 weight +=
CargoSpec::Get(cargo)->WeightOfNUnitsInTrain(cap[cargo]);
497static int DrawCargoCapacityInfo(
int left,
int right,
int y,
TestedEngineDetails &te,
bool refittable)
503 DrawString(left, right, y,
GetString(STR_PURCHASE_INFO_CAPACITY, cargo_type, te.
all_capacities[cargo_type], refittable ? STR_PURCHASE_INFO_REFITTABLE : STR_EMPTY));
561 std::string railtypes{};
567 if (!railtypes.empty()) railtypes += list_separator;
578 if (
_settings_game.vehicle.train_acceleration_model != AM_ORIGINAL) {
579 bool is_maglev =
true;
609 if (
_settings_game.vehicle.roadveh_acceleration_model != AM_ORIGINAL) {
654 uint ocean_speed = e->VehInfo<
ShipVehicleInfo>().ApplyWaterClassSpeedFrac(raw_speed,
true);
655 uint canal_speed = e->VehInfo<
ShipVehicleInfo>().ApplyWaterClassSpeedFrac(raw_speed,
false);
657 if (ocean_speed == canal_speed) {
748 std::array<int32_t, 16> regs100;
750 if (callback ==
CALLBACK_FAILED || callback == 0x400)
return std::nullopt;
752 assert(grffile !=
nullptr);
753 if (callback == 0x40F) {
756 if (callback > 0x400) {
779void TestedEngineDetails::FillDefaultCapacities(
const Engine *e)
810 bool articulated_cargo =
false;
813 default: NOT_REACHED();
816 y = DrawRailWagonPurchaseInfo(left, right, y, engine_number, &e->VehInfo<
RailVehicleInfo>(), te);
818 y = DrawRailEnginePurchaseInfo(left, right, y, engine_number, &e->VehInfo<
RailVehicleInfo>(), te);
820 articulated_cargo =
true;
824 y = DrawRoadVehPurchaseInfo(left, right, y, engine_number, te);
825 articulated_cargo =
true;
829 y = DrawShipPurchaseInfo(left, right, y, engine_number, refittable, te);
837 if (articulated_cargo) {
839 int new_y = DrawCargoCapacityInfo(left, right, y, te, refittable);
842 DrawString(left, right, y,
GetString(STR_PURCHASE_INFO_CAPACITY, INVALID_CARGO, 0, STR_EMPTY));
897 static const std::array<int8_t, VehicleType::VEH_COMPANY_END> sprite_y_offsets = { 0, 0, -1, -1 };
905 int sprite_width = sprite_left + sprite_right;
909 auto badge_column_widths = badge_classes.GetColumnWidths();
919 uint biggest_num_engines = 0;
920 for (
auto it = first; it != last; ++it) {
922 biggest_num_engines = std::max(biggest_num_engines, num_engines);
932 const int offset = (rtl ? -circle_width : circle_width) / 2;
935 for (
auto it = first; it != last; ++it) {
936 const auto &item = *it;
947 if (item.indent > 0) {
949 int tx = (rtl ? ir.right : ir.left) + offset;
950 for (uint lvl = 1; lvl <= item.indent; ++lvl) {
952 if (lvl < item.indent) tx += level_width;
957 GfxDrawLine(tx, ycentre, tx + offset - (rtl ? -1 : 1), ycentre, linecolour,
WidgetDimensions::scaled.fullbevel.top);
962 DrawSpriteIgnorePadding(is_folded ? SPR_CIRCLE_FOLDED : SPR_CIRCLE_UNFOLDED, PAL_NONE, fr.
WithY(textr),
SA_CENTER);
971 if (badge_column_widths.size() >= 1 && badge_column_widths[0] > 0) {
973 DrawEngineBadgeColumn(br, 0, badge_classes, e, pal);
974 tr = tr.
Indent(badge_column_widths[0], rtl);
977 int sprite_x = tr.
WithWidth(sprite_width, rtl).left + sprite_left;
982 if (badge_column_widths.size() >= 2 && badge_column_widths[1] > 0) {
984 DrawEngineBadgeColumn(br, 1, badge_classes, e, pal);
985 tr = tr.
Indent(badge_column_widths[1], rtl);
999 DrawSpriteIgnorePadding(SPR_GROUP_REPLACE_ACTIVE, num_engines == 0 ?
PALETTE_CRASH : PAL_NONE, rr,
SA_CENTER);
1003 if (badge_column_widths.size() >= 3 && badge_column_widths[2] > 0) {
1005 DrawEngineBadgeColumn(br, 2, badge_classes, e, pal);
1006 tr = tr.
Indent(badge_column_widths[2], !rtl);
1010 StringID str = hidden ? STR_HIDDEN_ENGINE_NAME : STR_ENGINE_NAME;
1014 std::string sort_prop_detail;
1017 case STR_SORT_BY_ENGINE_ID:
1020 case STR_SORT_BY_COST:
1021 sort_prop_detail =
GetString(STR_PURCHASE_SORT_DETAILS_COST, e->
GetCost());
1023 case STR_SORT_BY_MAX_SPEED:
1028 case STR_SORT_BY_POWER:
1029 if (
int power = e->
GetPower(); power != 0) {
1030 sort_prop_detail =
GetString(STR_PURCHASE_SORT_DETAILS_POWER, power);
1033 case STR_SORT_BY_TRACTIVE_EFFORT:
1038 sort_prop_detail =
GetString(STR_PURCHASE_SORT_DETAILS_MAX_TE, max_te);
1042 case STR_SORT_BY_INTRO_DATE: {
1044 sort_prop_detail =
GetString(STR_PURCHASE_SORT_DETAILS_INTRO_DATE, ymd.year);
1047 case STR_SORT_BY_NAME:
1050 case STR_SORT_BY_RUNNING_COST:
1055 case STR_SORT_BY_POWER_VS_RUNNING_COST:
1058 sort_prop_detail =
GetString(STR_PURCHASE_SORT_DETAILS_POWER_VS_RUNNING_COST, 100 * e->
GetPower() / rc, 2);
1061 case STR_SORT_BY_RELIABILITY:
1066 case STR_SORT_BY_CARGO_CAPACITY: {
1067 uint total_capacity;
1081 total_capacity = aircraft_cap + mail_cap;
1088 if (total_capacity != 0) {
1089 sort_prop_detail =
GetString(STR_PURCHASE_SORT_DETAILS_CAPACITY, total_capacity);
1093 case STR_SORT_BY_RANGE:
1095 if (uint16_t range = e->
GetRange(); range != 0) {
1096 sort_prop_detail =
GetString(STR_PURCHASE_SORT_DETAILS_AIRCRAFT_RANGE, range);
1104 int sort_detail_width = 0;
1105 if (!sort_prop_detail.empty()) {
1115 std::string name =
GetString(str, engine_name);
1118 DrawString(tr.left + (rtl ? sort_detail_width : 0), tr.right - (rtl ? 0 : sort_detail_width), textr.top + normal_text_y_offset, name, tc);
1133 uint32_t hidden_mask = 0;
1156 for (
const auto &item : src) {
1157 if (item.variant_id != parent || item.engine_id == parent)
continue;
1160 EngineDisplayFlags flags = item.flags;
1168 dst.emplace_back(item.engine_id, item.engine_id, EngineDisplayFlags{}, indent + 1);
1174 if (indent > 0 || dst.empty())
return;
1177 uint16_t level_mask = 0;
1178 for (
auto it = std::rbegin(dst); std::next(it) != std::rend(dst); ++it) {
1179 auto next_it = std::next(it);
1180 SB(level_mask, it->indent, 1, it->indent <= next_it->indent);
1181 next_it->level_mask = level_mask;
1198 GUIEngineList eng_list{};
1211 BadgeFilterChoices badge_filter_choices{};
1213 void SetBuyVehicleText()
1248 widget->
SetToolTip(STR_BUY_VEHICLE_TRAIN_LIST_TOOLTIP + type);
1251 widget->
SetToolTip(STR_BUY_VEHICLE_TRAIN_HIDE_SHOW_TOGGLE_TOOLTIP + type);
1254 widget->
SetStringTip(STR_BUY_VEHICLE_TRAIN_RENAME_BUTTON + type, STR_BUY_VEHICLE_TRAIN_RENAME_TOOLTIP + type);
1257 widget->
SetStringTip(STR_SHOW_HIDDEN_ENGINES_VEHICLE_TRAIN + type, STR_SHOW_HIDDEN_ENGINES_VEHICLE_TRAIN_TOOLTIP + type);
1273 this->eng_list.ForceRebuild();
1274 this->GenerateBuildList();
1277 EngineID engine = EngineID::Invalid();
1279 if (it != this->eng_list.end()) engine = it->engine_id;
1280 this->SelectEngine(engine);
1286 switch (this->vehicle_type) {
1287 default: NOT_REACHED();
1289 if (this->listview_mode) {
1297 if (this->listview_mode) {
1315 switch (cargo_type) {
1336 CargoType cargo = this->cargo_filter_criteria;
1339 this->sel_engine = engine;
1340 this->SetBuyVehicleText();
1342 if (this->sel_engine == EngineID::Invalid())
return;
1346 if (!this->listview_mode) {
1349 if (ret.Succeeded()) {
1351 this->te.
capacity = refit_capacity;
1361 this->
te.FillDefaultCapacities(e);
1378 this->eng_list.
Filter(this->cargo_filter_criteria);
1379 if (0 == this->eng_list.size()) {
1380 this->SelectEngine(EngineID::Invalid());
1382 this->SelectEngine(this->eng_list[0].engine_id);
1405 if (this->string_filter.
IsEmpty())
return true;
1413 if (text) this->string_filter.AddLine(*text);
1415 return this->string_filter.
GetState();
1419 void GenerateBuildTrainList(GUIEngineList &list)
1422 EngineID sel_id = EngineID::Invalid();
1423 size_t num_engines = 0;
1445 if (!bdf.Filter(e->badges))
continue;
1448 if (!
FilterByText(e) && !btf.Filter(e->badges))
continue;
1464 for (
const auto &variant : variants) {
1468 if (e->VehInfo<RailVehicleInfo>().railveh_type !=
RAILVEH_WAGON) num_engines++;
1472 this->SelectEngine(sel_id);
1475 _last_engine[0] = _last_engine[1] = EngineID::Invalid();
1490 void GenerateBuildRoadVehList()
1492 EngineID sel_id = EngineID::Invalid();
1494 this->eng_list.clear();
1497 BadgeDropdownFilter bdf(this->badge_filter_choices);
1504 if (!bdf.Filter(e->badges))
continue;
1507 if (!
FilterByText(e) && !btf.Filter(e->badges))
continue;
1513 this->SelectEngine(sel_id);
1517 void GenerateBuildShipList()
1519 EngineID sel_id = EngineID::Invalid();
1520 this->eng_list.clear();
1523 BadgeDropdownFilter bdf(this->badge_filter_choices);
1529 if (!bdf.Filter(e->badges))
continue;
1532 if (!
FilterByText(e) && !btf.Filter(e->badges))
continue;
1538 this->SelectEngine(sel_id);
1542 void GenerateBuildAircraftList()
1544 EngineID sel_id = EngineID::Invalid();
1546 this->eng_list.clear();
1551 BadgeDropdownFilter bdf(this->badge_filter_choices);
1563 if (!bdf.Filter(e->badges))
continue;
1566 if (!
FilterByText(e) && !btf.Filter(e->badges))
continue;
1573 this->SelectEngine(sel_id);
1577 void GenerateBuildList()
1579 if (!this->eng_list.NeedRebuild())
return;
1584 this->eng_list.clear();
1589 default: NOT_REACHED();
1591 this->GenerateBuildTrainList(list);
1593 this->eng_list.RebuildDone();
1596 this->GenerateBuildRoadVehList();
1599 this->GenerateBuildShipList();
1602 this->GenerateBuildAircraftList();
1609 FlatSet<EngineID> variants;
1610 for (
const auto &item : this->eng_list) {
1617 for (
const auto &variant : variants) {
1627 this->eng_list.swap(list);
1629 this->eng_list.RebuildDone();
1650 list.push_back(MakeDropDownListIconItem(d, cs->GetCargoIcon(), PAL_NONE, cs->name, cs->Index()));
1658 static const auto separators = {STR_BADGE_CONFIG_PREVIEW, STR_BADGE_CONFIG_NAME};
1659 return BuildBadgeClassConfigurationList(this->badge_classes,
BADGE_COLUMNS, separators, COLOUR_GREY);
1665 if (sel_eng == EngineID::Invalid())
return;
1676 bool refresh =
false;
1678 while (
parent != EngineID::Invalid()) {
1695 this->descending_sort_order ^=
true;
1697 this->eng_list.ForceRebuild();
1702 this->show_hidden_engines ^=
true;
1704 this->eng_list.ForceRebuild();
1712 if (it != this->eng_list.end()) {
1713 const auto &item = *it;
1717 assert(item.
variant_id != EngineID::Invalid());
1727 this->SelectEngine(e);
1731 }
else if (click_count > 1 && !this->listview_mode) {
1742 ShowDropDownList(
this, this->BuildCargoDropDownList(), this->cargo_filter_criteria, widget);
1746 if (this->badge_classes.GetClasses().empty())
break;
1751 const Engine *e = (this->sel_engine == EngineID::Invalid()) ?
nullptr :
Engine::Get(this->sel_engine);
1759 this->BuildVehicle();
1763 EngineID sel_eng = this->sel_engine;
1764 if (sel_eng != EngineID::Invalid()) {
1765 this->rename_engine = sel_eng;
1772 if (
IsInsideMM(widget, this->badge_filters.first, this->badge_filters.second)) {
1785 void OnInvalidateData([[maybe_unused]]
int data = 0, [[maybe_unused]]
bool gui_scope =
true)
override
1787 if (!gui_scope)
return;
1789 if (this->vehicle_type ==
VEH_ROAD &&
1790 _settings_game.vehicle.roadveh_acceleration_model == AM_ORIGINAL &&
1791 this->sort_criteria > 7) {
1792 this->sort_criteria = 0;
1795 this->eng_list.ForceRebuild();
1802 if (this->vehicle_type ==
VEH_TRAIN && !this->listview_mode) {
1806 if (this->vehicle_type ==
VEH_ROAD && !this->listview_mode) {
1810 return GetString((this->listview_mode ? STR_VEHICLE_LIST_AVAILABLE_TRAINS : STR_BUY_VEHICLE_TRAIN_ALL_CAPTION) + this->vehicle_type);
1816 return GetString(this->GetCargoFilterLabel(this->cargo_filter_criteria));
1819 const Engine *e = (this->sel_engine == EngineID::Invalid()) ?
nullptr :
Engine::Get(this->sel_engine);
1821 return GetString(STR_BUY_VEHICLE_TRAIN_SHOW_TOGGLE_BUTTON + this->vehicle_type);
1823 return GetString(STR_BUY_VEHICLE_TRAIN_HIDE_TOGGLE_BUTTON + this->vehicle_type);
1827 if (
IsInsideMM(widget, this->badge_filters.first, this->badge_filters.second)) {
1840 size.height = 3 *
resize.height;
1851 d.height += padding.height;
1862 if (this->badge_classes.GetClasses().empty()) size = {0, 0};
1868 size.width += padding.width;
1869 size.height += padding.height;
1875 size.width += padding.width;
1876 size.height += padding.height;
1893 this->badge_classes,
1906 this->GenerateBuildList();
1907 this->vscroll->
SetCount(this->eng_list.size());
1917 int needed_height = this->details_height;
1919 if (this->sel_engine != EngineID::Invalid()) {
1924 if (needed_height != this->details_height) {
1925 int resize = needed_height - this->details_height;
1926 this->details_height = needed_height;
1935 if (!str.has_value())
return;
1937 Command<Commands::RenameEngine>::Post(STR_ERROR_CAN_T_RENAME_TRAIN_TYPE + this->vehicle_type, this->rename_engine, *str);
1944 if (this->sort_criteria != index) {
1945 this->sort_criteria = index;
1947 this->eng_list.ForceRebuild();
1952 if (this->cargo_filter_criteria != index) {
1953 this->cargo_filter_criteria = index;
1957 this->eng_list.ForceRebuild();
1958 this->SelectEngine(this->sel_engine);
1968 ReplaceDropDownList(
this, this->BuildBadgeConfigurationList(), -1);
1974 this->eng_list.ForceRebuild();
1979 if (
IsInsideMM(widget, this->badge_filters.first, this->badge_filters.second)) {
1985 this->eng_list.ForceRebuild();
2005 static inline HotkeyList hotkeys{
"buildvehicle", {
2011 WDP_AUTO,
"build_vehicle", 240, 268,
2014 _nested_build_vehicle_widgets,
2015 &BuildVehicleWindow::hotkeys
2024 uint num = (tile ==
INVALID_TILE) ? (
int)type : tile.base();
CargoTypes GetUnionOfArticulatedRefitMasks(EngineID engine, bool include_initial_cargo_type)
Ors the refit_masks of all articulated parts.
CargoArray GetCapacityOfArticulatedParts(EngineID engine)
Get the capacity of the parts of a given engine.
bool IsArticulatedVehicleRefittable(EngineID engine)
Checks whether any of the articulated parts is refittable.
Functions related to articulated vehicles.
Functions related to autoreplacing.
bool EngineHasReplacementForCompany(const Company *c, EngineID engine, GroupID group)
Check if a company has a replacement set up for the given engine.
static bool EngineNumberSorter(const GUIEngineListItem &a, const GUIEngineListItem &b)
Compare the (NewGRF) list position.
constexpr T SB(T &x, const uint8_t s, const uint8_t n, const U d)
Set n bits in x starting at bit s to d.
constexpr T SetBit(T &x, const uint8_t y)
Set a bit in a variable.
constexpr bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
static bool EngineIntroDateSorter(const GUIEngineListItem &a, const GUIEngineListItem &b)
Determines order of engines by introduction date.
static bool EngineCostSorter(const GUIEngineListItem &a, const GUIEngineListItem &b)
Determines order of engines by purchase cost.
static CargoType _engine_sort_last_cargo_criteria[]
Last set filter criteria, for each vehicle type.
void GUIEngineListAddChildren(GUIEngineList &dst, const GUIEngineList &src, EngineID parent, uint8_t indent)
Add children to GUI engine list to build a hierarchical tree.
static bool TrainEnginesThenWagonsSorter(const GUIEngineListItem &a, const GUIEngineListItem &b)
Determines order of train engines by engine / wagon.
static bool CargoAndEngineFilter(const GUIEngineListItem *item, const CargoType cargo_type)
Filters vehicles by cargo and engine (in case of rail vehicle).
static std::optional< std::string > GetNewGRFAdditionalText(EngineID engine)
Try to get the NewGRF engine additional text callback as an optional std::string.
static bool AircraftEngineCargoSorter(const GUIEngineListItem &a, const GUIEngineListItem &b)
Determines order of aircraft by cargo.
bool _engine_sort_last_order[]
Last set direction of the sort order, for each vehicle type.
void DrawEngineList(VehicleType type, const Rect &r, const GUIEngineList &eng_list, const Scrollbar &sb, EngineID selected_id, bool show_count, GroupID selected_group, const GUIBadgeClasses &badge_classes, uint8_t sort_criteria)
Engine drawing loop.
static bool EngineNumberSorter(const GUIEngineListItem &a, const GUIEngineListItem &b)
Determines order of engines by engineID.
uint GetEngineListHeight(VehicleType type)
Get the height of a single 'entry' in the engine lists.
static bool TrainEngineCapacitySorter(const GUIEngineListItem &a, const GUIEngineListItem &b)
Determines order of train engines by capacity.
static int DrawAircraftPurchaseInfo(int left, int right, int y, EngineID engine_number, bool refittable, TestedEngineDetails &te)
Draw aircraft specific details in the buy window.
static bool EnginePowerVsRunningCostSorter(const GUIEngineListItem &a, const GUIEngineListItem &b)
Determines order of engines by running costs.
static bool EngineReliabilitySorter(const GUIEngineListItem &a, const GUIEngineListItem &b)
Determines order of engines by reliability.
const std::initializer_list< const StringID > _engine_sort_listing[]
Dropdown menu strings for the vehicle sort criteria.
uint8_t _engine_sort_last_criteria[]
Last set sort criteria, for each vehicle type.
static bool ShipEngineCapacitySorter(const GUIEngineListItem &a, const GUIEngineListItem &b)
Determines order of ships by capacity.
int DrawVehiclePurchaseInfo(int left, int right, int y, EngineID engine_number, TestedEngineDetails &te)
Draw the purchase info details of a vehicle at a given location.
static bool EngineTractiveEffortSorter(const GUIEngineListItem &a, const GUIEngineListItem &b)
Determines order of engines by tractive effort.
EngList_SortTypeFunction *const _engine_sort_functions[][11]
Sort functions for the vehicle sort criteria, for each vehicle type.
void DisplayVehicleSortDropDown(Window *w, VehicleType vehicle_type, int selected, WidgetID button)
Display the dropdown for the vehicle sort criteria.
static uint ShowAdditionalText(int left, int right, int y, EngineID engine)
Display additional text from NewGRF in the purchase information window.
static bool EngineSpeedSorter(const GUIEngineListItem &a, const GUIEngineListItem &b)
Determines order of engines by speed.
bool _engine_sort_direction
false = descending, true = ascending.
static bool EngineNameSorter(const GUIEngineListItem &a, const GUIEngineListItem &b)
Determines order of engines by name.
static bool EnginePowerSorter(const GUIEngineListItem &a, const GUIEngineListItem &b)
Determines order of engines by power.
static bool EngineRunningCostSorter(const GUIEngineListItem &a, const GUIEngineListItem &b)
Determines order of engines by running costs.
static bool AircraftRangeSorter(const GUIEngineListItem &a, const GUIEngineListItem &b)
Determines order of aircraft by range.
static bool RoadVehEngineCapacitySorter(const GUIEngineListItem &a, const GUIEngineListItem &b)
Determines order of road vehicles by capacity.
bool _engine_sort_show_hidden_engines[]
Last set 'show hidden engines' setting for each vehicle type.
uint8_t CargoType
Cargo slots to indicate a cargo type within a game.
bool IsValidCargoType(CargoType cargo)
Test whether cargo type is not INVALID_CARGO.
static const CargoType NUM_CARGO
Maximum number of cargo types in a game.
Dimension GetLargestCargoIconSize()
Get dimensions of largest cargo icon.
std::span< const CargoSpec * > _sorted_standard_cargo_specs
Standard cargo specifications sorted alphabetically by name.
CargoTypes _standard_cargo_mask
Bitmask of real cargo types available.
std::vector< const CargoSpec * > _sorted_cargo_specs
Cargo specifications sorted alphabetically by name.
Types/functions related to cargoes.
constexpr bool Test(Tvalue_type value) const
Test if the value-th bit is set.
constexpr Timpl & Reset()
Reset all bits.
constexpr Timpl & Flip(Tvalue_type value)
Flip the value-th bit.
StringID GetAircraftTypeText() const
Get the name of the aircraft type for display purposes.
uint GetPower() const
Returns the power of the engine for display and sorting purposes.
uint16_t GetRange() const
Get the range of an aircraft type.
uint32_t GetGRFID() const
Retrieve the GRF ID of the NewGRF the engine is tied to.
Money GetCost() const
Return how much a new engine costs.
TimerGameCalendar::Date intro_date
Date of introduction of the engine.
static Pool::IterateWrapperFiltered< Engine, EngineTypeFilter > IterateType(VehicleType vt, size_t from=0)
Returns an iterable ensemble of all valid engines of the given type.
uint GetDisplayMaxSpeed() const
Returns max speed of the engine for display purposes.
EngineDisplayFlags display_flags
NOSAVE client-side-only display flags for build engine list.
uint GetDisplayWeight() const
Returns the weight of the engine for display purposes.
VehicleType type
Vehicle type, ie VEH_ROAD, VEH_TRAIN, etc.
bool IsVariantHidden(CompanyID c) const
Check whether the engine variant chain is hidden in the GUI for the given company.
TimerGameCalendar::Date GetLifeLengthInDays() const
Returns the vehicle's (not model's!) life length in days.
uint GetDisplayDefaultCapacity(uint16_t *mail_capacity=nullptr) const
Determines the default cargo capacity of an engine for display purposes.
CargoType GetDefaultCargoType() const
Determines the default cargo type of an engine.
CompanyMask company_hidden
Bit for each company whether the engine is normally hidden in the build gui for that company.
Money GetRunningCost() const
Return how much the running costs of this engine are.
uint16_t reliability
Current reliability of the engine.
uint GetDisplayMaxTractiveEffort() const
Returns the tractive effort of the engine for display purposes.
bool IsHidden(CompanyID c) const
Check whether the engine is hidden in the GUI for the given company.
EngineID display_last_variant
NOSAVE client-side-only last variant selected.
Flat set implementation that uses a sorted vector for storage.
std::pair< const_iterator, bool > insert(const Tkey &key)
Insert a key into the set, if it does not already exist.
bool Filter(FilterFunction *decide, F filter_data)
Filter the list.
void SetFilterState(bool state)
Enable or disable the filter.
void SetFilterFuncs(std::span< FilterFunction *const > n_funcs)
Hand the filter function pointers to the GUIList.
bool(const GUIEngineListItem *a, CargoType filter) FilterFunction
This struct contains all the info that is needed to draw and construct tracks.
struct RailTypeInfo::@157247141350136173143103254227157213063052244122 strings
Strings associated with the rail type.
VehicleAccelerationModel acceleration_type
Acceleration type of this rail type.
StringID name
Name of this rail type.
StringID build_caption
Caption of the build vehicle GUI for this rail type.
struct RoadTypeInfo::@070000167274302256150317022075324310363002361255 strings
Strings associated with the rail type.
StringID build_caption
Caption of the build vehicle GUI for this rail type.
static YearMonthDay ConvertDateToYMD(Date date)
Converts a Date to a Year, Month & Day.
static bool UsingWallclockUnits(bool newgame=false)
Check if we are using wallclock units.
static constexpr Year DateToYear(Date date)
Functions related to commands.
@ QueryCost
query cost only, don't build.
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
CompanyID _current_company
Company currently doing an action.
Functions related to companies.
VehicleCellSize GetVehicleImageCellSize(VehicleType type, EngineImageType image_type)
Get the GUI cell size for a vehicle image.
void ShowDropDownMenu(Window *w, std::span< const StringID > strings, int selected, WidgetID button, uint32_t disabled_mask, uint32_t hidden_mask, uint width)
Show a dropdown menu window near a widget of the parent window.
Dimension GetDropDownListDimension(const DropDownList &list)
Determine width and height required to fully display a DropDownList.
void ShowDropDownList(Window *w, DropDownList &&list, int selected, WidgetID button, uint width, DropDownOptions options)
Show a drop down list.
Functions related to the drop down widget.
Types related to the drop down widget.
std::vector< std::unique_ptr< const DropDownListItem > > DropDownList
A drop down list is a collection of drop down list items.
@ Persist
Set if this dropdown should stay open after an option is selected.
@ Invalid
Invalid base price.
bool IsEngineBuildable(EngineID engine, VehicleType type, CompanyID company)
Check if an engine is buildable.
@ HasVariants
Set if engine has variants.
@ IsFolded
Set if display of variants should be folded (hidden).
@ Shaded
Set if engine should be masked.
Command definitions related to engines.
Functions related to engines.
uint GetTotalCapacityOfArticulatedParts(EngineID engine)
Get the capacity of an engine with articulated parts.
void EngList_Sort(GUIEngineList &el, EngList_SortTypeFunction compare)
Sort all items using quick sort and given 'CompareItems' function.
void EngList_SortPartial(GUIEngineList &el, EngList_SortTypeFunction compare, size_t begin, size_t num_items)
Sort selected range of items (on indices @ <begin, begin+num_items-1>).
void DrawVehicleEngine(int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal, EngineImageType image_type)
Draw an engine.
Engine GUI functions, used by build_vehicle_gui and autoreplace_gui.
bool EngList_SortTypeFunction(const GUIEngineListItem &, const GUIEngineListItem &)
argument type for EngList_Sort.
static const uint MAX_LENGTH_ENGINE_NAME_CHARS
The maximum length of an engine name in characters including '\0'.
PoolID< uint16_t, struct EngineIDTag, 64000, 0xFFFF > EngineID
Unique identification number of an engine.
uint64_t PackEngineNameDParam(EngineID engine_id, EngineNameContext context, uint32_t extra_data=0)
Combine an engine ID and a name context to an engine name StringParameter.
@ PurchaseList
Name is shown in the purchase list (including autoreplace window 'Available vehicles' panel).
@ Generic
No specific context available.
@ AutoreplaceVehicleInUse
Name is show in the autoreplace window 'Vehicles in use' panel.
@ Maglev
Maglev acceleration model.
@ RAILVEH_WAGON
simple wagon, not motorized
@ RAILVEH_MULTIHEAD
indicates a combination of two locomotives
int GetCharacterHeight(FontSize size)
Get height of a character for a given font size.
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
int CentreBounds(int min, int max, int size)
Determine where to position a centred object.
Dimension GetSpriteSize(SpriteID sprid, Point *offset, ZoomLevel zoom)
Get the size of a sprite.
Dimension GetStringBoundingBox(std::string_view str, FontSize start_fontsize)
Return the string dimension in pixels.
int DrawString(int left, int right, int top, std::string_view str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly truncated to make it fit in its allocated space.
bool _ctrl_pressed
Is Ctrl pressed?
int DrawStringMultiLine(int left, int right, int top, int bottom, std::string_view str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly over multiple lines.
Dimension GetScaledSpriteSize(SpriteID sprid)
Scale sprite size for GUI.
@ FS_SMALL
Index of the small font in the font tables.
@ FS_NORMAL
Index of the normal font in the font tables.
@ SA_RIGHT
Right align the text (must be a single bit).
@ SA_FORCE
Force the alignment, i.e. don't swap for RTL languages.
@ SA_CENTER
Center both horizontally and vertically.
uint32_t PaletteID
The number of the palette.
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
@ TC_FORCED
Ignore colour changes from strings.
@ TC_NO_SHADE
Do not add shading to this text colour.
Base class for groups and group functions.
uint GetGroupNumEngines(CompanyID company, GroupID id_g, EngineID id_e)
Get the number of engines with EngineID id_e in the group with GroupID id_g and its sub-groups.
void SetDirty() const
Mark entire window as dirty (in need of re-paint).
static constexpr GroupID DEFAULT_GROUP
Ungrouped vehicles are in this group.
Hotkey related functions.
#define Rect
Macro that prevents name conflicts between included headers.
#define Point
Macro that prevents name conflicts between included headers.
constexpr bool IsInsideMM(const size_t x, const size_t min, const size_t max) noexcept
Checks if a value is in an interval.
constexpr uint ToPercent16(uint i)
Converts a "fract" value 0..65535 to "percent" value 0..100.
constexpr To ClampTo(From value)
Clamp the given value down to lie within the requested type.
void ShowQueryString(std::string_view str, StringID caption, uint maxsize, Window *parent, CharSetFilter afilter, QueryStringFlags flags)
Show a query popup window with a textbox in it.
static constexpr CargoType CF_NONE
Show only items which do not carry cargo (e.g. train engines).
static constexpr CargoType CF_ENGINES
Show only engines (for rail vehicles only).
static constexpr CargoType CF_ANY
Show all items independent of carried cargo (i.e. no filtering).
bool _networking
are we in networking mode?
bool _network_server
network-server is active
Basic functions/variables used all over the place.
@ INVALID_CLIENT_ID
Client is not part of anything.
Functions related to NewGRF badges.
Functions related to NewGRF badge configuration.
int DrawBadgeNameList(Rect r, std::span< const BadgeID > badges, GrfSpecFeature)
Draw names for a list of badge labels.
void DrawBadgeColumn(Rect r, int column_group, const GUIBadgeClasses &gui_classes, std::span< const BadgeID > badges, GrfSpecFeature feature, std::optional< TimerGameCalendar::Date > introduction_date, PaletteID remap)
Draw a badge column group.
std::pair< WidgetID, WidgetID > AddBadgeDropdownFilters(Window *window, WidgetID container_id, WidgetID widget, Colours colour, GrfSpecFeature feature)
Add badge drop down filter widgets.
bool HandleBadgeConfigurationDropDownClick(GrfSpecFeature feature, uint columns, int result, int click_result, BadgeFilterChoices &choices)
Handle the badge configuration drop down selection.
void SetBadgeFilter(BadgeFilterChoices &choices, BadgeID badge_index)
Set badge filter choice for a class.
void ResetBadgeFilter(BadgeFilterChoices &choices, BadgeClassID badge_class_index)
Reset badge filter choice for a class.
GUI functions related to NewGRF badges.
@ CBID_VEHICLE_ADDITIONAL_TEXT
This callback is called from vehicle purchase lists.
static const uint CALLBACK_FAILED
Different values for Callback result evaluations.
void ErrorUnknownCallbackResult(uint32_t grfid, uint16_t cbid, uint16_t cb_res)
Record that a NewGRF returned an unknown/invalid callback result.
GRFConfig * GetGRFConfig(uint32_t grfid, uint32_t mask)
Retrieve a NewGRF from the current config by its grfid.
uint16_t GetVehicleCallback(CallbackID callback, uint32_t param1, uint32_t param2, EngineID engine, const Vehicle *v, std::span< int32_t > regs100)
Evaluate a newgrf callback for vehicles.
Functions for NewGRF engines.
std::string GetGRFStringWithTextStack(const struct GRFFile *grffile, GRFStringID grfstringid, std::span< const int32_t > textstack)
Format a GRF string using the text ref stack for parameters.
Header of Action 04 "universal holder" structure and functions.
StrongType::Typedef< uint32_t, struct GRFStringIDTag, StrongType::Compare, StrongType::Integer > GRFStringID
Type for GRF-internal string IDs.
static constexpr GRFStringID GRFSTR_MISC_GRF_TEXT
Miscellaneous GRF text range.
PixelColour GetColourGradient(Colours colour, ColourShade shade)
Get colour gradient palette index.
Base for the GUIs that have an edit box in them.
std::vector< RailType > _sorted_railtypes
Sorted list of rail types.
bool HasPowerOnRail(RailType enginetype, RailType tiletype)
Checks if an engine of the given RailType got power on a tile with a given RailType.
const RailTypeInfo * GetRailTypeInfo(RailType railtype)
Returns a pointer to the Railtype information for a given railtype.
RailType GetRailType(Tile t)
Gets the rail type of the given tile.
RailType
Enumeration for all possible railtypes.
@ INVALID_RAILTYPE
Flag for invalid railtype.
bool HasPowerOnRoad(RoadType enginetype, RoadType tiletype)
Checks if an engine of the given RoadType got power on a tile with a given RoadType.
const RoadTypeInfo * GetRoadTypeInfo(RoadType roadtype)
Returns a pointer to the Roadtype information for a given roadtype.
RoadType GetRoadTypeRoad(Tile t)
Get the road type for RoadTramType being RTT_ROAD.
RoadType GetRoadTypeTram(Tile t)
Get the road type for RoadTramType being RTT_TRAM.
RoadType
The different roadtypes we support.
@ INVALID_ROADTYPE
flag for invalid roadtype
A number of safeguards to prevent using unsafe methods.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
ClientSettings _settings_client
The current settings for this game.
static const PaletteID PALETTE_CRASH
Recolour sprite greying of crashed vehicles.
Base classes/functions for stations.
Definition of base types and functions in a cross-platform compatible way.
int StrNaturalCompare(std::string_view s1, std::string_view s2, bool ignore_garbage_at_front)
Compares two strings using case insensitive natural sort.
Functions related to low-level strings.
@ CS_ALPHANUMERAL
Both numeric and alphabetic and spaces and stuff.
Searching and filtering using a stringterm.
std::string_view GetListSeparator()
Get the list separator string for the current language.
void AppendStringInPlace(std::string &result, StringID string)
Resolve the given StringID and append in place into an existing std::string with formatting but no pa...
std::string GetString(StringID string)
Resolve the given StringID into a std::string with formatting but no parameters.
TextDirection _current_text_dir
Text direction of the currently selected language.
Functions related to OTTD's strings.
int64_t PackVelocity(uint speed, VehicleType type)
Pack velocity and vehicle type for use with SCC_VELOCITY string parameter.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
@ TD_RTL
Text is written right-to-left by default.
static const int MAX_CHAR_LENGTH
Max. length of UTF-8 encoded unicode character.
static BaseStation * GetByTile(TileIndex tile)
Get the base station belonging to a specific tile.
GUI for building vehicles.
VehicleType vehicle_type
Type of vehicles shown in the window.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
static constexpr int BADGE_COLUMNS
Number of columns available for badges (0 = left of image, 1 = between image and name,...
bool FilterByText(const Engine *e)
Filter by name and NewGRF extra text.
void UpdateFilterByTile()
Set the filter type according to the depot type.
bool descending_sort_order
Sort direction,.
bool listview_mode
If set, only display the available vehicles and do not show a 'build' button.
void OnDropdownSelect(WidgetID widget, int index, int click_result) override
A dropdown option associated to this window has been selected.
CargoType cargo_filter_criteria
Selected cargo filter.
void SetCargoFilterArray()
Populate the filter list and set the cargo filter criteria.
RailType railtype
Rail type to show, or INVALID_RAILTYPE.
union BuildVehicleWindow::@015063063316140361220303015310112114302264111156 filter
Filter to apply.
void OnPaint() override
The window must be repainted.
int details_height
Minimal needed height of the details panels, in text lines (found so far).
QueryString vehicle_editbox
Filter editbox.
void OnResize() override
Called after the window got resized.
bool show_hidden_engines
State of the 'show hidden engines' button.
void FilterEngineList()
Filter the engine list against the currently selected cargo filter.
EngineID rename_engine
Engine being renamed.
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
TestedEngineDetails te
Tested cost and capacity after refit.
std::pair< WidgetID, WidgetID > badge_filters
First and last widgets IDs of badge filters.
std::string GetWidgetString(WidgetID widget, StringID stringid) const override
Get the raw string for a widget.
void OnEditboxChanged(WidgetID wid) override
The text in an editbox has been edited.
StringFilter string_filter
Filter for vehicle name.
uint8_t sort_criteria
Current sort criterium.
void UpdateWidgetSize(WidgetID widget, Dimension &size, const Dimension &padding, Dimension &fill, Dimension &resize) override
Update size and resize step of a widget in the window.
bool FilterSingleEngine(EngineID eid)
Filter a single engine.
EngineID sel_engine
Currently selected engine, or EngineID::Invalid().
RoadType roadtype
Road type to show, or INVALID_ROADTYPE.
void OnInit() override
Notification that the nested widget tree gets initialized.
void OnQueryTextFinished(std::optional< std::string > str) override
The query window opened from this window has closed.
Class for storing amounts of cargo.
Specification of a cargo type.
static CargoSpec * Get(size_t index)
Retrieve cargo details for the given cargo type.
StringID name
Name of this type of cargo.
Dimensions (a width and height) of a rectangle in 2D.
EngineID variant_id
Engine variant ID. If set, will be treated specially in purchase lists.
TimerGameCalendar::Date base_intro
Basic date of engine introduction (without random parts).
Information about GRF, used in the game and (part of it) in savegames.
std::string GetName() const
Get the name of this grf.
Dynamic data of a loaded NewGRF.
EngineDisplayFlags flags
Flags for toggling/drawing (un)folded status and controlling indentation.
EngineID variant_id
Variant group of the engine.
EngineID engine_id
Engine to display in build purchase list.
uint8_t indent
Display indentation level.
List of hotkeys for a window.
All data for a single hotkey.
Colour for pixel/line drawing.
static Engine * Get(auto index)
Data stored about a string that can be modified in the GUI.
static const int ACTION_CLEAR
Clear editbox.
Information about a rail vehicle.
RailTypes railtypes
Railtypes, mangled if elrail is disabled.
uint16_t pow_wag_power
Extra power applied to consist if wagon should be powered.
uint8_t pow_wag_weight
Extra weight applied to consist if wagon should be powered.
Specification of a rectangle with absolute coordinates of all edges.
Rect WithWidth(int width, bool end) const
Copy Rect and set its width.
Rect Shrink(int s) const
Copy and shrink Rect by s pixels.
Rect WithHeight(int height, bool end=false) const
Copy Rect and set its height.
Rect Indent(int indent, bool end) const
Copy Rect and indent it from its position.
int Height() const
Get height of Rect.
Rect WithY(int new_top, int new_bottom) const
Create a new Rect, replacing the top and bottom coordiates.
Rect Translate(int x, int y) const
Copy and translate Rect by x,y pixels.
Information about a ship vehicle.
bool IsEmpty() const
Check whether any filter words were entered.
void SetFilterTerm(std::string_view str)
Set the term to filter on.
void ResetState()
Reset the matching state to process a new item.
bool GetState() const
Get the matching state of the current item.
Extra information about refitted cargo and capacity.
CargoType cargo
Cargo type.
CargoArray all_capacities
Capacities for all cargoes.
uint16_t mail_capacity
Mail capacity if available.
uint capacity
Cargo capacity.
std::string_view GetText() const
Get the current text.
uint extend_left
Extend of the cell to the left.
uint extend_right
Extend of the cell to the right.
High level window description.
Data structure for an opened window.
void ReInit(int rx=0, int ry=0, bool reposition=false)
Re-initialize a window, and optionally change its size.
static int SortButtonWidth()
Get width of up/down arrow of sort button state.
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
std::map< WidgetID, QueryString * > querystrings
QueryString associated to WWT_EDITBOX widgets.
void DrawWidgets() const
Paint all widgets of a window.
void InvalidateData(int data=0, bool gui_scope=true)
Mark this window's data as invalid (in need of re-computing).
Window * parent
Parent window.
virtual std::string GetWidgetString(WidgetID widget, StringID stringid) const
Get the raw string for a widget.
void DrawSortButtonState(WidgetID widget, SortButtonState state) const
Draw a sort button's up or down arrow symbol.
void CloseChildWindows(WindowClass wc=WC_INVALID) const
Close all children a window might have in a head-recursive manner.
ResizeInfo resize
Resize information.
void SetWidgetsDisabledState(bool disab_stat, Args... widgets)
Sets the enabled/disabled status of a list of widgets.
void CreateNestedTree()
Perform the first part of the initialization of a nested widget tree.
Owner owner
The owner of the content shown in this window. Company colour is acquired from this variable.
void SetWidgetLoweredState(WidgetID widget_index, bool lowered_stat)
Sets the lowered/raised status of a widget.
bool IsShaded() const
Is window shaded currently?
WidgetLookup widget_lookup
Indexed access to the nested widget tree. Do not access directly, use Window::GetWidget() instead.
Window(WindowDesc &desc)
Empty constructor, initialization has been moved to InitNested() called from the constructor of the d...
const NWID * GetWidget(WidgetID widnum) const
Get the nested widget with number widnum from the nested widget tree.
const Scrollbar * GetScrollbar(WidgetID widnum) const
Return the Scrollbar to a widget index.
void SetWidgetDisabledState(WidgetID widget_index, bool disab_stat)
Sets the enabled/disabled status of a widget.
std::unique_ptr< NWidgetBase > nested_root
Root of the nested tree.
int width
width of the window (number of pixels to the right in x direction)
WindowNumber window_number
Window number within the window class.
Stuff related to the text buffer GUI.
@ EnableDefault
enable the 'Default' button ("\0" is returned)
@ LengthIsInChars
the length of the string is counted in characters
Owner GetTileOwner(Tile tile)
Returns the owner of a tile.
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > > TileIndex
The index/ID of a Tile.
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
Definition of the game-calendar-timer.
Command definitions related to trains.
void CcBuildWagon(Commands, const CommandCost &result, VehicleID new_veh_id, uint, uint16_t, CargoArray, TileIndex tile, EngineID, bool, CargoType, ClientID)
Callback for building wagons.
PaletteID GetEnginePalette(EngineID engine_type, CompanyID company)
Get the colour map for an engine.
bool CanVehicleUseStation(EngineID engine_type, const Station *st)
Can this station be used by the given engine type?
Command definitions for vehicles.
void CcBuildPrimaryVehicle(Commands, const CommandCost &result, VehicleID new_veh_id, uint, uint16_t, CargoArray)
This is the Callback method after the construction attempt of a primary vehicle.
Functions related to vehicles.
bool IsCompanyBuildableVehicleType(VehicleType type)
Is the given vehicle type buildable by a company?
uint ShowRefitOptionsList(int left, int right, int y, EngineID engine)
Display list of cargo types of the engine, for the purchase information window.
Functions related to the vehicle's GUIs.
@ EIT_PURCHASE
Vehicle drawn in purchase list, autoreplace gui, ...
VehicleType
Available vehicle types.
@ VEH_INVALID
Non-existing type of vehicle.
@ VEH_ROAD
Road vehicle type.
@ VEH_AIRCRAFT
Aircraft vehicle type.
@ VEH_SHIP
Ship vehicle type.
@ VEH_TRAIN
Train vehicle type.
static const uint MAX_LENGTH_VEHICLE_NAME_CHARS
The maximum length of a vehicle name in characters including '\0'.
void CloseWindowById(WindowClass cls, WindowNumber number, bool force, int data)
Close a window by its class and window number (if it is open).
void InvalidateWindowData(WindowClass cls, WindowNumber number, int data, bool gui_scope)
Mark window data of the window of a given class and specific window number as invalid (in need of re-...
void InvalidateWindowClassesData(WindowClass cls, int data, bool gui_scope)
Mark window data of all windows of a given class as invalid (in need of re-computing) Note that by de...
Window functions not directly related to making/drawing windows.
@ Construction
This window is used for construction; close it whenever changing company.
@ SBS_DOWN
Sort ascending.
@ WDP_AUTO
Find a place automatically.
@ WC_REPLACE_VEHICLE
Replace vehicle window; Window numbers:
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
@ WC_DROPDOWN_MENU
Drop down menu; Window numbers:
@ WC_BUILD_VEHICLE
Build vehicle; Window numbers:
@ Station
station encountered (could be a target next time)
Functions related to zooming.
int ScaleSpriteTrad(int value)
Scale traditional pixel dimensions to GUI zoom level, for drawing sprites.