53#include "table/strings.h"
61static constexpr NWidgetPart _nested_town_authority_widgets[] = {
74 NWidget(
WWT_PUSHTXTBTN, COLOUR_BROWN,
WID_TA_EXECUTE),
SetMinimalSize(317, 12),
SetResize(1, 0),
SetFill(1, 0),
SetStringTip(STR_LOCAL_AUTHORITY_DO_IT_BUTTON, STR_LOCAL_AUTHORITY_DO_IT_TOOLTIP),
117 this->action_tooltips[0] = STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_SMALL_ADVERTISING;
118 this->action_tooltips[1] = STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_MEDIUM_ADVERTISING;
119 this->action_tooltips[2] = STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_LARGE_ADVERTISING;
120 this->action_tooltips[3] = realtime ? STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_ROAD_RECONSTRUCTION_MINUTES : STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_ROAD_RECONSTRUCTION_MONTHS;
121 this->action_tooltips[4] = STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_STATUE_OF_COMPANY;
122 this->action_tooltips[5] = STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_NEW_BUILDINGS;
123 this->action_tooltips[6] = realtime ? STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_EXCLUSIVE_TRANSPORT_MINUTES : STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_EXCLUSIVE_TRANSPORT_MONTHS;
124 this->action_tooltips[7] = STR_LOCAL_AUTHORITY_ACTION_TOOLTIP_BRIBE;
152 StringID GetRatingString(
int rating)
const
154 if (rating > RATING_EXCELLENT)
return STR_CARGO_RATING_OUTSTANDING;
155 if (rating > RATING_VERYGOOD)
return STR_CARGO_RATING_EXCELLENT;
156 if (rating > RATING_GOOD)
return STR_CARGO_RATING_VERY_GOOD;
157 if (rating > RATING_MEDIOCRE)
return STR_CARGO_RATING_GOOD;
158 if (rating > RATING_POOR)
return STR_CARGO_RATING_MEDIOCRE;
159 if (rating > RATING_VERYPOOR)
return STR_CARGO_RATING_POOR;
160 if (rating > RATING_APPALLING)
return STR_CARGO_RATING_VERY_POOR;
161 return STR_CARGO_RATING_APPALLING;
173 DrawString(r.left, r.right, r.top + text_y_offset, STR_LOCAL_AUTHORITY_COMPANY_RATINGS);
183 if ((this->town->
have_ratings.
Test(c->index) || this->town->exclusivity == c->index)) {
190 int rating = this->town->
ratings[c->index];
191 DrawString(text.left, text.right, text.top + text_y_offset,
GetString(STR_LOCAL_AUTHORITY_COMPANY_RATING, c->index, c->index, GetRatingString(rating)));
196 text.bottom = text.top - 1;
197 if (text.bottom > r.bottom) {
208 DrawString(r, STR_LOCAL_AUTHORITY_ACTIONS_TITLE);
212 for (
TownAction i = {}; i != TownAction::End; ++i) {
219 if (this->sel_action == i) action_colour = TC_WHITE;
237 if (this->sel_action != TownAction::End) {
243 affordable ? TC_YELLOW : TC_RED);
253 assert(size.width > padding.width && size.height > padding.height);
255 for (
TownAction i = {}; i != TownAction::End; ++i) {
259 d.width += padding.width;
260 d.height += padding.height;
268 for (
TownAction i = {}; i != TownAction::End; ++i) {
271 size.width += padding.width;
276 size.height = 9 *
resize.height + padding.height;
285 bool new_show_state = !this->town->
show_zone;
288 new_show_state ? _town_local_authority_kdtree.
Insert(index) : _town_local_authority_kdtree.
Remove(index);
301 if (!action.has_value())
break;
303 this->sel_action = *action;
322 void OnInvalidateData([[maybe_unused]]
int data = 0, [[maybe_unused]]
bool gui_scope =
true)
override
324 if (!gui_scope)
return;
328 this->sel_action = TownAction::End;
334 WDP_AUTO,
"view_town_authority", 317, 222,
337 _nested_town_authority_widgets
340static void ShowTownAuthorityWindow(uint town)
342 AllocateWindowDescFront<TownAuthorityWindow>(_town_authority_desc, town);
352 static const int WID_TV_HEIGHT_NORMAL = 150;
370 void Close([[maybe_unused]]
int data = 0)
override
405 auto it = this->town->GetCargoSupplied(cargo_type);
406 if (it == std::end(this->town->
supplied)) {
409 DrawString(tr,
GetString(str_last_period, 1ULL << cargo_type, it->history[LAST_MONTH].transported, it->history[LAST_MONTH].production));
416 for (
int i = TAE_BEGIN; i <
TAE_END; i++) {
417 if (this->town->
goal[i] == 0)
continue;
422 DrawString(tr, STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH);
430 assert(cargo !=
nullptr);
436 string = STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH_DELIVERED_GENERAL;
437 if (this->town->
received[i].old_act == 0) {
438 string = STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH_REQUIRED_GENERAL;
441 string = STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH_REQUIRED_WINTER;
447 string = STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH_DELIVERED;
448 if (this->town->
received[i].old_act < this->town->goal[i]) {
449 string = STR_TOWN_VIEW_CARGO_FOR_TOWNGROWTH_REQUIRED;
460 DrawString(tr, STR_TOWN_VIEW_TOWN_GROW_STOPPED);
470 if (!this->town->
text.empty()) {
539 for (
int i = TAE_BEGIN; i <
TAE_END; i++) {
540 if (this->town->
goal[i] == 0)
continue;
554 if (!this->town->
text.empty()) {
561 void ResizeWindowAsNeeded()
593 void OnInvalidateData([[maybe_unused]]
int data = 0, [[maybe_unused]]
bool gui_scope =
true)
override
595 if (!gui_scope)
return;
598 this->ResizeWindowAsNeeded();
603 if (!str.has_value())
return;
614static constexpr NWidgetPart _nested_town_game_view_widgets[] = {
629 NWidget(
WWT_PANEL, COLOUR_BROWN,
WID_TV_INFO),
SetMinimalSize(260, 32),
SetResize(1, 0),
SetFill(1, 0),
EndContainer(),
631 NWidget(
WWT_PUSHTXTBTN, COLOUR_BROWN,
WID_TV_SHOW_AUTHORITY),
SetMinimalSize(80, 12),
SetFill(1, 1),
SetResize(1, 0),
SetStringTip(STR_TOWN_VIEW_LOCAL_AUTHORITY_BUTTON, STR_TOWN_VIEW_LOCAL_AUTHORITY_TOOLTIP),
632 NWidget(
WWT_TEXTBTN, COLOUR_BROWN,
WID_TV_CATCHMENT),
SetMinimalSize(40, 12),
SetFill(1, 1),
SetResize(1, 0),
SetStringTip(STR_BUTTON_CATCHMENT, STR_TOOLTIP_CATCHMENT),
639 WDP_AUTO,
"view_town", 260, TownViewWindow::WID_TV_HEIGHT_NORMAL,
642 _nested_town_game_view_widgets
645static constexpr NWidgetPart _nested_town_editor_view_widgets[] = {
660 NWidget(
WWT_PANEL, COLOUR_BROWN,
WID_TV_INFO),
SetMinimalSize(260, 32),
SetResize(1, 0),
SetFill(1, 0),
EndContainer(),
674 WDP_AUTO,
"view_town_scen", 260, TownViewWindow::WID_TV_HEIGHT_NORMAL,
677 _nested_town_editor_view_widgets
680void ShowTownViewWindow(
TownID town)
682 if (_game_mode == GM_EDITOR) {
683 AllocateWindowDescFront<TownViewWindow>(_town_editor_view_desc, town);
685 AllocateWindowDescFront<TownViewWindow>(_town_game_view_desc, town);
689static constexpr NWidgetPart _nested_town_directory_widgets[] = {
707 NWidget(
WWT_TEXT, INVALID_COLOUR,
WID_TD_WORLD_POPULATION),
SetPadding(2, 0, 2, 2),
SetFill(1, 0),
SetResize(1, 0),
724 static inline const StringID sorter_names[] = {
726 STR_SORT_BY_POPULATION,
729 static const std::initializer_list<GUITownList::SortFunction * const>
sorter_funcs;
738 void BuildSortTownList()
746 this->towns.push_back(t);
755 this->vscroll->
SetCount(this->towns.size());
774 return a_population < b_population;
780 bool before = !order;
788 return a_rating < b_rating;
809 this->BuildSortTownList();
853 if (this->towns.empty()) {
861 int icon_x = tr.
WithWidth(icon_size.width, rtl).left;
865 for (
auto it = first; it != last; ++it) {
871 DrawSprite(SPR_TOWN_RATING_NA, PAL_NONE, icon_x, tr.top + (this->resize.step_height - icon_size.height) / 2);
873 SpriteID icon = SPR_TOWN_RATING_APPALLING;
876 DrawSprite(icon, PAL_NONE, icon_x, tr.top + (this->resize.step_height - icon_size.height) / 2);
894 d.height += padding.height;
900 d.width += padding.width;
901 d.height += padding.height;
908 for (uint i = 0; i < this->towns.size(); i++) {
909 const Town *t = this->towns[i];
911 assert(t !=
nullptr);
916 d.width += icon_size.width + 2;
917 d.height = std::max(d.height, icon_size.height);
918 fill.height =
resize.height = d.height;
920 d.width += padding.width;
921 d.height += padding.height;
927 d.width += padding.width;
928 d.height += padding.height;
941 this->last_sorting = this->towns.
GetListing();
944 this->last_sorting.
order = !this->last_sorting.
order;
958 if (it == this->towns.end())
return;
961 assert(t !=
nullptr);
976 if (this->towns.
SortType() != index) {
978 this->last_sorting = this->towns.
GetListing();
979 this->BuildSortTownList();
985 if (this->towns.
NeedRebuild()) this->BuildSortTownList();
991 this->BuildSortTownList();
1013 void OnInvalidateData([[maybe_unused]]
int data = 0, [[maybe_unused]]
bool gui_scope =
true)
override
1016 case TDIWD_FORCE_REBUILD:
1021 case TDIWD_POPULATION_CHANGE:
1030 static inline HotkeyList hotkeys {
"towndirectory", {
1035Listing TownDirectoryWindow::last_sorting = {
false, 0};
1040 &TownPopulationSorter,
1048 _nested_town_directory_widgets,
1049 &TownDirectoryWindow::hotkeys
1052void ShowTownDirectory()
1060 if (result.
Failed())
return;
1071static constexpr NWidgetPart _nested_found_town_widgets[] = {
1165 this->RandomTownName();
1166 this->UpdateButtons(
true);
1171 if (_game_mode == GM_EDITOR)
return;
1183 void RandomTownName()
1187 if (!this->townnamevalid) {
1188 this->townname_editbox.text.
DeleteAll();
1190 this->townname_editbox.text.
Assign(GetTownName(&this->params, this->townnameparts));
1197 void UpdateButtons(
bool check_availability)
1199 if (check_availability && _game_mode != GM_EDITOR) {
1220 template <
typename Tcallback>
1221 void ExecuteFoundTownCommand(
TileIndex tile,
bool random,
StringID errstr, Tcallback cc)
1225 if (!this->townnamevalid) {
1226 name = this->townname_editbox.text.
GetText();
1229 std::string original_name = GetTownName(&this->params, this->townnameparts);
1230 if (original_name != this->townname_editbox.text.
GetText()) name = this->townname_editbox.text.
GetText();
1248 this->ExecuteFoundTownCommand(
TileIndex{},
true, STR_ERROR_CAN_T_GENERATE_TOWN, CcFoundRandomTown);
1252 this->RandomTownName();
1273 this->UpdateButtons(
false);
1284 this->UpdateButtons(
false);
1289 this->UpdateButtons(
false);
1300 this->UpdateButtons(
false);
1308 if (!str.has_value())
return;
1311 if (!value.has_value())
return;
1319 old_generating_world.
Restore();
1324 this->ExecuteFoundTownCommand(tile,
false, STR_ERROR_CAN_T_FOUND_TOWN_HERE, CcFoundTown);
1330 this->UpdateButtons(
false);
1338 void OnInvalidateData([[maybe_unused]]
int data = 0, [[maybe_unused]]
bool gui_scope =
true)
override
1340 if (!gui_scope)
return;
1341 this->UpdateButtons(
true);
1349 _nested_found_town_widgets
1352void ShowFoundTownWindow()
1355 AllocateWindowDescFront<FoundTownWindow>(_found_town_desc, 0);
1358void InitializeTownGui()
1360 _town_local_authority_kdtree.
Clear();
1372 auto draw = [](
int x,
int y,
HouseID house_id,
int view) {
1391 if (dcts.building.
sprite != 0) {
1404 draw(x, y - y_delta - y_delta, house_id, view);
1405 draw(x + x_delta, y - y_delta, house_id + 1, view);
1406 draw(x - x_delta, y - y_delta, house_id + 2, view);
1407 draw(x, y, house_id + 3, view);
1409 draw(x + x_delta / 2, y - y_delta, house_id, view);
1410 draw(x - x_delta / 2, y, house_id + 1, view);
1412 draw(x - x_delta / 2, y - y_delta, house_id, view);
1413 draw(x + x_delta / 2, y, house_id + 1, view);
1415 draw(x, y, house_id, view);
1426 std::array<int32_t, 1> regs100;
1430 if (callback_res == 0x40F) {
1432 }
else if (callback_res > 0x400) {
1437 if (new_name != STR_NULL && new_name != STR_UNDEFINED) {
1462 for (
int cls_id = 0; cls_id < num_classes; ++cls_id) {
1464 for (
int id = 0;
id < num_types; ++id) {
1482 static inline const std::array<StringID, NUM_HOUSE_ZONES> zone_names = {
1483 STR_HOUSE_PICKER_CLASS_ZONE1,
1484 STR_HOUSE_PICKER_CLASS_ZONE2,
1485 STR_HOUSE_PICKER_CLASS_ZONE3,
1486 STR_HOUSE_PICKER_CLASS_ZONE4,
1487 STR_HOUSE_PICKER_CLASS_ZONE5,
1490 GrfSpecFeature GetFeature()
const override {
return GSF_HOUSES; }
1497 int GetClassCount()
const override {
return static_cast<int>(zone_names.size()); }
1508 return zone_names[id];
1520 if (!spec->grf_prop.HasGrfFile())
return {0, spec->Index(), cls_id,
id};
1521 return {spec->grf_prop.grfid, spec->grf_prop.local_id, cls_id,
id};
1537 for (
int i = 0; i < cls_id; i++) {
1548 if (spec ==
nullptr)
return {};
1549 if (!spec->enabled)
return {};
1550 if (!spec->building_availability.Any(climate_mask))
return {};
1551 if (!spec->building_availability.Test(GetHouseZoneFromClassId(cls_id)))
return {};
1552 for (
int i = 0; i < cls_id; i++) {
1554 if (spec->building_availability.Test(GetHouseZoneFromClassId(i)))
return {};
1557 return spec->badges;
1566 void DrawType(
int x,
int y,
int,
int id)
const override
1574 for (
auto it = id_count.begin(); it != id_count.end(); ++it) {
1575 if (*it == 0)
continue;
1576 HouseID house =
static_cast<HouseID>(std::distance(id_count.begin(), it));
1579 items.insert({0, house, class_index, house});
1585 if (src.empty())
return src;
1588 std::set<PickerItem> dst;
1589 for (
const auto &item : src) {
1590 if (item.grfid == 0) {
1595 if (it == specs.end()) {
1597 dst.insert({item.grfid, item.local_id, -1, -1});
1599 int class_index = GetClassIdFromHouseZone(it->building_availability);
1600 dst.insert( {item.grfid, item.local_id, class_index, it->Index()});
1619 CargoTypes produced{};
1621 for (uint i = 0; i < 256; i++) {
1629 uint amt =
GB(callback, 0, 8);
1630 if (amt == 0)
continue;
1643 std::string house_info{};
1644 static inline bool house_protected;
1649 this->ConstructWindow();
1652 void UpdateSelectSize(
const HouseSpec *spec)
1654 if (spec ==
nullptr) {
1681 return GetString(STR_HOUSE_PICKER_YEARS_ANY);
1683 return GetString(STR_HOUSE_PICKER_YEARS_UNTIL, max_year);
1686 return GetString(STR_HOUSE_PICKER_YEARS_FROM, min_year);
1688 return GetString(STR_HOUSE_PICKER_YEARS, min_year, max_year);
1698 std::stringstream line;
1714 line <<
GetString(STR_HOUSE_PICKER_SIZE,
GB(size, 0, 4),
GB(size, 4, 4));
1717 if (cargo_string.has_value()) {
1719 line << *cargo_string;
1723 if (produced != 0) {
1725 line <<
GetString(STR_HOUSE_PICKER_CARGO_PRODUCED, produced);
1733 this->InvalidateData(PICKER_INVALIDATION_ALL);
1768 if (!gui_scope)
return;
1774 UpdateSelectSize(spec);
1780 if (hasflag) BuildHouseWindow::house_protected =
true;
1802 static inline HotkeyList hotkeys{
"buildhouse", {
1840 &BuildHouseWindow::hotkeys
1843void ShowBuildHousePicker(
Window *parent)
Class for backupping variables and making sure they are restored later.
debug_inline constexpr bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
constexpr T SetBit(T &x, const uint8_t y)
Set a bit in a variable.
constexpr uint8_t FindFirstBit(T x)
Search the first set bit in a value.
debug_inline static constexpr uint GB(const T x, const uint8_t s, const uint8_t n)
Fetch n bits from x, started at bit s.
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.
std::optional< std::string > BuildCargoAcceptanceString(const CargoArray &acceptance, StringID label)
Build comma-separated cargo acceptance string.
@ TPE_PASSENGERS
Cargo behaves passenger-like for production.
@ TPE_MAIL
Cargo behaves mail-like for production.
TownAcceptanceEffect
Town growth effect when delivering cargo.
@ TAE_END
End of town effects.
constexpr bool Test(Tvalue_type value) const
Test if the value-th bit is set.
constexpr Timpl & Flip(Tvalue_type value)
Flip the value-th bit.
constexpr Timpl & Set()
Set all bits.
constexpr bool Any(const Timpl &other) const
Test if any of the given values are set.
std::optional< Tvalue_type > GetNthSetBit(uint n) const
Get the value of the Nth set bit.
Common return value for all commands.
bool Succeeded() const
Did this command succeed?
bool Failed() const
Did this command fail?
std::string GetDecodedString() const
Decode the encoded string.
List template of 'things' T to sort in a GUI.
void RebuildDone()
Notify the sortlist that the rebuild is done.
void SetListing(Listing l)
Import sort conditions.
bool IsDescSortOrder() const
Check if the sort order is descending.
void ToggleSortOrder()
Toggle the sort order Since that is the worst condition for the sort function reverse the list here.
bool NeedRebuild() const
Check if a rebuild is needed.
void ForceRebuild()
Force that a rebuild is needed.
bool Sort(Comp compare)
Sort the list.
void ForceResort()
Force a resort next Sort call Reset the resort timer if used too.
uint8_t SortType() const
Get the sorttype of the list.
Listing GetListing() const
Export current sort conditions.
void SetSortFuncs(std::span< SortFunction *const > n_funcs)
Hand the sort function pointers to the GUIList.
void SetSortType(uint8_t n_type)
Set the sorttype of the list.
PickerItem GetPickerItem(int cls_id, int id) const override
Get data about an item.
bool IsActive() const override
Should picker class/type selection be enabled?
void SetClimateMask()
Set climate mask for filtering buildings from current landscape.
void SetSelectedClass(int cls_id) const override
Set the selected class.
StringID GetClassTooltip() const override
Get the tooltip string for the class list.
std::span< const BadgeID > GetTypeBadges(int cls_id, int id) const override
Get the item of a type.
void DrawType(int x, int y, int, int id) const override
Draw preview image of an item.
static int sel_view
Currently selected 'view'. This is not controllable as its based on random data.
int GetClassCount() const override
Get the number of classes.
void FillUsedItems(std::set< PickerItem > &items) override
Fill a set with all items that are used by the current player.
static int sel_type
Currently selected HouseID.
int GetSelectedClass() const override
Get the index of the selected class.
std::set< PickerItem > UpdateSavedItems(const std::set< PickerItem > &src) override
Update link between grfid/localidx and class_index/index in saved items.
StringID GetTypeTooltip() const override
Get the tooltip string for the type grid.
void SetSelectedType(int id) const override
Set the selected type.
StringID GetTypeName(int cls_id, int id) const override
Get the item of a type.
int GetSelectedType() const override
Get the selected type.
bool IsTypeAvailable(int, int id) const override
Test if an item is currently buildable.
bool HasClassChoice() const override
Are there multiple classes to chose from?
uint8_t class_mask
Mask of available 'classes'.
int GetTypeCount(int cls_id) const override
Get the number of types in a class.
StringID GetClassName(int id) const override
Get the name of a class.
static int sel_class
Currently selected 'class'.
An interval timer will fire every interval, and will continue to fire until it is deleted.
K-dimensional tree, specialised for 2-dimensional space.
void Insert(const T &element)
Insert a single element in the tree.
void Remove(const T &element)
Remove a single element from the tree, if it exists.
void Clear()
Clear the tree.
Class for PickerClassWindow to collect information and retain state.
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
@ Position
Update scroll positions.
@ PCWHK_FOCUS_FILTER_BOX
Focus the edit box for editing the filter string.
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
void OnInit() override
Notification that the nested widget tree gets initialized.
static constexpr TimerGameTick::Ticks DAY_TICKS
1 day is 74 ticks; TimerGameCalendar::date_fract used to be uint16_t and incremented by 885.
static constexpr TimerGame< struct Calendar >::Year MIN_YEAR
The absolute minimum year in OTTD.
static constexpr TimerGame< struct Calendar >::Year MAX_YEAR
MAX_YEAR, nicely rounded value of the number of years that can be encoded in a single 32 bits date,...
static bool UsingWallclockUnits(bool newgame=false)
Check if we are using wallclock units.
Functions related to commands.
@ Execute
execute the given command
Commands
List of commands.
Definition of stuff that is very close to a company, like the company struct itself.
void DrawCompanyIcon(CompanyID c, int x, int y)
Draw the icon of a company.
PaletteID GetCompanyPalette(CompanyID company)
Get the palette for recolouring with a company colour.
Money GetAvailableMoney(CompanyID company)
Get the amount of money that a company has available, or INT64_MAX if there is no such valid company.
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Functions related to companies.
GUI Functions related to companies.
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.
Functions related to the drop down widget.
constexpr std::underlying_type_t< enum_type > to_underlying(enum_type e)
Implementation of std::to_underlying (from C++23)
Functions related to errors.
@ WL_INFO
Used for DoCommand-like (and some non-fatal AI GUI) errors/information.
void ShowErrorMessage(EncodedString &&summary_msg, int x, int y, CommandCost &cc)
Display an error message in a window.
@ SLO_LOAD
File is being loaded.
@ FT_TOWN_DATA
town data file
Declarations for savegames operations.
void ShowSaveLoadDialog(AbstractFileType abstract_filetype, SaveLoadOperation fop)
Launch save/load dialog in the given mode.
int GetCharacterHeight(FontSize size)
Get height of a character for a given font size.
bool _generating_world
Whether we are generating the map or not.
Functions related to world/map generation.
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
int GetStringHeight(std::string_view str, int maxw, FontSize fontsize)
Calculates height of string (in pixels).
Dimension GetSpriteSize(SpriteID sprid, Point *offset, ZoomLevel zoom)
Get the size of a sprite.
bool _shift_pressed
Is Shift pressed?
Dimension GetStringBoundingBox(std::string_view str, FontSize start_fontsize)
Return the string dimension in pixels.
Dimension GetStringListBoundingBox(std::span< const StringID > list, FontSize fontsize)
Get maximum dimension of a list of strings.
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?
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
Dimension GetStringMultiLineBoundingBox(StringID str, const Dimension &suggestion)
Calculate string bounding box for multi-line strings.
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.
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
@ FS_NORMAL
Index of the normal font in the font tables.
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
@ TC_NO_SHADE
Do not add shading to this text colour.
uint8_t LowestSnowLine()
Get the lowest possible snow line height, either variable or static.
uint8_t GetSnowLine()
Get the current snow line, either variable or static.
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
void MarkWholeScreenDirty()
This function mark the whole screen as dirty.
GUI functions that shouldn't be here.
void ShowExtraViewportWindow(TileIndex tile=INVALID_TILE)
Show a new Extra Viewport window.
Hotkey related functions.
definition of HouseSpec and accessors
@ BuildingIsProtected
towns and AI will not remove this house, while human players will be able to
HouseZones GetClimateMaskForLandscape()
Get the HouseZones climate mask for the current landscape type.
static const HouseID NEW_HOUSE_OFFSET
Offset for new houses.
static const uint8_t TOWN_HOUSE_COMPLETED
Simple value that indicates the house has reached the final stage of construction.
uint16_t HouseID
OpenTTD ID of house types.
Functions related to OTTD's landscape.
Point RemapCoords(int x, int y, int z)
Map 3D world or tile coordinate to equivalent 2D coordinate as used in the viewports and smallmap.
bool DoZoomInOutWindow(ZoomStateChange how, Window *w)
Zooms a viewport in a window in or out.
bool HandlePlacePushButton(Window *w, WidgetID widget, CursorID cursor, HighLightStyle mode)
This code is shared for the majority of the pushbuttons.
constexpr int RoundDivSU(int a, uint b)
Computes round(a / b) for signed a and unsigned b.
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.
bool _networking
are we in networking mode?
bool _network_server
network-server is active
Basic functions/variables used all over the place.
@ CBID_HOUSE_CUSTOM_NAME
Called on the Get Tile Description for an house tile.
@ CBID_HOUSE_PRODUCE_CARGO
Called to determine how much cargo a town building produces.
static const uint CALLBACK_FAILED
Different values for Callback result evaluations.
@ ProduceCargo
custom cargo production
static const uint CALLBACK_HOUSEPRODCARGO_END
Sentinel indicating that the loop for CBID_HOUSE_PRODUCE_CARGO has ended.
CargoType GetCargoTranslation(uint8_t cargo, const GRFFile *grffile, bool usebit)
Translate a GRF-local cargo slot/bitnum into a CargoType.
Cargo support for NewGRFs.
void ErrorUnknownCallbackResult(uint32_t grfid, uint16_t cbid, uint16_t cb_res)
Record that a NewGRF returned an unknown/invalid callback result.
std::span< const uint > GetBuildingHouseIDCounts()
Get read-only span of total HouseID building counts.
void DrawNewHouseTileInGUI(int x, int y, const HouseSpec *spec, HouseID house_id, int view)
Draw representation of a house tile for GUI purposes.
Functions related to NewGRF houses.
StringID GetGRFStringID(uint32_t grfid, GRFStringID stringid)
Returns the index for this stringid associated with its grfID.
Header of Action 04 "universal holder" structure and functions.
static constexpr GRFStringID GRFSTR_MISC_GRF_TEXT
Miscellaneous GRF text range.
void UpdateOSKOriginalText(const Window *parent, WidgetID button)
Updates the original text of the OSK so when the 'parent' changes the original and you press on cance...
std::unique_ptr< NWidgetBase > MakePickerClassWidgets()
Create nested widgets for the class picker widgets.
std::unique_ptr< NWidgetBase > MakePickerTypeWidgets()
Create nested widgets for the type picker widgets.
Base for the GUIs that have an edit box in them.
Randomizer _interactive_random
Random used everywhere else, where it does not (directly) influence the game state.
void UpdateNearestTownForRoadTiles(bool invalidate)
Updates cached nearest town for all road tiles.
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.
@ SWS_OFF
Scroll wheel has no effect.
Base types for having sorted lists in GUIs.
void SndClickBeep()
Play a beep sound for a click event if enabled in settings.
Functions related to sound.
@ SND_1F_CONSTRUCTION_OTHER
29 == 0x1D Construction: other (non-water, non-rail, non-bridge)
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.
static std::optional< T > ParseInteger(std::string_view arg, int base=10, bool clamp=false)
Change a string into its number representation.
Functions related to low-level strings.
@ CS_NUMERAL
Only numeric ones.
@ CS_ALPHANUMERAL
Both numeric and alphabetic and spaces and stuff.
Searching and filtering using a stringterm.
EncodedString GetEncodedString(StringID str)
Encode a string with no parameters into an encoded string.
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.
uint64_t GetParamMaxDigits(uint count, FontSize size)
Get some number that is suitable for string size computations.
Functions related to OTTD's strings.
uint32_t StringID
Numeric value that represents a string, independent of the selected language.
static const StringID INVALID_STRING_ID
Constant representing an invalid string (16bit in case it is used in savegames)
@ TD_RTL
Text is written right-to-left by default.
static const int MAX_CHAR_LENGTH
Max. length of UTF-8 encoded unicode character.
Class to backup a specific variable and restore it later.
void Restore()
Restore the variable.
static std::string GetHouseYear(TimerGameCalendar::Year min_year, TimerGameCalendar::Year max_year)
Get a date range string for house availability year.
void OnPlaceObject(Point pt, TileIndex tile) override
The user clicked some place on the map when a tile highlight mode has been set.
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
static std::string GetHouseInformation(const HouseSpec *hs)
Get information string for a house.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
void OnInit() override
Notification that the nested widget tree gets initialized.
Specification of a cargo type.
CargoType Index() const
Determines index of this cargospec.
StringID name
Name of this type of cargo.
static std::array< std::vector< const CargoSpec * >, NUM_TPE > town_production_cargoes
List of cargo specs for each Town Product Effect.
SoundSettings sound
sound effect settings
GUISettings gui
settings related to the GUI
Dimensions (a width and height) of a rectangle in 2D.
This structure is the same for both Industries and Houses.
bool bribe
enable bribing the local authority
TownFounding found_town
town founding.
bool exclusive_rights
allow buying exclusive rights
TownLayout town_layout
select town layout,
bool station_noise_level
build new airports when the town noise level is still within accepted limits
bool fund_buildings
allow funding new buildings
bool fund_roads
allow funding local road reconstruction
Found a town window class.
uint32_t townnameparts
Generated town name.
TownLayout town_layout
Selected town layout.
void OnPlaceObject(Point pt, TileIndex tile) override
The user clicked some place on the map when a tile highlight mode has been set.
QueryString townname_editbox
Townname editbox.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
void OnInit() override
Notification that the nested widget tree gets initialized.
TownSize town_size
Selected town size.
bool townnamevalid
Is generated town name valid?
TownNameParams params
Town name parameters.
void OnQueryTextFinished(std::optional< std::string > str) override
The query window opened from this window has closed.
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
void OnPlaceObjectAbort() override
The user cancelled a tile highlight mode that has been set.
bool city
Are we building a city?
const struct GRFFile * grffile
grf file that introduced this entity
uint16_t local_id
id defined by the grf file for this entity
uint32_t grfid
grfid that introduced this entity.
bool persistent_buildingtools
keep the building tools active after usage
uint8_t scrollwheel_scrolling
scrolling using the scroll wheel?
EconomySettings economy
settings to change the economy
List of hotkeys for a window.
All data for a single hotkey.
SubstituteGRFFileProps grf_prop
Properties related the the grf file.
bool enabled
the house is available to build (true by default, but can be disabled by newgrf)
static HouseSpec * Get(size_t house_id)
Get the spec for a house ID.
BuildingFlags building_flags
some flags that describe the house (size, stadium etc...)
TimerGameCalendar::Year max_year
last year it can be built
HouseCallbackMasks callback_mask
Bitmask of house callbacks that have to be called.
uint8_t population
population (Zero on other tiles in multi tile house.)
HouseExtraFlags extra_flags
some more flags
TimerGameCalendar::Year min_year
introduction year of the house
HouseID Index() const
Gets the index of this spec.
StringID building_name
building name
HouseZones building_availability
where can it be built (climates, zones)
static std::vector< HouseSpec > & Specs()
Get a reference to all HouseSpecs.
Data structure describing how to show the list (what sort direction and criteria).
bool order
Ascending/descending.
SpriteID sprite
The 'real' sprite.
PaletteID pal
The palette (use PAL_NONE) if not needed)
static Pool::IterateWrapper< Titem > Iterate(size_t from=0)
Returns an iterable ensemble of all valid Titem.
static Titem * Get(auto index)
Returns Titem with given index.
static size_t GetNumItems()
Returns number of valid items in the pool.
Tindex index
Index of this pool item.
static bool IsValidID(auto index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
Data stored about a string that can be modified in the GUI.
int cancel_button
Widget button of parent window to simulate when pressing CANCEL in OSK.
static const int ACTION_CLEAR
Clear editbox.
constexpr uint Horizontal() const
Get total horizontal padding of RectPadding.
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 Indent(int indent, bool end) const
Copy Rect and indent it from its position.
uint step_height
Step-size of height resize changes.
bool confirm
Play sound effect on successful constructions or other actions.
Coord3D< int8_t > origin
Position of northern corner within tile.
bool HasSpriteGroups() const
Check whether the entity has sprite groups.
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.
void DeleteAll()
Delete every character in the textbuffer.
std::string_view GetText() const
Get the current text.
void Assign(std::string_view text)
Copy a string into the textbuffer.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
void DrawActions()
Draws the contents of the actions panel.
Dimension icon_size
Dimensions of company icon.
void OnInit() override
Notification that the nested widget tree gets initialized.
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
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.
Town * town
Town being displayed.
TownActions enabled_actions
Actions that are enabled in settings.
TownAction sel_action
Currently selected town action, TownAction::End means no action selected.
TownActions available_actions
Actions that are available to execute for the current company.
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
void DrawRatings()
Draw the contents of the ratings panel.
const IntervalTimer< TimerWindow > redraw_interval
Redraw the whole window on a regular interval.
Dimension exclusive_size
Dimensions of exclusive icon.
std::string GetWidgetString(WidgetID widget, StringID stringid) const override
Get the raw string for a widget.
static TownActions GetEnabledActions()
Gets all town authority actions enabled in settings.
void OnPaint() override
The window must be repainted.
TownActions displayed_actions_on_previous_painting
Actions that were available on the previous call to OnPaint()
uint32_t population
Current population of people.
Town directory window class.
static const std::initializer_list< GUITownList::SortFunction *const > sorter_funcs
Available town directory sorting functions.
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
static bool TownPopulationSorter(const Town *const &a, const Town *const &b, const bool &order)
Sort by population (default descending, as big towns are of the most interest).
QueryString townname_editbox
Filter editbox.
void OnEditboxChanged(WidgetID wid) override
The text in an editbox has been edited.
static bool TownRatingSorter(const Town *const &a, const Town *const &b, const bool &order)
Sort by town rating.
void OnResize() override
Called after the window got resized.
StringFilter string_filter
Filter for towns.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
const IntervalTimer< TimerWindow > rebuild_interval
Redraw the whole window on a regular interval.
void OnPaint() override
The window must be repainted.
void OnDropdownSelect(WidgetID widget, int index, int) override
A dropdown option associated to this window has been selected.
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
static std::string GetTownString(const Town *t, uint64_t population)
Get the string to draw the town name.
static bool TownNameSorter(const Town *const &a, const Town *const &b, const bool &)
Sort by town name.
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.
std::string GetWidgetString(WidgetID widget, StringID stringid) const override
Get the raw string for a widget.
Struct holding parameters used to generate town name.
void OnClick(Point pt, WidgetID widget, int click_count) override
A click with the left mouse button has been made on the window.
Town * town
Town displayed by the window.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
void OnMouseWheel(int wheel, WidgetID widget) override
The mouse wheel has been turned.
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.
void DrawWidget(const Rect &r, WidgetID widget) const override
Draw the contents of a nested widget.
uint GetDesiredInfoHeight(int width) const
Gets the desired height for the information panel.
std::string GetWidgetString(WidgetID widget, StringID stringid) const override
Get the raw string for a widget.
void Close(int data=0) override
Hide the window and all its child windows, and mark them for a later deletion.
void OnPaint() override
The window must be repainted.
void OnQueryTextFinished(std::optional< std::string > str) override
The query window opened from this window has closed.
void OnResize() override
Called after the window got resized.
EncodedString text
General text with additional information.
bool larger_town
if this is a larger town and should grow more quickly
TileIndex xy
town center tile
uint8_t fund_buildings_months
fund buildings program in action?
uint16_t noise_reached
level of noise that all the airports are generating
SuppliedCargoes supplied
Cargo statistics about supplied cargo.
uint8_t flags
See TownFlags.
TownCache cache
Container for all cacheable data.
CompanyID exclusivity
which company has exclusivity
bool show_zone
NOSAVE: mark town to show the local authority zone in the viewports.
CompanyMask have_ratings
which companies have a rating
TypedIndexContainer< std::array< int16_t, MAX_COMPANIES >, CompanyID > ratings
ratings of each company for this town
uint16_t growth_rate
town growth rate
std::array< TransportedCargoStat< uint16_t >, NUM_TAE > received
Cargo statistics about received cargotypes.
std::array< uint32_t, NUM_TAE > goal
Amount of cargo required for the town to grow.
High level window description.
Number to differentiate different windows of the same class.
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.
virtual void Close(int data=0)
Hide the window and all its child windows, and mark them for a later deletion.
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.
void SetWidgetDirty(WidgetID widget_index) const
Invalidate a widget, i.e.
std::unique_ptr< ViewportData > viewport
Pointer to viewport data, if present.
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.
ResizeInfo resize
Resize information.
void CreateNestedTree()
Perform the first part of the initialization of a nested widget tree.
bool SetFocusedWidget(WidgetID widget_index)
Set focus within this window to the given widget.
bool IsWidgetLowered(WidgetID widget_index) const
Gets the lowered state of a widget.
void RaiseButtons(bool autoraise=false)
Raise the buttons of the window.
void SetWidgetLoweredState(WidgetID widget_index, bool lowered_stat)
Sets the lowered/raised status of a widget.
bool IsShaded() const
Is window shaded currently?
int GetRowFromWidget(int clickpos, WidgetID widget, int padding, int line_height=-1) const
Compute the row of a widget that a user clicked in.
void InitNested(WindowNumber number=0)
Perform complete initialization of the Window with nested widgets, to allow use.
WindowFlags flags
Window flags.
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.
AllWindows< false > Iterate
Iterate all windows in whatever order is easiest.
int width
width of the window (number of pixels to the right in x direction)
WindowNumber window_number
Window number within the window class.
@ AcceptUnchanged
return success even when the text didn't change
@ EnableDefault
enable the 'Default' button ("\0" is returned)
@ LengthIsInChars
the length of the string is counted in characters
TropicZone GetTropicZone(Tile tile)
Get the tropic zone.
static debug_inline uint TileHeight(Tile tile)
Returns the height of a tile.
@ TROPICZONE_DESERT
Tile is desert.
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
static constexpr uint TILE_PIXELS
Pixel distance between tile columns/rows in ZOOM_BASE.
Functions related to tile highlights.
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows).
void SetObjectToPlaceWnd(CursorID icon, PaletteID pal, HighLightStyle mode, Window *w)
Change the cursor and mouse click/drag handling to a mode for performing special operations like tile...
@ HT_DIAGONAL
Also allow 'diagonal rectangles'. Only usable in combination with HT_RECT or HT_POINT.
@ HT_RECT
rectangle (stations, depots, ...)
Definition of Interval and OneShot timers.
Definition of the game-calendar-timer.
Definition of the Window system.
static const uint TOWN_GROWTH_WINTER
The town only needs this cargo in the winter (any amount)
uint GetDefaultTownsForMapSize()
Calculate the number of towns which should be on the map according to the current "town density" newg...
TownActions GetMaskOfTownActions(CompanyID cid, const Town *t)
Get a list of available town authority actions.
const CargoSpec * FindFirstCargoWithTownAcceptanceEffect(TownAcceptanceEffect effect)
Determines the first cargo with a certain town effect.
static const uint TOWN_GROWTH_DESERT
The town needs the cargo for growth when on desert (any amount)
@ TOWN_IS_GROWING
Conditions for town growth are met. Grow according to Town::growth_rate.
bool GenerateTowns(TownLayout layout, std::optional< uint > number=std::nullopt)
Generate a number of towns with a given layout.
uint32_t GetWorldPopulation()
Get the total population, the sum of all towns in the world.
CargoArray GetAcceptedCargoOfHouse(const HouseSpec *hs)
Get accepted cargo of a house prototype.
uint8_t GetTownActionCost(TownAction action)
Get cost factors for a TownAction.
TownAction
Town actions of a company.
@ RoadRebuild
Rebuild the roads.
@ Bribe
Try to bribe the council.
@ BuyRights
Buy exclusive transport rights.
@ FundBuildings
Fund new buildings.
Command definitions related to towns.
static constexpr NWidgetPart _nested_build_house_widgets[]
Nested widget definition for the build NewGRF rail waypoint window.
void DrawHouseInGUI(int x, int y, HouseID house_id, int view)
Draw a house that does not exist.
static StringID GetHouseName(const HouseSpec *hs)
Get name for a prototype house.
static CargoTypes GetProducedCargoOfHouse(const HouseSpec *hs)
Get the cargo types produced by a house.
Declarations for accessing the k-d tree of towns.
@ TF_CUSTOM_LAYOUT
Allowed, with custom town layout.
TownSize
Supported initial town sizes.
static const uint MAX_LENGTH_TOWN_NAME_CHARS
The maximum length of a town name in characters including '\0'.
@ Roads
Allow town to place roads.
@ Buildings
Allow town to place buildings.
bool GenerateTownName(Randomizer &randomizer, uint32_t *townnameparts, TownNames *town_names)
Generates valid town name.
Town name generator stuff.
bool ScrollWindowToTile(TileIndex tile, Window *w, bool instant)
Scrolls the viewport in a window to a given location.
void SetTileSelectSize(int w, int h)
Highlight w by h tiles at the cursor.
bool ScrollMainWindowToTile(TileIndex tile, bool instant)
Scrolls the viewport of the main window to a given location.
void SetViewportCatchmentTown(const Town *t, bool sel)
Select or deselect town for coverage area highlight.
const Town * _viewport_highlight_town
Currently selected town for coverage area highlight.
Functions related to (drawing on) viewports.
@ ZOOM_IN
Zoom in (get more detailed view).
@ ZOOM_OUT
Zoom out (get helicopter view).
void ResizeWindow(Window *w, int delta_x, int delta_y, bool clamp_to_screen, bool schedule_resize)
Resize the window.
Window * BringWindowToFrontById(WindowClass cls, WindowNumber number)
Find a window and make it the relative top-window on the screen.
Window functions not directly related to making/drawing windows.
@ Construction
This window is used for construction; close it whenever changing company.
@ DisableVpScroll
Window does not do autoscroll,.
@ SBS_DOWN
Sort ascending.
@ WDP_AUTO
Find a place automatically.
@ WC_TOWN_AUTHORITY
Town authority; Window numbers:
@ WC_FOUND_TOWN
Found a town; Window numbers:
@ WC_BUILD_HOUSE
Build house; Window numbers:
@ WC_BUILD_TOOLBAR
Build toolbar; Window numbers:
@ WC_NONE
No window, redirects to WC_MAIN_WINDOW.
@ WC_TOWN_VIEW
Town view; Window numbers:
@ WC_TOWN_DIRECTORY
Town directory; Window numbers:
Functions related to zooming.
int ScaleSpriteTrad(int value)
Scale traditional pixel dimensions to GUI zoom level, for drawing sprites.
ZoomLevel ScaleZoomGUI(ZoomLevel value)
Scale zoom level relative to GUI zoom.
int UnScaleGUI(int value)
Short-hand to apply GUI zoom level.
@ Town
Default zoom level for the town view.