OpenTTD Source: src/town_gui.cpp File Reference

OpenTTD Source 15.3

Data Structures | Typedefs | Functions | Variables
town_gui.cpp File Reference

GUI for towns. More...

`#include "stdafx.h"`
`#include "town.h"`
`#include "viewport_func.h"`
`#include "error.h"`
`#include "gui.h"`
`#include "house.h"`
`#include "newgrf_cargo.h"`
`#include "newgrf_house.h"`
`#include "newgrf_text.h"`
`#include "picker_gui.h"`
`#include "command_func.h"`
`#include "company_func.h"`
`#include "company_base.h"`
`#include "company_gui.h"`
`#include "network/network.h"`
`#include "string_func.h"`
`#include "strings_func.h"`
`#include "sound_func.h"`
`#include "tilehighlight_func.h"`
`#include "sortlist_type.h"`
`#include "road_cmd.h"`
`#include "landscape.h"`
`#include "querystring_gui.h"`
`#include "window_func.h"`
`#include "townname_func.h"`
`#include "core/backup_type.hpp"`
`#include "core/geometry_func.hpp"`
`#include "core/string_consumer.hpp"`
`#include "genworld.h"`
`#include "fios.h"`
`#include "stringfilter_type.h"`
`#include "dropdown_func.h"`
`#include "town_kdtree.h"`
`#include "town_cmd.h"`
`#include "timer/timer.h"`
`#include "timer/timer_game_calendar.h"`
`#include "timer/timer_window.h"`
`#include "zoom_func.h"`
`#include "hotkeys.h"`
`#include "graph_gui.h"`
`#include "widgets/town_widget.h"`
`#include "table/strings.h"`
`#include "safeguards.h"`

Go to the source code of this file.

## Data Structures
struct | TownAuthorityWindow
| Town authority window. More...
struct | TownViewWindow
struct | TownDirectoryWindow
| Town directory window class. More...
struct | FoundTownWindow
| Found a town window class. More...
class | HousePickerCallbacks
struct | BuildHouseWindow

## Typedefs
typedef GUIList< const Town *, const bool & > | GUITownList

## Functions
static void | ShowTownAuthorityWindow (uint town)
void | ShowTownViewWindow (TownID town)
void | ShowTownDirectory ()
void | CcFoundTown (Commands, const CommandCost &result, TileIndex tile)
void | CcFoundRandomTown (Commands, const CommandCost &result, Money, TownID town_id)
void | ShowFoundTownWindow ()
void | InitializeTownGui ()
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.
void | ShowBuildHousePicker (Window *parent)

## Variables
TownKdtree | _town_local_authority_kdtree {}
static constexpr std::initializer_list< NWidgetPart > | _nested_town_authority_widgets
static WindowDesc | _town_authority_desc (WDP_AUTO, "view_town_authority", 317, 222, WC_TOWN_AUTHORITY, WC_NONE, {}, _nested_town_authority_widgets)
static constexpr std::initializer_list< NWidgetPart > | _nested_town_game_view_widgets
static WindowDesc | _town_game_view_desc (WDP_AUTO, "view_town", 260, TownViewWindow::WID_TV_HEIGHT_NORMAL, WC_TOWN_VIEW, WC_NONE, {}, _nested_town_game_view_widgets)
static constexpr std::initializer_list< NWidgetPart > | _nested_town_editor_view_widgets
static WindowDesc | _town_editor_view_desc (WDP_AUTO, "view_town_scen", 260, TownViewWindow::WID_TV_HEIGHT_NORMAL, WC_TOWN_VIEW, WC_NONE, {}, _nested_town_editor_view_widgets)
static constexpr std::initializer_list< NWidgetPart > | _nested_town_directory_widgets
static WindowDesc | _town_directory_desc (WDP_AUTO, "list_towns", 208, 202, WC_TOWN_DIRECTORY, WC_NONE, {}, _nested_town_directory_widgets, &TownDirectoryWindow::hotkeys)
static constexpr std::initializer_list< NWidgetPart > | _nested_found_town_widgets
static WindowDesc | _found_town_desc (WDP_AUTO, "build_town", 160, 162, WC_FOUND_TOWN, WC_NONE, WindowDefaultFlag::Construction, _nested_found_town_widgets)
static constexpr std::initializer_list< NWidgetPart > | _nested_build_house_widgets
| Nested widget definition for the build NewGRF rail waypoint window.
static WindowDesc | _build_house_desc (WDP_AUTO, "build_house", 0, 0, WC_BUILD_HOUSE, WC_BUILD_TOOLBAR, WindowDefaultFlag::Construction, _nested_build_house_widgets, &BuildHouseWindow::hotkeys)

## Detailed Description

GUI for towns.

Definition in file town_gui.cpp.

## Typedef Documentation

## ◆ GUITownList

typedef GUIList<const Town*, const bool &> GUITownList

Definition at line 59 of file town_gui.cpp.

## Function Documentation

## ◆ CcFoundRandomTown()

void CcFoundRandomTown | ( | Commands | cmd,
|  | const CommandCost & | result,
|  | Money | ,
|  | TownID | town_id
| ) |  |

Definition at line 1066 of file town_gui.cpp.

## ◆ CcFoundTown()

void CcFoundTown | ( | Commands | ,
|  | const CommandCost & | result,
|  | TileIndex | tile
| ) |  |

Definition at line 1058 of file town_gui.cpp.

## ◆ DrawHouseInGUI()

void DrawHouseInGUI | ( | int | x,
|  | int | y,
|  | HouseID | house_id,
|  | int | view
| ) |  |

Draw a house that does not exist.

Parameters

  x | Position x of image.
  y | Position y of image.
  house_id | House ID to draw.
  view | The house's 'view'.

Definition at line 1370 of file town_gui.cpp.

References HouseSpec::building_flags, DrawNewHouseTileInGUI(), DrawSprite(), HouseSpec::Get(), HouseSpec::grf_prop, StandardGRFFileProps::HasSpriteGroups(), NEW_HOUSE_OFFSET, SpriteBounds::origin, PalSpriteID::pal, RemapCoords(), ScaleSpriteTrad(), PalSpriteID::sprite, BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), TILE_PIXELS, TOWN_HOUSE_COMPLETED, UnScaleGUI(), Coord2D< T >::x, Coord3D< T >::x, Coord2D< T >::y, Coord3D< T >::y, and Coord3D< T >::z.

Referenced by HousePickerCallbacks::DrawType().

## ◆ GetHouseName()

static StringID GetHouseName | ( | const HouseSpec * | hs | ) |
| static

Get name for a prototype house.

Parameters

  hs | HouseSpec of house.

Returns
  StringID of name for house.

Definition at line 1424 of file town_gui.cpp.

References HouseSpec::building_name, CALLBACK_FAILED, CBID_HOUSE_CUSTOM_NAME, ErrorUnknownCallbackResult(), GetGRFStringID(), HouseSpec::grf_prop, GRFFilePropsBase::grffile, GRFSTR_MISC_GRF_TEXT, HouseSpec::Index(), and INVALID_TILE.

Referenced by BuildHouseWindow::GetHouseInformation(), and HousePickerCallbacks::GetTypeName().

## ◆ GetProducedCargoOfHouse()

static CargoTypes GetProducedCargoOfHouse | ( | const HouseSpec * | hs | ) |
| static

Get the cargo types produced by a house.

Parameters

  hs | HouseSpec of the house.

Returns
  Mask of cargo types produced by the house.

Definition at line 1620 of file town_gui.cpp.

References CALLBACK_FAILED, CALLBACK_HOUSEPRODCARGO_END, HouseSpec::callback_mask, CBID_HOUSE_PRODUCE_CARGO, GB(), GetCargoTranslation(), HouseSpec::grf_prop, GRFFilePropsBase::grffile, HouseSpec::Index(), INVALID_TILE, IsValidCargoType(), ProduceCargo, SetBit(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), CargoSpec::town_production_cargoes, TPE_MAIL, and TPE_PASSENGERS.

Referenced by BuildHouseWindow::GetHouseInformation().

## ◆ InitializeTownGui()

void InitializeTownGui | ( |  | ) |

Definition at line 1358 of file town_gui.cpp.

## ◆ ShowBuildHousePicker()

void ShowBuildHousePicker | ( | Window * | parent | ) |

Definition at line 1848 of file town_gui.cpp.

## ◆ ShowFoundTownWindow()

void ShowFoundTownWindow | ( |  | ) |

Definition at line 1352 of file town_gui.cpp.

## ◆ ShowTownAuthorityWindow()

static void ShowTownAuthorityWindow | ( | uint | town | ) |
| static

Definition at line 340 of file town_gui.cpp.

## ◆ ShowTownDirectory()

void ShowTownDirectory | ( |  | ) |

Definition at line 1052 of file town_gui.cpp.

## ◆ ShowTownViewWindow()

void ShowTownViewWindow | ( | TownID | town | ) |

Definition at line 680 of file town_gui.cpp.

## Variable Documentation

## ◆ _nested_build_house_widgets

constexpr std::initializer_list<NWidgetPart> _nested_build_house_widgets
| staticconstexpr

Initial value:
= {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_DARK_GREEN),
NWidget(WWT_CAPTION, COLOUR_DARK_GREEN), SetStringTip(STR_HOUSE_PICKER_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_SHADEBOX, COLOUR_DARK_GREEN),
NWidget(WWT_DEFSIZEBOX, COLOUR_DARK_GREEN),
NWidget(WWT_STICKYBOX, COLOUR_DARK_GREEN),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(NWID_VERTICAL),
NWidgetFunction(MakePickerClassWidgets),
NWidget(WWT_PANEL, COLOUR_DARK_GREEN),
NWidget(NWID_VERTICAL), SetPIP(0, WidgetDimensions::unscaled.vsep_picker, 0), SetPadding(WidgetDimensions::unscaled.picker),
NWidget(WWT_EMPTY, INVALID_COLOUR, WID_BH_INFO), SetFill(1, 1), SetMinimalTextLines(10, 0),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BH_PROTECT_TOGGLE), SetMinimalSize(60, 12), SetStringTip(STR_HOUSE_PICKER_PROTECT, STR_HOUSE_PICKER_PROTECT_TOOLTIP),
NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_BH_REPLACE_TOGGLE), SetMinimalSize(60, 12), SetStringTip(STR_HOUSE_PICKER_REPLACE, STR_HOUSE_PICKER_REPLACE_TOOLTIP),
EndContainer(),
EndContainer(),
EndContainer(),
NWidgetFunction(MakePickerTypeWidgets),
EndContainer(),
}
WidgetDimensions::unscaled
static const WidgetDimensions unscaled
Unscaled widget dimensions.
Definition window_gui.h:93
NWidgetFunction
constexpr NWidgetPart NWidgetFunction(NWidgetFunctionType *func_ptr)
Obtain a nested widget (sub)tree from an external source.
Definition widget_type.h:1448
SetFill
constexpr NWidgetPart SetFill(uint16_t fill_x, uint16_t fill_y)
Widget part function for setting filling.
Definition widget_type.h:1222
SetPIP
constexpr NWidgetPart SetPIP(uint8_t pre, uint8_t inter, uint8_t post)
Widget part function for setting a pre/inter/post spaces.
Definition widget_type.h:1378
SetPadding
constexpr NWidgetPart SetPadding(uint8_t top, uint8_t right, uint8_t bottom, uint8_t left)
Widget part function for setting additional space around a widget.
Definition widget_type.h:1335
SetStringTip
constexpr NWidgetPart SetStringTip(StringID string, StringID tip={})
Widget part function for setting the string and tooltip.
Definition widget_type.h:1243
SetMinimalSize
constexpr NWidgetPart SetMinimalSize(int16_t x, int16_t y)
Widget part function for setting the minimal size.
Definition widget_type.h:1159
EndContainer
constexpr NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition widget_type.h:1232
NWidget
constexpr NWidgetPart NWidget(WidgetType tp, Colours col, WidgetID idx=INVALID_WIDGET)
Widget part function for starting a new 'real' widget.
Definition widget_type.h:1427
SetMinimalTextLines
constexpr NWidgetPart SetMinimalTextLines(uint8_t lines, uint8_t spacing, FontSize size=FS_NORMAL)
Widget part function for setting the minimal text lines.
Definition widget_type.h:1190
MakePickerClassWidgets
std::unique_ptr< NWidgetBase > MakePickerClassWidgets()
Create nested widgets for the class picker widgets.
Definition picker_gui.cpp:745
MakePickerTypeWidgets
std::unique_ptr< NWidgetBase > MakePickerTypeWidgets()
Create nested widgets for the type picker widgets.
Definition picker_gui.cpp:768
WID_BH_REPLACE_TOGGLE
@ WID_BH_REPLACE_TOGGLE
Button to toggle replacing existing houses.
Definition town_widget.h:82
WID_BH_PROTECT_TOGGLE
@ WID_BH_PROTECT_TOGGLE
Button to toggle protecting the next house built.
Definition town_widget.h:81
WID_BH_INFO
@ WID_BH_INFO
Information panel of selected house.
Definition town_widget.h:80
NWID_HORIZONTAL
@ NWID_HORIZONTAL
Horizontal container.
Definition widget_type.h:66
WWT_TEXTBTN
@ WWT_TEXTBTN
(Toggle) Button with text
Definition widget_type.h:44
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition widget_type.h:39
WWT_STICKYBOX
@ WWT_STICKYBOX
Sticky box (at top-right of a window, after WWT_DEFSIZEBOX)
Definition widget_type.h:57
WWT_SHADEBOX
@ WWT_SHADEBOX
Shade box (at top-right of a window, between WWT_DEBUGBOX and WWT_DEFSIZEBOX)
Definition widget_type.h:55
WWT_CAPTION
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition widget_type.h:52
NWID_VERTICAL
@ NWID_VERTICAL
Vertical container.
Definition widget_type.h:68
WWT_CLOSEBOX
@ WWT_CLOSEBOX
Close box (at top-left of a window)
Definition widget_type.h:60
WWT_EMPTY
@ WWT_EMPTY
Empty widget, place holder to reserve space in widget tree.
Definition widget_type.h:37
WWT_DEFSIZEBOX
@ WWT_DEFSIZEBOX
Default window size box (at top-right of a window, between WWT_SHADEBOX and WWT_STICKYBOX)
Definition widget_type.h:56

Nested widget definition for the build NewGRF rail waypoint window.

Definition at line 1817 of file town_gui.cpp.

## ◆ _nested_found_town_widgets

constexpr std::initializer_list<NWidgetPart> _nested_found_town_widgets
| staticconstexpr

Definition at line 1071 of file town_gui.cpp.

## ◆ _nested_town_authority_widgets

constexpr std::initializer_list<NWidgetPart> _nested_town_authority_widgets
| staticconstexpr

Initial value:
= {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
NWidget(WWT_CAPTION, COLOUR_BROWN, WID_TA_CAPTION),
NWidget(WWT_TEXTBTN, COLOUR_BROWN, WID_TA_ZONE_BUTTON), SetMinimalSize(50, 0), SetStringTip(STR_LOCAL_AUTHORITY_ZONE, STR_LOCAL_AUTHORITY_ZONE_TOOLTIP),
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
NWidget(WWT_DEFSIZEBOX, COLOUR_BROWN),
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_BROWN, WID_TA_RATING_INFO), SetMinimalSize(317, 92), SetResize(1, 1), EndContainer(),
NWidget(WWT_PANEL, COLOUR_BROWN, WID_TA_COMMAND_LIST), SetMinimalSize(317, 52), SetResize(1, 0), SetToolTip(STR_LOCAL_AUTHORITY_ACTIONS_TOOLTIP), EndContainer(),
NWidget(WWT_PANEL, COLOUR_BROWN, WID_TA_ACTION_INFO), SetMinimalSize(317, 52), SetResize(1, 0), EndContainer(),
NWidget(NWID_HORIZONTAL),
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),
NWidget(WWT_RESIZEBOX, COLOUR_BROWN),
EndContainer()
}
SetToolTip
constexpr NWidgetPart SetToolTip(StringID tip)
Widget part function for setting tooltip and clearing the widget data.
Definition widget_type.h:1321
SetResize
constexpr NWidgetPart SetResize(int16_t dx, int16_t dy)
Widget part function for setting the resize step.
Definition widget_type.h:1148
WID_TA_EXECUTE
@ WID_TA_EXECUTE
Do-it button.
Definition town_widget.h:32
WID_TA_ACTION_INFO
@ WID_TA_ACTION_INFO
Additional information about the action.
Definition town_widget.h:31
WID_TA_RATING_INFO
@ WID_TA_RATING_INFO
Overview with ratings for each company.
Definition town_widget.h:28
WID_TA_CAPTION
@ WID_TA_CAPTION
Caption of window.
Definition town_widget.h:26
WID_TA_ZONE_BUTTON
@ WID_TA_ZONE_BUTTON
Turn on/off showing local authority zone.
Definition town_widget.h:27
WID_TA_COMMAND_LIST
@ WID_TA_COMMAND_LIST
List of commands for the player.
Definition town_widget.h:29
WWT_PUSHTXTBTN
@ WWT_PUSHTXTBTN
Normal push-button (no toggle button) with text caption.
Definition widget_type.h:105
WWT_RESIZEBOX
@ WWT_RESIZEBOX
Resize box (normally at bottom-right of a window)
Definition widget_type.h:59

Definition at line 61 of file town_gui.cpp.

## ◆ _nested_town_directory_widgets

constexpr std::initializer_list<NWidgetPart> _nested_town_directory_widgets
| staticconstexpr

Initial value:
= {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
NWidget(WWT_CAPTION, COLOUR_BROWN, WID_TD_CAPTION),
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
NWidget(WWT_DEFSIZEBOX, COLOUR_BROWN),
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(NWID_VERTICAL),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_TEXTBTN, COLOUR_BROWN, WID_TD_SORT_ORDER), SetStringTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER),
NWidget(WWT_DROPDOWN, COLOUR_BROWN, WID_TD_SORT_CRITERIA), SetToolTip(STR_TOOLTIP_SORT_CRITERIA),
NWidget(WWT_EDITBOX, COLOUR_BROWN, WID_TD_FILTER), SetFill(1, 0), SetResize(1, 0), SetStringTip(STR_LIST_FILTER_OSKTITLE, STR_LIST_FILTER_TOOLTIP),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_BROWN, WID_TD_LIST), SetToolTip(STR_TOWN_DIRECTORY_LIST_TOOLTIP),
SetFill(1, 0), SetResize(1, 1), SetScrollbar(WID_TD_SCROLLBAR), EndContainer(),
NWidget(WWT_PANEL, COLOUR_BROWN),
NWidget(WWT_TEXT, INVALID_COLOUR, WID_TD_WORLD_POPULATION), SetPadding(2, 0, 2, 2), SetFill(1, 0), SetResize(1, 0),
EndContainer(),
EndContainer(),
NWidget(NWID_VERTICAL),
NWidget(NWID_VSCROLLBAR, COLOUR_BROWN, WID_TD_SCROLLBAR),
NWidget(WWT_RESIZEBOX, COLOUR_BROWN),
EndContainer(),
EndContainer(),
}
SetScrollbar
constexpr NWidgetPart SetScrollbar(WidgetID index)
Attach a scrollbar to a widget.
Definition widget_type.h:1402
WID_TD_LIST
@ WID_TD_LIST
List of towns.
Definition town_widget.h:19
WID_TD_CAPTION
@ WID_TD_CAPTION
Caption of the window.
Definition town_widget.h:15
WID_TD_FILTER
@ WID_TD_FILTER
Filter of name.
Definition town_widget.h:18
WID_TD_SORT_ORDER
@ WID_TD_SORT_ORDER
Direction of sort dropdown.
Definition town_widget.h:16
WID_TD_WORLD_POPULATION
@ WID_TD_WORLD_POPULATION
The world's population.
Definition town_widget.h:21
WID_TD_SCROLLBAR
@ WID_TD_SCROLLBAR
Scrollbar for the town list.
Definition town_widget.h:20
WID_TD_SORT_CRITERIA
@ WID_TD_SORT_CRITERIA
Criteria of sort dropdown.
Definition town_widget.h:17
WWT_EDITBOX
@ WWT_EDITBOX
a textbox for typing
Definition widget_type.h:62
NWID_VSCROLLBAR
@ NWID_VSCROLLBAR
Vertical scrollbar.
Definition widget_type.h:76
WWT_DROPDOWN
@ WWT_DROPDOWN
Drop down list.
Definition widget_type.h:61
WWT_TEXT
@ WWT_TEXT
Pure simple text.
Definition widget_type.h:49

Definition at line 689 of file town_gui.cpp.

## ◆ _nested_town_editor_view_widgets

constexpr std::initializer_list<NWidgetPart> _nested_town_editor_view_widgets
| staticconstexpr

Initial value:
= {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
NWidget(WWT_PUSHIMGBTN, COLOUR_BROWN, WID_TV_CHANGE_NAME), SetAspect(WidgetDimensions::ASPECT_RENAME), SetSpriteTip(SPR_RENAME, STR_TOWN_VIEW_RENAME_TOOLTIP),
NWidget(WWT_CAPTION, COLOUR_BROWN, WID_TV_CAPTION), SetToolTip(STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
NWidget(WWT_PUSHIMGBTN, COLOUR_BROWN, WID_TV_CENTER_VIEW), SetAspect(WidgetDimensions::ASPECT_LOCATION), SetSpriteTip(SPR_GOTO_LOCATION, STR_TOWN_VIEW_CENTER_TOOLTIP),
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
NWidget(WWT_DEFSIZEBOX, COLOUR_BROWN),
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_BROWN),
NWidget(WWT_INSET, COLOUR_BROWN), SetPadding(2, 2, 2, 2),
NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_TV_VIEWPORT), SetMinimalSize(254, 86), SetFill(1, 1), SetResize(1, 1),
EndContainer(),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_BROWN, WID_TV_INFO), SetMinimalSize(260, 32), SetResize(1, 0), SetFill(1, 0), EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_TV_EXPAND), SetFill(1, 1), SetResize(1, 0), SetStringTip(STR_TOWN_VIEW_EXPAND_BUTTON, STR_TOWN_VIEW_EXPAND_TOOLTIP),
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_TV_EXPAND_BUILDINGS), SetFill(1, 1), SetResize(1, 0), SetStringTip(STR_TOWN_VIEW_EXPAND_BUILDINGS_BUTTON, STR_TOWN_VIEW_EXPAND_BUILDINGS_TOOLTIP),
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_TV_EXPAND_ROADS), SetFill(1, 1), SetResize(1, 0), SetStringTip(STR_TOWN_VIEW_EXPAND_ROADS_BUTTON, STR_TOWN_VIEW_EXPAND_ROADS_TOOLTIP),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_TV_DELETE), SetFill(1, 1), SetResize(1, 0), SetStringTip(STR_TOWN_VIEW_DELETE_BUTTON, STR_TOWN_VIEW_DELETE_TOOLTIP),
NWidget(WWT_TEXTBTN, COLOUR_BROWN, WID_TV_CATCHMENT), SetFill(1, 1), SetResize(1, 0), SetStringTip(STR_BUTTON_CATCHMENT, STR_TOOLTIP_CATCHMENT),
NWidget(WWT_RESIZEBOX, COLOUR_BROWN),
EndContainer(),
}
SetSpriteTip
constexpr NWidgetPart SetSpriteTip(SpriteID sprite, StringID tip={})
Widget part function for setting the sprite and tooltip.
Definition widget_type.h:1254
SetAspect
constexpr NWidgetPart SetAspect(float ratio, AspectFlags flags=AspectFlag::ResizeX)
Widget part function for setting the aspect ratio.
Definition widget_type.h:1413
WID_TV_VIEWPORT
@ WID_TV_VIEWPORT
View of the center of the town.
Definition town_widget.h:38
WID_TV_EXPAND_BUILDINGS
@ WID_TV_EXPAND_BUILDINGS
Expand number of buildings this town (scenario editor only).
Definition town_widget.h:45
WID_TV_INFO
@ WID_TV_INFO
General information about the town.
Definition town_widget.h:39
WID_TV_EXPAND
@ WID_TV_EXPAND
Expand this town (scenario editor only).
Definition town_widget.h:44
WID_TV_CATCHMENT
@ WID_TV_CATCHMENT
Toggle catchment area highlight.
Definition town_widget.h:43
WID_TV_CHANGE_NAME
@ WID_TV_CHANGE_NAME
Change the name of this town.
Definition town_widget.h:42
WID_TV_CENTER_VIEW
@ WID_TV_CENTER_VIEW
Center the main view on this town.
Definition town_widget.h:40
WID_TV_DELETE
@ WID_TV_DELETE
Delete this town (scenario editor only).
Definition town_widget.h:47
WID_TV_EXPAND_ROADS
@ WID_TV_EXPAND_ROADS
Expand roads of this town (scenario editor only).
Definition town_widget.h:46
WID_TV_CAPTION
@ WID_TV_CAPTION
Caption of window.
Definition town_widget.h:37
WWT_INSET
@ WWT_INSET
Pressed (inset) panel, most commonly used as combo box text area.
Definition widget_type.h:40
WWT_PUSHIMGBTN
@ WWT_PUSHIMGBTN
Normal push-button (no toggle button) with image caption.
Definition widget_type.h:106
NWID_VIEWPORT
@ NWID_VIEWPORT
Nested widget containing a viewport.
Definition widget_type.h:73

Definition at line 645 of file town_gui.cpp.

## ◆ _nested_town_game_view_widgets

constexpr std::initializer_list<NWidgetPart> _nested_town_game_view_widgets
| staticconstexpr

Initial value:
= {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
NWidget(WWT_PUSHIMGBTN, COLOUR_BROWN, WID_TV_CHANGE_NAME), SetAspect(WidgetDimensions::ASPECT_RENAME), SetSpriteTip(SPR_RENAME, STR_TOWN_VIEW_RENAME_TOOLTIP),
NWidget(WWT_CAPTION, COLOUR_BROWN, WID_TV_CAPTION),
NWidget(WWT_PUSHIMGBTN, COLOUR_BROWN, WID_TV_CENTER_VIEW), SetAspect(WidgetDimensions::ASPECT_LOCATION), SetSpriteTip(SPR_GOTO_LOCATION, STR_TOWN_VIEW_CENTER_TOOLTIP),
NWidget(WWT_SHADEBOX, COLOUR_BROWN),
NWidget(WWT_DEFSIZEBOX, COLOUR_BROWN),
NWidget(WWT_STICKYBOX, COLOUR_BROWN),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_BROWN),
NWidget(WWT_INSET, COLOUR_BROWN), SetPadding(2, 2, 2, 2),
NWidget(NWID_VIEWPORT, INVALID_COLOUR, WID_TV_VIEWPORT), SetMinimalSize(254, 86), SetFill(1, 0), SetResize(1, 1),
EndContainer(),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_BROWN, WID_TV_INFO), SetMinimalSize(260, 32), SetResize(1, 0), SetFill(1, 0), EndContainer(),
NWidget(NWID_HORIZONTAL, NWidContainerFlag::EqualSize),
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),
NWidget(WWT_TEXTBTN, COLOUR_BROWN, WID_TV_CATCHMENT), SetMinimalSize(40, 12), SetFill(1, 1), SetResize(1, 0), SetStringTip(STR_BUTTON_CATCHMENT, STR_TOOLTIP_CATCHMENT),
NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, WID_TV_GRAPH), SetFill(1, 0), SetResize(1, 0), SetStringTip(STR_TOWN_VIEW_CARGO_GRAPH, STR_TOWN_VIEW_CARGO_GRAPH_TOOLTIP),
NWidget(WWT_RESIZEBOX, COLOUR_BROWN),
EndContainer(),
}
WID_TV_SHOW_AUTHORITY
@ WID_TV_SHOW_AUTHORITY
Show the town authority window.
Definition town_widget.h:41
EqualSize
@ EqualSize
Containers should keep all their (resizing) children equally large.
Definition widget_type.h:544

Definition at line 614 of file town_gui.cpp.

## ◆ _town_local_authority_kdtree

TownKdtree _town_local_authority_kdtree {}

Definition at line 57 of file town_gui.cpp.