OpenTTD Source 20241224-master-gee860a5c8e
|
Smallmap GUI functions. More...
#include "core/geometry_type.hpp"
#include "station_type.h"
#include "tile_type.h"
#include "window_type.h"
Go to the source code of this file.
Enumerations | |
enum class | IncludeHeightmap { Never , IfEnabled , Always } |
Enum for how to include the heightmap pixels/colours in small map related functions. More... | |
Functions | |
void | BuildLinkStatsLegend () |
Populate legend table for the link stat view. | |
void | BuildIndustriesLegend () |
Fills an array for the industries legends. | |
void | ShowSmallMap () |
Show the smallmap window. | |
void | BuildLandLegend () |
(Re)build the colour tables for the legends. | |
void | BuildOwnerLegend () |
Completes the array for the owned property legend. | |
uint32_t | GetSmallMapOwnerPixels (TileIndex tile, TileType t, IncludeHeightmap include_heightmap) |
Return the colour a tile would be displayed with in the small map in mode "Owner". | |
Point | GetSmallMapStationMiddle (const Window *w, const Station *st) |
Determine the middle of a station in the smallmap window. | |
Smallmap GUI functions.
Definition in file smallmap_gui.h.
|
strong |
Enum for how to include the heightmap pixels/colours in small map related functions.
Enumerator | |
---|---|
Never | Never include the heightmap. |
IfEnabled | Only include the heightmap if its enabled in the gui by the player. |
Always | Always include the heightmap. |
Definition at line 27 of file smallmap_gui.h.
void BuildIndustriesLegend | ( | ) |
Fills an array for the industries legends.
Definition at line 189 of file smallmap_gui.cpp.
References _industry_to_list_pos, _legend_from_industries, _smallmap_industry_count, _sorted_industry_types, LegendAndColour::col_break, LegendAndColour::colour, IndustrySpec::enabled, LegendAndColour::end, GetIndustrySpec(), LegendAndColour::legend, IndustrySpec::map_colour, IndustrySpec::name, LegendAndColour::show_on_map, and LegendAndColour::type.
Referenced by AfterLoadGRFs(), and ReadLanguagePack().
void BuildLandLegend | ( | ) |
(Re)build the colour tables for the legends.
Definition at line 290 of file smallmap_gui.cpp.
References _heightmap_schemes, _legend_land_contours, _settings_client, _settings_game, CeilDiv(), LegendAndColour::col_break, LegendAndColour::colour, GameSettings::construction, LegendAndColour::end, ClientSettings::gui, LegendAndColour::height, SmallMapColourScheme::height_colours, lengthof, ConstructionSettings::map_height_limit, MAX_TILE_HEIGHT, and GUISettings::smallmap_land_colour.
Referenced by SmallMapWindow::RebuildColourIndexIfNecessary(), and RedrawSmallmap().
void BuildLinkStatsLegend | ( | ) |
Populate legend table for the link stat view.
Definition at line 219 of file smallmap_gui.cpp.
References _legend_linkstats, _linkstat_colours_in_legenda, _settings_client, _smallmap_cargo_count, _sorted_cargo_specs, LegendAndColour::col_break, LegendAndColour::colour, LegendAndColour::end, ClientSettings::gui, CargoSpec::Index(), LegendAndColour::legend, lengthof, LinkGraphOverlay::LINK_COLOURS, GUISettings::linkgraph_colours, CargoSpec::name, LegendAndColour::show_on_map, and LegendAndColour::type.
Referenced by AfterLoadGRFs(), and UpdateLinkgraphColours().
void BuildOwnerLegend | ( | ) |
Completes the array for the owned property legend.
Definition at line 341 of file smallmap_gui.cpp.
References _company_to_list_pos, _heightmap_schemes, _settings_client, _smallmap_company_count, LegendAndColour::col_break, LegendAndColour::colour, LegendAndColour::company, SmallMapColourScheme::default_colour, LegendAndColour::end, GetColourGradient(), ClientSettings::gui, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Iterate(), NUM_NO_COMPANY_ENTRIES, LegendAndColour::show_on_map, and GUISettings::smallmap_land_colour.
Referenced by CmdSetCompanyColour(), DoStartupNewCompany(), InitializeWindowsAndCaches(), SmallMapWindow::OnInit(), SmallMapWindow::OnPaint(), and RedrawSmallmap().
uint32_t GetSmallMapOwnerPixels | ( | TileIndex | tile, |
TileType | t, | ||
IncludeHeightmap | include_heightmap | ||
) |
Return the colour a tile would be displayed with in the small map in mode "Owner".
tile | The tile of which we would like to get the colour. |
t | Effective tile type of the tile (see SmallMapWindow::GetTileColours). |
include_heightmap | Whether to return the heightmap/contour colour of this tile (instead of the default land tile colour) |
Definition at line 580 of file smallmap_gui.cpp.
References _company_to_list_pos, _heightmap_schemes, _settings_client, _smallmap_show_heightmap, Always, SmallMapColourScheme::default_colour, GetTileOwner(), ClientSettings::gui, SmallMapColourScheme::height_colours, IfEnabled, MAX_COMPANIES, MP_HOUSE, MP_INDUSTRY, MP_VOID, MP_WATER, OWNER_NONE, OWNER_TOWN, OWNER_WATER, PC_BLACK, PC_DARK_GREY, PC_DARK_RED, PC_WATER, GUISettings::smallmap_land_colour, and TileHeight().
Referenced by SmallMapWindow::GetTileColours().
Determine the middle of a station in the smallmap window.
st | The station we're looking for. |
Definition at line 2098 of file smallmap_gui.cpp.
Referenced by LinkGraphOverlay::GetStationMiddle().
void ShowSmallMap | ( | ) |
Show the smallmap window.
Definition at line 2064 of file smallmap_gui.cpp.
Referenced by MenuClickMap(), IndustryCargoesWindow::OnClick(), MainToolbarWindow::OnHotkey(), and ScenarioEditorToolbarWindow::OnHotkey().