OpenTTD Source: src/gui.h File Reference

OpenTTD Source 15.0-beta1

Functions
gui.h File Reference

GUI functions that shouldn't be here. More...

`#include "vehicle_type.h"`
`#include "economy_type.h"`
`#include "tile_type.h"`
`#include "transport_type.h"`
`#include "story_type.h"`
`#include "company_type.h"`

Go to the source code of this file.

## Functions
void | InitializeGUI ()
void | ShowGameOptions ()
| Open the game options window.
void | ShowGameSettings ()
| Open advanced settings window.
void | ShowOrdersWindow (const Vehicle *v)
Window * | ShowBuildDocksToolbar ()
| Open the build water toolbar window.
Window * | ShowBuildDocksScenToolbar ()
| Open the build water toolbar window for the scenario editor.
Window * | ShowBuildAirToolbar ()
| Open the build airport toolbar window.
void | ShowGenerateLandscape ()
| Start with a normal game.
void | ShowHeightmapLoad ()
| Start with loading a heightmap.
void | ShowLandInfo (TileIndex tile)
| Show land information window.
void | ShowAboutWindow ()
void | ShowEstimatedCostOrIncome (Money cost, int x, int y)
| Display estimated costs.
void | ShowBuildTreesToolbar ()
void | ShowTownDirectory ()
void | ShowFoundTownWindow ()
void | ShowIndustryDirectory ()
void | ShowIndustryCargoesWindow ()
| Open the industry and cargoes window with an industry.
void | ShowBuildIndustryWindow ()
void | ShowSubsidiesList ()
void | ShowGoalsList (CompanyID company)
| Open a goal list window.
void | ShowGoalQuestion (uint16_t id, uint8_t type, uint32_t button_mask, const std::string &question)
| Display a goal question.
void | ShowStoryBook (CompanyID company, uint16_t page_id=INVALID_STORY_PAGE, bool centered=false)
| Raise or create the story book window for company, at page page_id.
void | ShowExtraViewportWindow (TileIndex tile=INVALID_TILE)
| Show a new Extra Viewport window.
void | ShowExtraViewportWindowForTileUnderCursor ()
| Show a new Extra Viewport window.
void | ShowBuildBridgeWindow (TileIndex start, TileIndex end, TransportType transport_type, uint8_t bridge_type)
| Prepare the data for the build a bridge window.
void | ShowMusicWindow ()

## Detailed Description

GUI functions that shouldn't be here.

Definition in file gui.h.

## Function Documentation

## ◆ InitializeGUI()

void InitializeGUI | ( |  | ) |

Definition at line 1573 of file vehicle_gui.cpp.

## ◆ ShowAboutWindow()

void ShowAboutWindow | ( |  | ) |

Definition at line 519 of file misc_gui.cpp.

## ◆ ShowBuildAirToolbar()

Window * ShowBuildAirToolbar | ( |  | ) |

Open the build airport toolbar window.

If the terraform toolbar is linked to the toolbar, that window is also opened.

Returns
  newly opened airport toolbar, or nullptr if the toolbar could not be opened.

Definition at line 226 of file airport_gui.cpp.

References _local_company, CloseWindowByClass(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), TRANSPORT_AIR, and WC_BUILD_TOOLBAR.

Referenced by BuildAirToolbarWindow::AirportToolbarGlobalHotkeys(), MenuClickBuildAir(), and MainToolbarWindow::OnHotkey().

## ◆ ShowBuildBridgeWindow()

void ShowBuildBridgeWindow | ( | TileIndex | start,
|  | TileIndex | end,
|  | TransportType | transport_type,
|  | uint8_t | road_rail_type
| ) |  |

Prepare the data for the build a bridge window.

If we can't build a bridge under the given conditions show an error message.

Parameters

  start | The start tile of the bridge
  end | The end tile of the bridge
  transport_type | The transport type
  road_rail_type | The road/rail type

Definition at line 354 of file bridge_gui.cpp.

References _build_bridge_desc, _ctrl_pressed, _last_railbridge_type, _last_roadbridge_type, CalcBridgeLenCostFactor(), CcBuildBridge(), CheckBridgeAvailability(), CloseWindowByClass(), CommandFlagsToDCFlags(), DC_QUERY_COST, CommandCost::Failed(), GetBridgeSpec(), CommandCost::GetCost(), CommandCost::GetErrorMessage(), GetTunnelBridgeLength(), INVALID_ROADTYPE, INVALID_STRING_ID, IsBridgeTile(), MAX_BRIDGES, BridgeSpec::price, RailBuildCost(), RoadBuildCost(), ShowErrorMessage(), CommandCost::Succeeded(), TILE_SIZE, TileX(), TileY(), TRANSPORT_RAIL, TRANSPORT_ROAD, WC_BUILD_BRIDGE, and WL_INFO.

Referenced by BuildRailToolbarWindow::OnPlaceMouseUp(), and BuildRoadToolbarWindow::OnPlaceMouseUp().

## ◆ ShowBuildDocksScenToolbar()

Window * ShowBuildDocksScenToolbar | ( |  | ) |

Open the build water toolbar window for the scenario editor.

Returns
  newly opened water toolbar, or nullptr if the toolbar could not be opened.

Definition at line 403 of file dock_gui.cpp.

References _build_docks_scen_toolbar_desc, and TRANSPORT_WATER.

## ◆ ShowBuildDocksToolbar()

Window * ShowBuildDocksToolbar | ( |  | ) |

Open the build water toolbar window.

If the terraform toolbar is linked to the toolbar, that window is also opened.

Returns
  newly opened water toolbar, or nullptr if the toolbar could not be opened.

Definition at line 362 of file dock_gui.cpp.

References _local_company, CloseWindowByClass(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), TRANSPORT_WATER, and WC_BUILD_TOOLBAR.

Referenced by BuildDocksToolbarWindow::DockToolbarGlobalHotkeys(), MenuClickBuildWater(), and MainToolbarWindow::OnHotkey().

## ◆ ShowBuildIndustryWindow()

void ShowBuildIndustryWindow | ( |  | ) |

Definition at line 771 of file industry_gui.cpp.

## ◆ ShowBuildTreesToolbar()

void ShowBuildTreesToolbar | ( |  | ) |

Definition at line 320 of file tree_gui.cpp.

## ◆ ShowEstimatedCostOrIncome()

void ShowEstimatedCostOrIncome | ( | Money | cost,
|  | int | x,
|  | int | y
| ) |  |

Display estimated costs.

Parameters

  cost | Estimated cost (or income if negative).
  x | X position of the notification window.
  y | Y position of the notification window.

Definition at line 531 of file misc_gui.cpp.

References INVALID_STRING_ID, SetDParam(), ShowErrorMessage(), and WL_INFO.

Referenced by CommandHelperBase::InternalPostResult().

## ◆ ShowExtraViewportWindow()

void ShowExtraViewportWindow | ( | TileIndex | tile | ) |

Show a new Extra Viewport window.

Parameters

  tile | Tile to center the view on. INVALID_TILE means to use the center of main viewport.

Definition at line 156 of file viewport_gui.cpp.

References FindWindowById(), and WC_EXTRA_VIEWPORT.

Referenced by GoalListWindow::HandleClick(), MenuClickMap(), CompanyWindow::OnClick(), DepotWindow::OnClick(), IndustryViewWindow::OnClick(), IndustryDirectoryWindow::OnClick(), LandInfoWindow::OnClick(), NewsWindow::OnClick(), SignWindow::OnClick(), CompanyStationsWindow::OnClick(), StationViewWindow::OnClick(), TownViewWindow::OnClick(), TownDirectoryWindow::OnClick(), VehicleViewWindow::OnClick(), WaypointWindow::OnClick(), StoryBookWindow::OnPageElementClick(), and ShowExtraViewportWindowForTileUnderCursor().

## ◆ ShowExtraViewportWindowForTileUnderCursor()

void ShowExtraViewportWindowForTileUnderCursor | ( |  | ) |

Show a new Extra Viewport window.

Center it on the tile under the cursor, if the cursor is inside a viewport. If that fails, center it on main viewport center.

Definition at line 171 of file viewport_gui.cpp.

References INVALID_TILE, ShowExtraViewportWindow(), and TileVirtXY().

Referenced by MainToolbarWindow::OnHotkey(), and ScenarioEditorToolbarWindow::OnHotkey().

## ◆ ShowFoundTownWindow()

void ShowFoundTownWindow | ( |  | ) |

Definition at line 1348 of file town_gui.cpp.

## ◆ ShowGameOptions()

void ShowGameOptions | ( |  | ) |

Open the game options window.

Definition at line 1200 of file settings_gui.cpp.

References CloseWindowByClass(), and WC_GAME_OPTIONS.

Referenced by MenuClickSettings(), SelectGameWindow::OnClick(), MainToolbarWindow::OnHotkey(), and ScenarioEditorToolbarWindow::OnHotkey().

## ◆ ShowGameSettings()

void ShowGameSettings | ( |  | ) |

Open advanced settings window.

Definition at line 2911 of file settings_gui.cpp.

References CloseWindowByClass(), and WC_GAME_OPTIONS.

Referenced by MenuClickSettings(), and SelectGameWindow::OnClick().

## ◆ ShowGenerateLandscape()

void ShowGenerateLandscape | ( |  | ) |

Start with a normal game.

Definition at line 1045 of file genworld_gui.cpp.

References GLWM_GENERATE.

Referenced by CreateScenarioWindow::OnClick(), SelectGameWindow::OnClick(), and NetworkStartServerWindow::OnClick().

## ◆ ShowGoalQuestion()

void ShowGoalQuestion | ( | uint16_t | id,
|  | uint8_t | type,
|  | uint32_t | button_mask,
|  | const std::string & | question
| ) |  |

Display a goal question.

Parameters

  id | Window number to use.
  type | Type of question.
  button_mask | Buttons to display.
  question | Question to ask.

Definition at line 482 of file goal_gui.cpp.

Referenced by CmdGoalQuestion().

## ◆ ShowGoalsList()

void ShowGoalsList | ( | CompanyID | company | ) |

Open a goal list window.

Parameters

  company | Company to display the goals for, use INVALID_COMPANY to display global goals.

Definition at line 316 of file goal_gui.cpp.

References INVALID_COMPANY, and Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID().

Referenced by MenuClickGoal(), GoalListWindow::OnClick(), MainToolbarWindow::OnHotkey(), and StoryBookWindow::OnPageElementClick().

## ◆ ShowHeightmapLoad()

void ShowHeightmapLoad | ( |  | ) |

Start with loading a heightmap.

Definition at line 1051 of file genworld_gui.cpp.

References GLWM_HEIGHTMAP.

Referenced by SaveLoadWindow::OnClick().

## ◆ ShowIndustryCargoesWindow()

void ShowIndustryCargoesWindow | ( |  | ) |

Open the industry and cargoes window with an industry.

Definition at line 3235 of file industry_gui.cpp.

References NUM_INDUSTRYTYPES, and ShowIndustryCargoesWindow().

Referenced by MenuClickIndustry(), BuildIndustryWindow::OnClick(), IndustryViewWindow::OnClick(), and ShowIndustryCargoesWindow().

## ◆ ShowIndustryDirectory()

void ShowIndustryDirectory | ( |  | ) |

Definition at line 1950 of file industry_gui.cpp.

## ◆ ShowLandInfo()

void ShowLandInfo | ( | TileIndex | tile | ) |

Show land information window.

Parameters

  tile | The tile to show information about.

Definition at line 359 of file misc_gui.cpp.

References CloseWindowById(), and WC_LAND_INFO.

Referenced by MainToolbarWindow::OnPlaceObject(), and ScenarioEditorToolbarWindow::OnPlaceObject().

## ◆ ShowMusicWindow()

void ShowMusicWindow | ( |  | ) |

Definition at line 936 of file music_gui.cpp.

## ◆ ShowOrdersWindow()

void ShowOrdersWindow | ( | const Vehicle * | v | ) |

Definition at line 1793 of file order_gui.cpp.

## ◆ ShowStoryBook()

void ShowStoryBook | ( | CompanyID | company,
|  | uint16_t | page_id,
|  | bool | centered
| ) |  |

Raise or create the story book window for company, at page page_id.

Parameters

  company | 'Owner' of the story book, may be INVALID_COMPANY.
  page_id | Page to open, may be INVALID_STORY_PAGE.
  centered | Whether to open the window centered.

Definition at line 1051 of file story_gui.cpp.

References INVALID_COMPANY, INVALID_STORY_PAGE, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), and StoryBookWindow::SetSelectedPage().

Referenced by CmdShowStoryPage(), GoalListWindow::HandleClick(), MenuClickStory(), and MainToolbarWindow::OnHotkey().

## ◆ ShowSubsidiesList()

void ShowSubsidiesList | ( |  | ) |

Definition at line 278 of file subsidy_gui.cpp.

## ◆ ShowTownDirectory()

void ShowTownDirectory | ( |  | ) |

Definition at line 1084 of file town_gui.cpp.