# town_gui.cpp File Reference

GUI for towns. More...

`#include "stdafx.h"`
`#include "openttd.h"`
`#include "town.h"`
`#include "viewport_func.h"`
`#include "gfx_func.h"`
`#include "gui.h"`
`#include "command_func.h"`
`#include "company_func.h"`
`#include "company_base.h"`
`#include "company_gui.h"`
`#include "network/network.h"`
`#include "variables.h"`
`#include "strings_func.h"`
`#include "sound_func.h"`
`#include "economy_func.h"`
`#include "tilehighlight_func.h"`
`#include "sortlist_type.h"`
`#include "road_cmd.h"`
`#include "landscape.h"`
`#include "cargotype.h"`
`#include "querystring_gui.h"`
`#include "window_func.h"`
`#include "townname_func.h"`
`#include "townname_type.h"`
`#include "core/geometry_func.hpp"`
`#include "table/sprites.h"`
`#include "table/strings.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...
## Typedefs
typedef GUIList< const Town * > | GUITownList
## Enumerations
enum | TownAuthorityWidgets { TWA_CAPTION, TWA_RATING_INFO, TWA_COMMAND_LIST, TWA_SCROLLBAR, TWA_ACTION_INFO, TWA_EXECUTE }
| Widget numbers of the town authority window. More...
enum | TownViewWidgets { TVW_CAPTION, TVW_VIEWPORT, TVW_INFOPANEL, TVW_CENTERVIEW, TVW_SHOWAUTHORITY, TVW_CHANGENAME, TVW_EXPAND, TVW_DELETE }
| Widget numbers of the town view window. More...
enum | TownDirectoryWidgets { TDW_SORTNAME, TDW_SORTPOPULATION, TDW_CENTERTOWN, TDW_SCROLLBAR, TDW_BOTTOM_PANEL, TDW_BOTTOM_TEXT }
| Widget numbers of town directory window. More...
enum | TownScenarioEditorWidgets { TSEW_BACKGROUND, TSEW_NEWTOWN, TSEW_RANDOMTOWN, TSEW_MANYRANDOMTOWNS, TSEW_TOWNNAME_TEXT, TSEW_TOWNNAME_EDITBOX, TSEW_TOWNNAME_RANDOM, TSEW_TOWNSIZE, TSEW_SIZE_SMALL, TSEW_SIZE_MEDIUM, TSEW_SIZE_LARGE, TSEW_SIZE_RANDOM, TSEW_CITY, TSEW_TOWNLAYOUT, TSEW_LAYOUT_ORIGINAL, TSEW_LAYOUT_BETTER, TSEW_LAYOUT_GRID2, TSEW_LAYOUT_GRID3, TSEW_LAYOUT_RANDOM }
| Widget numbers of town scenario editor window. More...
## Functions
static void | ShowTownAuthorityWindow (uint town)
void | ShowTownViewWindow (TownID town)
void | ShowTownDirectory ()
void | CcFoundTown (const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
void | CcFoundRandomTown (const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
void | ShowFoundTownWindow ()
## Variables
static const NWidgetPart | _nested_town_authority_widgets []
static const WindowDesc | _town_authority_desc (WDP_AUTO, 317, 222, WC_TOWN_AUTHORITY, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_town_authority_widgets, lengthof(_nested_town_authority_widgets))
static const NWidgetPart | _nested_town_game_view_widgets []
static const WindowDesc | _town_game_view_desc (WDP_AUTO, 260, TownViewWindow::TVW_HEIGHT_NORMAL, WC_TOWN_VIEW, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_town_game_view_widgets, lengthof(_nested_town_game_view_widgets))
static const NWidgetPart | _nested_town_editor_view_widgets []
static const WindowDesc | _town_editor_view_desc (WDP_AUTO, 260, TownViewWindow::TVW_HEIGHT_NORMAL, WC_TOWN_VIEW, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_town_editor_view_widgets, lengthof(_nested_town_editor_view_widgets))
static const NWidgetPart | _nested_town_directory_widgets []
static const WindowDesc | _town_directory_desc (WDP_AUTO, 208, 202, WC_TOWN_DIRECTORY, WC_NONE, WDF_UNCLICK_BUTTONS, _nested_town_directory_widgets, lengthof(_nested_town_directory_widgets))
static const NWidgetPart | _nested_found_town_widgets []
static const WindowDesc | _found_town_desc (WDP_AUTO, 160, 162, WC_FOUND_TOWN, WC_NONE, WDF_CONSTRUCTION, _nested_found_town_widgets, lengthof(_nested_found_town_widgets))

## Detailed Description

GUI for towns.

Definition in file town_gui.cpp.

## Enumeration Type Documentation

enum TownAuthorityWidgets

Widget numbers of the town authority window.

Enumerator:

  TWA_RATING_INFO | Overview with ratings for each company.
  TWA_COMMAND_LIST | List of commands for the player.
  TWA_ACTION_INFO | Additional information about the action.
  TWA_EXECUTE | Do-it button.

Definition at line 44 of file town_gui.cpp.

enum TownDirectoryWidgets

Widget numbers of town directory window.

Definition at line 602 of file town_gui.cpp.

enum TownScenarioEditorWidgets

Widget numbers of town scenario editor window.

Definition at line 899 of file town_gui.cpp.

enum TownViewWidgets

Widget numbers of the town view window.

Definition at line 296 of file town_gui.cpp.

## Variable Documentation

const NWidgetPart _nested_town_authority_widgets[]`[static]`

Initial value:

     {
      NWidget(NWID_HORIZONTAL),
        NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
        NWidget(WWT_CAPTION, COLOUR_BROWN, TWA_CAPTION), SetDataTip(STR_LOCAL_AUTHORITY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
        NWidget(WWT_SHADEBOX, COLOUR_BROWN),
        NWidget(WWT_STICKYBOX, COLOUR_BROWN),
      EndContainer(),
      NWidget(WWT_PANEL, COLOUR_BROWN, TWA_RATING_INFO), SetMinimalSize(317, 92), SetResize(1, 1), EndContainer(),
      NWidget(NWID_HORIZONTAL),
        NWidget(WWT_PANEL, COLOUR_BROWN, TWA_COMMAND_LIST), SetMinimalSize(305, 52), SetResize(1, 0), SetDataTip(0x0, STR_LOCAL_AUTHORITY_ACTIONS_TOOLTIP), EndContainer(),
        NWidget(WWT_SCROLLBAR, COLOUR_BROWN, TWA_SCROLLBAR),
      EndContainer(),
      NWidget(WWT_PANEL, COLOUR_BROWN, TWA_ACTION_INFO), SetMinimalSize(317, 52), SetResize(1, 0), EndContainer(),
      NWidget(NWID_HORIZONTAL),
        NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, TWA_EXECUTE),  SetMinimalSize(317, 12), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_LOCAL_AUTHORITY_DO_IT_BUTTON, STR_LOCAL_AUTHORITY_DO_IT_TOOLTIP),
        NWidget(WWT_RESIZEBOX, COLOUR_BROWN),
      EndContainer()
    }

Definition at line 53 of file town_gui.cpp.

const NWidgetPart _nested_town_directory_widgets[]`[static]`

Initial value:

     {
      NWidget(NWID_HORIZONTAL),
        NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
        NWidget(WWT_CAPTION, COLOUR_BROWN), SetDataTip(STR_TOWN_DIRECTORY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
        NWidget(WWT_SHADEBOX, COLOUR_BROWN),
        NWidget(WWT_STICKYBOX, COLOUR_BROWN),
      EndContainer(),
      NWidget(NWID_HORIZONTAL),
        NWidget(NWID_VERTICAL),
          NWidget(NWID_HORIZONTAL),
            NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, TDW_SORTNAME), SetMinimalSize(99, 12), SetDataTip(STR_SORT_BY_CAPTION_NAME, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0),
            NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, TDW_SORTPOPULATION), SetMinimalSize(97, 12), SetDataTip(STR_SORT_BY_CAPTION_POPULATION, STR_TOOLTIP_SORT_ORDER), SetFill(1, 0),
          EndContainer(),
          NWidget(WWT_PANEL, COLOUR_BROWN, TDW_CENTERTOWN), SetMinimalSize(196, 164), SetDataTip(0x0, STR_TOWN_DIRECTORY_LIST_TOOLTIP),
                  SetFill(1, 0), SetResize(0, 10), EndContainer(),
          NWidget(WWT_PANEL, COLOUR_BROWN, TDW_BOTTOM_PANEL),
            NWidget(WWT_TEXT, COLOUR_BROWN, TDW_BOTTOM_TEXT), SetPadding(2, 0, 0, 2), SetMinimalSize(196, 12), SetFill(1, 0), SetDataTip(STR_TOWN_POPULATION, STR_NULL),
          EndContainer(),
        EndContainer(),
        NWidget(NWID_VERTICAL),
          NWidget(WWT_SCROLLBAR, COLOUR_BROWN, TDW_SCROLLBAR),
          NWidget(WWT_RESIZEBOX, COLOUR_BROWN),
        EndContainer(),
      EndContainer(),
    }

Definition at line 611 of file town_gui.cpp.

const NWidgetPart _nested_town_editor_view_widgets[]`[static]`

Initial value:

     {
      NWidget(NWID_HORIZONTAL),
        NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
        NWidget(WWT_CAPTION, COLOUR_BROWN, TVW_CAPTION), SetDataTip(STR_TOWN_VIEW_TOWN_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
        NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, TVW_CHANGENAME), SetMinimalSize(76, 14), SetDataTip(STR_BUTTON_RENAME, STR_TOWN_VIEW_RENAME_TOOLTIP),
        NWidget(WWT_SHADEBOX, 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, TVW_VIEWPORT), SetMinimalSize(254, 86), SetFill(1, 1), SetResize(1, 1), SetPadding(1, 1, 1, 1),
        EndContainer(),
      EndContainer(),
      NWidget(WWT_PANEL, COLOUR_BROWN, TVW_INFOPANEL), SetMinimalSize(260, 32), SetResize(1, 0), SetFill(1, 0), EndContainer(),
      NWidget(NWID_HORIZONTAL),
        NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
          NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, TVW_CENTERVIEW), SetMinimalSize(80, 12), SetFill(1, 1), SetResize(1, 0), SetDataTip(STR_BUTTON_LOCATION, STR_TOWN_VIEW_CENTER_TOOLTIP),
          NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, TVW_EXPAND), SetMinimalSize(80, 12), SetFill(1, 1), SetResize(1, 0), SetDataTip(STR_TOWN_VIEW_EXPAND_BUTTON, STR_TOWN_VIEW_EXPAND_TOOLTIP),
          NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, TVW_DELETE), SetMinimalSize(80, 12), SetFill(1, 1), SetResize(1, 0), SetDataTip(STR_TOWN_VIEW_DELETE_BUTTON, STR_TOWN_VIEW_DELETE_TOOLTIP),
        EndContainer(),
        NWidget(WWT_RESIZEBOX, COLOUR_BROWN),
      EndContainer(),
    }

Definition at line 561 of file town_gui.cpp.

const NWidgetPart _nested_town_game_view_widgets[]`[static]`

Initial value:

     {
      NWidget(NWID_HORIZONTAL),
        NWidget(WWT_CLOSEBOX, COLOUR_BROWN),
        NWidget(WWT_CAPTION, COLOUR_BROWN, TVW_CAPTION), SetDataTip(STR_TOWN_VIEW_TOWN_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
        NWidget(WWT_SHADEBOX, 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, TVW_VIEWPORT), SetMinimalSize(254, 86), SetFill(1, 0), SetResize(1, 1), SetPadding(1, 1, 1, 1),
        EndContainer(),
      EndContainer(),
      NWidget(WWT_PANEL, COLOUR_BROWN, TVW_INFOPANEL), SetMinimalSize(260, 32), SetResize(1, 0), SetFill(1, 0), EndContainer(),
      NWidget(NWID_HORIZONTAL),
        NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
          NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, TVW_CENTERVIEW), SetMinimalSize(80, 12), SetFill(1, 1), SetResize(1, 0), SetDataTip(STR_BUTTON_LOCATION, STR_TOWN_VIEW_CENTER_TOOLTIP),
          NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, TVW_SHOWAUTHORITY), SetMinimalSize(80, 12), SetFill(1, 1), SetResize(1, 0), SetDataTip(STR_TOWN_VIEW_LOCAL_AUTHORITY_BUTTON, STR_TOWN_VIEW_LOCAL_AUTHORITY_TOOLTIP),
          NWidget(WWT_PUSHTXTBTN, COLOUR_BROWN, TVW_CHANGENAME), SetMinimalSize(80, 12), SetFill(1, 1), SetResize(1, 0), SetDataTip(STR_BUTTON_RENAME, STR_TOWN_VIEW_RENAME_TOOLTIP),
        EndContainer(),
        NWidget(WWT_RESIZEBOX, COLOUR_BROWN),
      EndContainer(),
    }

Definition at line 531 of file town_gui.cpp.