OpenTTD Source: src/smallmap_gui.cpp File Reference

OpenTTD Source 15.3

Data Structures | Macros | Enumerations | Functions | Variables
smallmap_gui.cpp File Reference

GUI that shows a small map of the world with metadata like owner or height. More...

`#include "stdafx.h"`
`#include "core/backup_type.hpp"`
`#include "clear_map.h"`
`#include "industry.h"`
`#include "station_map.h"`
`#include "landscape.h"`
`#include "tree_map.h"`
`#include "viewport_func.h"`
`#include "town.h"`
`#include "tunnelbridge_map.h"`
`#include "core/endian_func.hpp"`
`#include "vehicle_base.h"`
`#include "sound_func.h"`
`#include "window_func.h"`
`#include "company_base.h"`
`#include "zoom_func.h"`
`#include "strings_func.h"`
`#include "blitter/factory.hpp"`
`#include "linkgraph/linkgraph_gui.h"`
`#include "timer/timer.h"`
`#include "timer/timer_window.h"`
`#include "smallmap_gui.h"`
`#include "widgets/smallmap_widget.h"`
`#include "table/strings.h"`
`#include <bitset>`
`#include "safeguards.h"`
`#include "table/heightmap_colours.h"`

Go to the source code of this file.

## Data Structures
struct | LegendAndColour
| Structure for holding relevant data for legends in small map. More...
struct | SmallMapColourScheme
| Colour scheme of the smallmap. More...
struct | AndOr
class | SmallMapWindow
| Class managing the smallmap window. More...
class | NWidgetSmallmapDisplay
| Custom container class for displaying smallmap with a vertically resizing legend panel. More...

## Macros
#define | MK(a, b) {a, b, IT_INVALID, 0, CompanyID::Invalid(), true, false, false}
| Macro for ordinary entry of LegendAndColour.
#define | MC(col_break) {{}, STR_TINY_BLACK_HEIGHT, IT_INVALID, 0, CompanyID::Invalid(), true, false, col_break}
| Macro for a height legend entry with configurable colour.
#define | MO(a, b) {a, b, IT_INVALID, 0, CompanyID::Invalid(), true, false, false}
| Macro for non-company owned property entry of LegendAndColour.
#define | MOEND() {{}, STR_NULL, IT_INVALID, 0, OWNER_NONE, true, true, false}
| Macro used for forcing a rebuild of the owner legend the first time it is used.
#define | MKEND() {{}, STR_NULL, IT_INVALID, 0, CompanyID::Invalid(), true, true, false}
| Macro for end of list marker in arrays of LegendAndColour.
#define | MS(a, b) {a, b, IT_INVALID, 0, CompanyID::Invalid(), true, false, true}
| Macro for break marker in arrays of LegendAndColour.
#define | MKCOLOUR(x) TO_LE32(x)
#define | MKCOLOUR_XXXX(x) (MKCOLOUR(0x01010101) * (uint)(x.p))
#define | MKCOLOUR_0XX0(x) (MKCOLOUR(0x00010100) * (uint)(x.p))
#define | MKCOLOUR_X00X(x) (MKCOLOUR(0x01000001) * (uint)(x.p))
#define | MKCOLOUR_XYYX(x, y) (MKCOLOUR_X00X(x) | MKCOLOUR_0XX0(y))
#define | MKCOLOUR_0000 MKCOLOUR_XXXX(PixelColour{0x00})
#define | MKCOLOUR_F00F MKCOLOUR_X00X(PixelColour{0xFF})
#define | MKCOLOUR_FFFF MKCOLOUR_XXXX(PixelColour{0xFF})

## Enumerations
enum | SmallMapType : uint8_t { SMT_CONTOUR , SMT_VEHICLES , SMT_INDUSTRY , SMT_LINKSTATS , SMT_ROUTES , SMT_VEGETATION , SMT_OWNER }
| Types of legends in the WID_SM_LEGEND widget. More...

## Functions
void | BuildIndustriesLegend ()
| Fills an array for the industries legends.
void | BuildLinkStatsLegend ()
| Populate legend table for the link stat view.
void | BuildLandLegend ()
| (Re)build the colour tables for the legends.
void | BuildOwnerLegend ()
| Completes the array for the owned property legend.
static uint32_t | ApplyMask (uint32_t colour, const AndOr *mask)
static uint32_t | GetSmallMapContoursPixels (TileIndex tile, TileType t)
| Return the colour a tile would be displayed with in the small map in mode "Contour".
static uint32_t | GetSmallMapVehiclesPixels (TileIndex, TileType t)
| Return the colour a tile would be displayed with in the small map in mode "Vehicles".
static uint32_t | GetSmallMapIndustriesPixels (TileIndex tile, TileType t)
| Return the colour a tile would be displayed with in the small map in mode "Industries".
static uint32_t | GetSmallMapRoutesPixels (TileIndex tile, TileType t)
| Return the colour a tile would be displayed with in the small map in mode "Routes".
static uint32_t | GetSmallMapLinkStatsPixels (TileIndex tile, TileType t)
| Return the colour a tile would be displayed with in the small map in mode "link stats".
static uint32_t | GetSmallMapVegetationPixels (TileIndex tile, TileType t)
| Return the colour a tile would be displayed with in the smallmap in mode "Vegetation".
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".
static std::unique_ptr< NWidgetBase > | SmallMapDisplay ()
void | ShowSmallMap ()
| Show the smallmap window.
bool | ScrollMainWindowTo (int x, int y, int z, bool instant)
| Scrolls the main window to given coordinates.
Point | GetSmallMapStationMiddle (const Window *w, const Station *st)
| Determine the middle of a station in the smallmap window.

## Variables
static int | _smallmap_industry_count
| Number of used industries.
static int | _smallmap_company_count
| Number of entries in the owner legend.
static int | _smallmap_cargo_count
| Number of cargos in the link stats legend.
static const uint8_t | _linkstat_colours_in_legenda [] = {0, 1, 3, 5, 7, 9, 11}
| Link stat colours shown in legenda.
static const int | NUM_NO_COMPANY_ENTRIES = 4
| Number of entries in the owner legend that are not companies.
static LegendAndColour | _legend_land_contours []
| Legend text giving the colours to look for on the minimap.
static const LegendAndColour | _legend_vehicles []
static const LegendAndColour | _legend_routes []
static const LegendAndColour | _legend_vegetation []
static LegendAndColour | _legend_land_owners [NUM_NO_COMPANY_ENTRIES+MAX_COMPANIES+1]
static LegendAndColour | _legend_linkstats [NUM_CARGO+lengthof(_linkstat_colours_in_legenda)+1]
| Legend entries for the link stats view.
static LegendAndColour | _legend_from_industries [NUM_INDUSTRYTYPES+1]
| Allow room for all industries, plus a terminator entry This is required in order to have the industry slots all filled up.
static uint | _industry_to_list_pos [NUM_INDUSTRYTYPES]
| For connecting industry type to position in industries list(small map legend)
static uint16_t | _industry_to_name_string_width [NUM_INDUSTRYTYPES]
| The string bounding box width for each industry type in the smallmap.
static bool | _smallmap_show_heightmap = false
| Show heightmap in industry and owner mode of smallmap window.
static IndustryType | _smallmap_industry_highlight = IT_INVALID
| Highlight a specific industry type.
static bool | _smallmap_industry_highlight_state
| State of highlight blinking.
static TypedIndexContainer< std::array< uint32_t, MAX_COMPANIES >, CompanyID > | _company_to_list_pos
| For connecting company ID to position in owner list (small map legend)
static const LegendAndColour *const | _legend_table []
static SmallMapColourScheme | _heightmap_schemes []
| Available colour schemes for height maps.
static const AndOr | _smallmap_contours_andor []
| Colour masks for "Contour" and "Routes" modes.
static const AndOr | _smallmap_vehicles_andor []
| Colour masks for "Vehicles", "Industry", and "Vegetation" modes.
static const uint8_t | _tiletype_importance []
| Mapping of tile type to importance of the tile (higher number means more interesting to show).
static const uint32_t | _vegetation_clear_bits []
static const PixelColour | _vehicle_type_colours [6]
| Vehicle colours in SMT_VEHICLES mode.
static constexpr std::initializer_list< NWidgetPart > | _nested_smallmap_display
| Widget parts of the smallmap display.
static constexpr std::initializer_list< NWidgetPart > | _nested_smallmap_bar
| Widget parts of the smallmap legend bar + image buttons.
static constexpr std::initializer_list< NWidgetPart > | _nested_smallmap_widgets
static WindowDesc | _smallmap_desc (WDP_AUTO, "smallmap", 484, 314, WC_SMALLMAP, WC_NONE, {}, _nested_smallmap_widgets)

## Detailed Description

GUI that shows a small map of the world with metadata like owner or height.

Definition in file smallmap_gui.cpp.

## Macro Definition Documentation

## ◆ MC

#define MC | ( |  | col_break | ) | {{}, STR_TINY_BLACK_HEIGHT, IT_INVALID, 0, CompanyID::Invalid(), true, false, col_break}

Macro for a height legend entry with configurable colour.

Definition at line 66 of file smallmap_gui.cpp.

## ◆ MK

#define MK | ( |  | a,
|  |  | b
| ) |  | {a, b, IT_INVALID, 0, CompanyID::Invalid(), true, false, false}

Macro for ordinary entry of LegendAndColour.

Definition at line 63 of file smallmap_gui.cpp.

## ◆ MKCOLOUR

#define MKCOLOUR | ( |  | x | ) | TO_LE32(x)

Definition at line 259 of file smallmap_gui.cpp.

## ◆ MKCOLOUR_0000

#define MKCOLOUR_0000 MKCOLOUR_XXXX(PixelColour{0x00})

Definition at line 267 of file smallmap_gui.cpp.

## ◆ MKCOLOUR_0XX0

#define MKCOLOUR_0XX0 | ( |  | x | ) | (MKCOLOUR(0x00010100) * (uint)(x.p))

Definition at line 262 of file smallmap_gui.cpp.

## ◆ MKCOLOUR_F00F

#define MKCOLOUR_F00F MKCOLOUR_X00X(PixelColour{0xFF})

Definition at line 268 of file smallmap_gui.cpp.

## ◆ MKCOLOUR_FFFF

#define MKCOLOUR_FFFF MKCOLOUR_XXXX(PixelColour{0xFF})

Definition at line 269 of file smallmap_gui.cpp.

## ◆ MKCOLOUR_X00X

#define MKCOLOUR_X00X | ( |  | x | ) | (MKCOLOUR(0x01000001) * (uint)(x.p))

Definition at line 263 of file smallmap_gui.cpp.

## ◆ MKCOLOUR_XXXX

#define MKCOLOUR_XXXX | ( |  | x | ) | (MKCOLOUR(0x01010101) * (uint)(x.p))

Definition at line 261 of file smallmap_gui.cpp.

## ◆ MKCOLOUR_XYYX

#define MKCOLOUR_XYYX | ( |  | x,
|  |  | y
| ) |  | (MKCOLOUR_X00X(x) | MKCOLOUR_0XX0(y))

Definition at line 265 of file smallmap_gui.cpp.

## ◆ MKEND

#define MKEND | ( |  | ) | {{}, STR_NULL, IT_INVALID, 0, CompanyID::Invalid(), true, true, false}

Macro for end of list marker in arrays of LegendAndColour.

Definition at line 75 of file smallmap_gui.cpp.

## ◆ MO

#define MO | ( |  | a,
|  |  | b
| ) |  | {a, b, IT_INVALID, 0, CompanyID::Invalid(), true, false, false}

Macro for non-company owned property entry of LegendAndColour.

Definition at line 69 of file smallmap_gui.cpp.

## ◆ MOEND

#define MOEND | ( |  | ) | {{}, STR_NULL, IT_INVALID, 0, OWNER_NONE, true, true, false}

Macro used for forcing a rebuild of the owner legend the first time it is used.

Definition at line 72 of file smallmap_gui.cpp.

## ◆ MS

#define MS | ( |  | a,
|  |  | b
| ) |  | {a, b, IT_INVALID, 0, CompanyID::Invalid(), true, false, true}

Macro for break marker in arrays of LegendAndColour.

It will have valid data, though

Definition at line 81 of file smallmap_gui.cpp.

## Enumeration Type Documentation

## ◆ SmallMapType

enum SmallMapType : uint8_t

Types of legends in the WID_SM_LEGEND widget.

Definition at line 615 of file smallmap_gui.cpp.

## Function Documentation

## ◆ ApplyMask()

static uint32_t ApplyMask | ( | uint32_t | colour,
|  | const AndOr * | mask
| ) |  |
| inlinestatic

Definition at line 368 of file smallmap_gui.cpp.

## ◆ BuildIndustriesLegend()

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().

## ◆ BuildLandLegend()

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().

## ◆ BuildLinkStatsLegend()

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().

## ◆ BuildOwnerLegend()

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, Tpool_type, Tcache >::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().

## ◆ GetSmallMapContoursPixels()

static uint32_t GetSmallMapContoursPixels | ( | TileIndex | tile,
|  | TileType | t
| ) |  |
| inlinestatic

Return the colour a tile would be displayed with in the small map in mode "Contour".

Parameters

  tile | The tile of which we would like to get the colour.
  t | Effective tile type of the tile (see SmallMapWindow::GetTileColours).

Returns
  The colour of tile in the small map in mode "Contour"

Definition at line 429 of file smallmap_gui.cpp.

References _heightmap_schemes, _settings_client, _smallmap_contours_andor, ClientSettings::gui, SmallMapColourScheme::height_colours, GUISettings::smallmap_land_colour, and TileHeight().

Referenced by GetSmallMapLinkStatsPixels(), and SmallMapWindow::GetTileColours().

## ◆ GetSmallMapIndustriesPixels()

static uint32_t GetSmallMapIndustriesPixels | ( | TileIndex | tile,
|  | TileType | t
| ) |  |
| inlinestatic

Return the colour a tile would be displayed with in the small map in mode "Industries".

Parameters

  tile | The tile of which we would like to get the colour.
  t | Effective tile type of the tile (see SmallMapWindow::GetTileColours).

Returns
  The colour of tile in the small map in mode "Industries"

Definition at line 455 of file smallmap_gui.cpp.

References _heightmap_schemes, _settings_client, _smallmap_show_heightmap, _smallmap_vehicles_andor, SmallMapColourScheme::default_colour, ClientSettings::gui, SmallMapColourScheme::height_colours, GUISettings::smallmap_land_colour, and TileHeight().

Referenced by SmallMapWindow::GetTileColours().

## ◆ GetSmallMapLinkStatsPixels()

static uint32_t GetSmallMapLinkStatsPixels | ( | TileIndex | tile,
|  | TileType | t
| ) |  |
| inlinestatic

Return the colour a tile would be displayed with in the small map in mode "link stats".

Parameters

  tile | The tile of which we would like to get the colour.
  t | Effective tile type of the tile (see SmallMapWindow::GetTileColours).

Returns
  The colour of tile in the small map in mode "link stats"

Definition at line 524 of file smallmap_gui.cpp.

References _smallmap_show_heightmap, GetSmallMapContoursPixels(), and GetSmallMapRoutesPixels().

Referenced by SmallMapWindow::GetTileColours().

## ◆ GetSmallMapOwnerPixels()

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".

Note
  If include_heightmap is IH_NEVER, the return value can safely be used as a palette colour (by masking it to a uint8_t)

Parameters

  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)

Returns
  The colour of tile in the small map in mode "Owner"

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, GetRoadOwner(), GetTileOwner(), ClientSettings::gui, SmallMapColourScheme::height_colours, IfEnabled, MP_HOUSE, MP_INDUSTRY, MP_ROAD, MP_VOID, MP_WATER, OWNER_NONE, OWNER_TOWN, OWNER_WATER, PC_BLACK, PC_DARK_GREY, PC_DARK_RED, PC_WATER, RTT_ROAD, RTT_TRAM, GUISettings::smallmap_land_colour, and TileHeight().

Referenced by SmallMapWindow::GetTileColours().

## ◆ GetSmallMapRoutesPixels()

static uint32_t GetSmallMapRoutesPixels | ( | TileIndex | tile,
|  | TileType | t
| ) |  |
| inlinestatic

Return the colour a tile would be displayed with in the small map in mode "Routes".

Parameters

  tile | The tile of which we would like to get the colour.
  t | Effective tile type of the tile (see SmallMapWindow::GetTileColours).

Returns
  The colour of tile in the small map in mode "Routes"

Definition at line 468 of file smallmap_gui.cpp.

References _heightmap_schemes, _settings_client, _smallmap_contours_andor, SmallMapColourScheme::default_colour, GetRailType(), GetRailTypeInfo(), GetRoadTypeInfo(), GetStationType(), ClientSettings::gui, INVALID_ROADTYPE, RoadTypeInfo::map_colour, MP_RAILWAY, MP_ROAD, MP_STATION, PC_LIGHT_BLUE, PC_ORANGE, PC_RED, PC_VERY_DARK_BROWN, PC_YELLOW, and GUISettings::smallmap_land_colour.

Referenced by GetSmallMapLinkStatsPixels(), and SmallMapWindow::GetTileColours().

## ◆ GetSmallMapStationMiddle()

Point GetSmallMapStationMiddle | ( | const Window * | w,
|  | const Station * | st
| ) |  |

Determine the middle of a station in the smallmap window.

Parameters

  st | The station we're looking for.

Returns
  Middle point of the station in the smallmap window.

Definition at line 2099 of file smallmap_gui.cpp.

Referenced by LinkGraphOverlay::GetStationMiddle().

## ◆ GetSmallMapVegetationPixels()

static uint32_t GetSmallMapVegetationPixels | ( | TileIndex | tile,
|  | TileType | t
| ) |  |
| inlinestatic

Return the colour a tile would be displayed with in the smallmap in mode "Vegetation".

Parameters

  tile | The tile of which we would like to get the colour.
  t | Effective tile type of the tile (see SmallMapWindow::GetTileColours).

Returns
  The colour of tile in the smallmap in mode "Vegetation"

Definition at line 547 of file smallmap_gui.cpp.

References _settings_game, _smallmap_vehicles_andor, CLEAR_GRASS, CLEAR_SNOW, GameSettings::game_creation, GetClearDensity(), GetClearGround(), GetTreeGround(), GetTropicZone(), IsClearGround(), IsSnowTile(), IsTileForestIndustry(), GameCreationSettings::landscape, MP_CLEAR, MP_INDUSTRY, MP_TREES, PC_BARE_LAND, PC_DARK_RED, PC_GRASS_LAND, PC_GREEN, PC_LIGHT_BLUE, PC_ORANGE, PC_RAINFOREST, PC_TREES, TREE_GROUND_ROUGH_SNOW, TREE_GROUND_SNOW_DESERT, and TROPICZONE_RAINFOREST.

Referenced by SmallMapWindow::GetTileColours().

## ◆ GetSmallMapVehiclesPixels()

static uint32_t GetSmallMapVehiclesPixels | ( | TileIndex | ,
|  | TileType | t
| ) |  |
| inlinestatic

Return the colour a tile would be displayed with in the small map in mode "Vehicles".

Parameters

  tile | The tile of which we would like to get the colour.
  t | Effective tile type of the tile (see SmallMapWindow::GetTileColours).

Returns
  The colour of tile in the small map in mode "Vehicles"

Definition at line 442 of file smallmap_gui.cpp.

References _heightmap_schemes, _settings_client, _smallmap_vehicles_andor, SmallMapColourScheme::default_colour, ClientSettings::gui, and GUISettings::smallmap_land_colour.

Referenced by SmallMapWindow::GetTileColours().

## ◆ ScrollMainWindowTo()

bool ScrollMainWindowTo | ( | int | x,
|  | int | y,
|  | int | z,
|  | bool | instant
| ) |  |

Scrolls the main window to given coordinates.

Parameters

  x | x coordinate
  y | y coordinate
  z | z coordinate; -1 to scroll to terrain height
  instant | scroll instantly (meaningful only when smooth_scrolling is active)

Returns
  did the viewport position change?

Definition at line 2078 of file smallmap_gui.cpp.

References FindWindowById(), GetMainWindow(), ScrollWindowTo(), SmallMapWindow::SmallMapCenterOnCurrentPos(), and WC_SMALLMAP.

Referenced by HandleViewportScroll(), NewsWindow::OnClick(), VehicleViewWindow::OnClick(), MainWindow::OnHotkey(), and ScrollMainWindowToTile().

## ◆ ShowSmallMap()

void ShowSmallMap | ( |  | ) |

Show the smallmap window.

Definition at line 2065 of file smallmap_gui.cpp.

Referenced by MenuClickMap(), IndustryCargoesWindow::OnClick(), MainToolbarWindow::OnHotkey(), and ScenarioEditorToolbarWindow::OnHotkey().

## ◆ SmallMapDisplay()

static std::unique_ptr< NWidgetBase > SmallMapDisplay | ( |  | ) |
| static

Definition at line 2014 of file smallmap_gui.cpp.

## Variable Documentation

## ◆ _company_to_list_pos

TypedIndexContainer<std::array<uint32_t, MAX_COMPANIES>, CompanyID> _company_to_list_pos
| static

For connecting company ID to position in owner list (small map legend)

Definition at line 184 of file smallmap_gui.cpp.

Referenced by BuildOwnerLegend(), and GetSmallMapOwnerPixels().

## ◆ _heightmap_schemes

SmallMapColourScheme _heightmap_schemes[]
| static

Initial value:
= {
{{}, _green_map_heights, MKCOLOUR_XXXX(PixelColour{0x54})},
{{}, _dark_green_map_heights, MKCOLOUR_XXXX(PixelColour{0x62})},
{{}, _violet_map_heights, MKCOLOUR_XXXX(PixelColour{0x81})},
}
_violet_map_heights
static const uint32_t _violet_map_heights[]
Height map colours for the violet colour scheme, ordered by height.
Definition heightmap_colours.h:235
_dark_green_map_heights
static const uint32_t _dark_green_map_heights[]
Height map colours for the dark green colour scheme, ordered by height.
Definition heightmap_colours.h:132
_green_map_heights
static const uint32_t _green_map_heights[]
Height map colours for the green colour scheme, ordered by height.
Definition heightmap_colours.h:13
PixelColour
Colour for pixel/line drawing.
Definition gfx_type.h:405

Available colour schemes for height maps.

Definition at line 281 of file smallmap_gui.cpp.

Referenced by BuildLandLegend(), BuildOwnerLegend(), GetSmallMapContoursPixels(), GetSmallMapIndustriesPixels(), GetSmallMapOwnerPixels(), GetSmallMapRoutesPixels(), GetSmallMapVehiclesPixels(), and SmallMapWindow::RebuildColourIndexIfNecessary().

## ◆ _industry_to_list_pos

uint _industry_to_list_pos[NUM_INDUSTRYTYPES]
| static

For connecting industry type to position in industries list(small map legend)

Definition at line 174 of file smallmap_gui.cpp.

Referenced by BuildIndustriesLegend(), SmallMapWindow::DrawIndustryNames(), and SmallMapWindow::GetTileColours().

## ◆ _industry_to_name_string_width

uint16_t _industry_to_name_string_width[NUM_INDUSTRYTYPES]
| static

The string bounding box width for each industry type in the smallmap.

Definition at line 176 of file smallmap_gui.cpp.

Referenced by SmallMapWindow::DrawIndustryNames(), and SmallMapWindow::OnInit().

## ◆ _legend_from_industries

LegendAndColour _legend_from_industries[NUM_INDUSTRYTYPES+1]
| static

Allow room for all industries, plus a terminator entry This is required in order to have the industry slots all filled up.

Definition at line 172 of file smallmap_gui.cpp.

Referenced by BuildIndustriesLegend(), SmallMapWindow::DrawIndustryNames(), SmallMapWindow::GetTileColours(), SmallMapWindow::OnClick(), SmallMapWindow::OnInvalidateData(), and SmallMapWindow::OnMouseOver().

## ◆ _legend_land_contours

LegendAndColour _legend_land_contours[]
| static

Initial value:
= {
MK(PC_BLACK, STR_SMALLMAP_LEGENDA_ROADS),
MK(PC_GREY, STR_SMALLMAP_LEGENDA_RAILROADS),
MK(PC_LIGHT_BLUE, STR_SMALLMAP_LEGENDA_STATIONS_AIRPORTS_DOCKS),
MK(PC_DARK_RED, STR_SMALLMAP_LEGENDA_BUILDINGS_INDUSTRIES),
MK(PC_WHITE, STR_SMALLMAP_LEGENDA_VEHICLES),
MC(true),
MC(false),
MC(false),
MC(false),
MC(false),
MC(false),
MC(true),
MC(false),
MC(false),
MC(false),
MC(false),
MC(false),
}
PC_DARK_RED
static constexpr PixelColour PC_DARK_RED
Dark red palette colour.
Definition palette_func.h:102
PC_GREY
static constexpr PixelColour PC_GREY
Grey palette colour.
Definition palette_func.h:98
PC_BLACK
static constexpr PixelColour PC_BLACK
Black palette colour.
Definition palette_func.h:96
PC_WHITE
static constexpr PixelColour PC_WHITE
White palette colour.
Definition palette_func.h:99
PC_LIGHT_BLUE
static constexpr PixelColour PC_LIGHT_BLUE
Light blue palette colour.
Definition palette_func.h:117
MK
#define MK(a, b)
Macro for ordinary entry of LegendAndColour.
Definition smallmap_gui.cpp:63
MC
#define MC(col_break)
Macro for a height legend entry with configurable colour.
Definition smallmap_gui.cpp:66

Legend text giving the colours to look for on the minimap.

Definition at line 84 of file smallmap_gui.cpp.

Referenced by BuildLandLegend().

## ◆ _legend_land_owners

LegendAndColour _legend_land_owners[NUM_NO_COMPANY_ENTRIES+MAX_COMPANIES+1]
| static

Initial value:
= {
MO(PC_WATER, STR_SMALLMAP_LEGENDA_WATER),
MO({}, STR_SMALLMAP_LEGENDA_NO_OWNER),
MO(PC_DARK_RED, STR_SMALLMAP_LEGENDA_TOWNS),
MO(PC_DARK_GREY, STR_SMALLMAP_LEGENDA_INDUSTRIES),
MOEND(),
}
PC_WATER
static constexpr PixelColour PC_WATER
Dark blue palette colour for water.
Definition palette_func.h:125
PC_DARK_GREY
static constexpr PixelColour PC_DARK_GREY
Dark grey palette colour.
Definition palette_func.h:97
MOEND
#define MOEND()
Macro used for forcing a rebuild of the owner legend the first time it is used.
Definition smallmap_gui.cpp:72
MO
#define MO(a, b)
Macro for non-company owned property entry of LegendAndColour.
Definition smallmap_gui.cpp:69

Definition at line 150 of file smallmap_gui.cpp.

## ◆ _legend_linkstats

LegendAndColour _legend_linkstats[NUM_CARGO+lengthof(_linkstat_colours_in_legenda)+1]
| static

Legend entries for the link stats view.

Definition at line 167 of file smallmap_gui.cpp.

Referenced by BuildLinkStatsLegend(), SmallMapWindow::OnClick(), and SmallMapWindow::SetOverlayCargoMask().

## ◆ _legend_routes

const LegendAndColour _legend_routes[]
| static

Initial value:
= {
MK(PC_BLACK, STR_SMALLMAP_LEGENDA_ROADS),
MK(PC_GREY, STR_SMALLMAP_LEGENDA_RAILROADS),
MK(PC_DARK_RED, STR_SMALLMAP_LEGENDA_BUILDINGS_INDUSTRIES),
MS(PC_VERY_DARK_BROWN, STR_SMALLMAP_LEGENDA_RAILROAD_STATION),
MK(PC_ORANGE, STR_SMALLMAP_LEGENDA_TRUCK_LOADING_BAY),
MK(PC_YELLOW, STR_SMALLMAP_LEGENDA_BUS_STATION),
MK(PC_RED, STR_SMALLMAP_LEGENDA_AIRPORT_HELIPORT),
MK(PC_LIGHT_BLUE, STR_SMALLMAP_LEGENDA_DOCK),
}
PC_YELLOW
static constexpr PixelColour PC_YELLOW
Yellow palette colour.
Definition palette_func.h:109
PC_ORANGE
static constexpr PixelColour PC_ORANGE
Orange palette colour.
Definition palette_func.h:107
PC_RED
static constexpr PixelColour PC_RED
Red palette colour.
Definition palette_func.h:103
PC_VERY_DARK_BROWN
static constexpr PixelColour PC_VERY_DARK_BROWN
Almost-black brown palette colour.
Definition palette_func.h:105
MS
#define MS(a, b)
Macro for break marker in arrays of LegendAndColour.
Definition smallmap_gui.cpp:81

Definition at line 120 of file smallmap_gui.cpp.

## ◆ _legend_table

const LegendAndColour* const _legend_table[]
| static

Initial value:
= {
_legend_land_contours,
_legend_vehicles,
_legend_from_industries,
_legend_linkstats,
_legend_routes,
_legend_vegetation,
_legend_land_owners,
}
_legend_from_industries
static LegendAndColour _legend_from_industries[NUM_INDUSTRYTYPES+1]
Allow room for all industries, plus a terminator entry This is required in order to have the industry...
Definition smallmap_gui.cpp:172
_legend_land_contours
static LegendAndColour _legend_land_contours[]
Legend text giving the colours to look for on the minimap.
Definition smallmap_gui.cpp:84
_legend_linkstats
static LegendAndColour _legend_linkstats[NUM_CARGO+lengthof(_linkstat_colours_in_legenda)+1]
Legend entries for the link stats view.
Definition smallmap_gui.cpp:167

Definition at line 249 of file smallmap_gui.cpp.

## ◆ _legend_vegetation

const LegendAndColour _legend_vegetation[]
| static

Initial value:
= {
MK(PC_ROUGH_LAND, STR_SMALLMAP_LEGENDA_ROUGH_LAND),
MK(PC_GRASS_LAND, STR_SMALLMAP_LEGENDA_GRASS_LAND),
MK(PC_BARE_LAND, STR_SMALLMAP_LEGENDA_BARE_LAND),
MK(PC_RAINFOREST, STR_SMALLMAP_LEGENDA_RAINFOREST),
MK(PC_FIELDS, STR_SMALLMAP_LEGENDA_FIELDS),
MK(PC_TREES, STR_SMALLMAP_LEGENDA_TREES),
MS(PC_GREEN, STR_SMALLMAP_LEGENDA_FOREST),
MK(PC_GREY, STR_SMALLMAP_LEGENDA_ROCKS),
MK(PC_ORANGE, STR_SMALLMAP_LEGENDA_DESERT),
MK(PC_LIGHT_BLUE, STR_SMALLMAP_LEGENDA_SNOW),
MK(PC_BLACK, STR_SMALLMAP_LEGENDA_TRANSPORT_ROUTES),
MK(PC_DARK_RED, STR_SMALLMAP_LEGENDA_BUILDINGS_INDUSTRIES),
}
PC_TREES
static constexpr PixelColour PC_TREES
Green palette colour for trees.
Definition palette_func.h:124
PC_ROUGH_LAND
static constexpr PixelColour PC_ROUGH_LAND
Dark green palette colour for rough land.
Definition palette_func.h:119
PC_GREEN
static constexpr PixelColour PC_GREEN
Green palette colour.
Definition palette_func.h:113
PC_FIELDS
static constexpr PixelColour PC_FIELDS
Light brown palette colour for fields.
Definition palette_func.h:123
PC_GRASS_LAND
static constexpr PixelColour PC_GRASS_LAND
Dark green palette colour for grass land.
Definition palette_func.h:120
PC_BARE_LAND
static constexpr PixelColour PC_BARE_LAND
Brown palette colour for bare land.
Definition palette_func.h:121
PC_RAINFOREST
static constexpr PixelColour PC_RAINFOREST
Pale green palette colour for rainforest.
Definition palette_func.h:122

Definition at line 133 of file smallmap_gui.cpp.

## ◆ _legend_vehicles

const LegendAndColour _legend_vehicles[]
| static

Initial value:
= {
MK(PC_RED, STR_SMALLMAP_LEGENDA_TRAINS),
MK(PC_YELLOW, STR_SMALLMAP_LEGENDA_ROAD_VEHICLES),
MK(PC_LIGHT_BLUE, STR_SMALLMAP_LEGENDA_SHIPS),
MK(PC_WHITE, STR_SMALLMAP_LEGENDA_AIRCRAFT),
MS(PC_BLACK, STR_SMALLMAP_LEGENDA_TRANSPORT_ROUTES),
MK(PC_DARK_RED, STR_SMALLMAP_LEGENDA_BUILDINGS_INDUSTRIES),
}

Definition at line 109 of file smallmap_gui.cpp.

## ◆ _linkstat_colours_in_legenda

const uint8_t _linkstat_colours_in_legenda[] = {0, 1, 3, 5, 7, 9, 11}
| static

Link stat colours shown in legenda.

Definition at line 58 of file smallmap_gui.cpp.

Referenced by BuildLinkStatsLegend(), and SmallMapWindow::OnInit().

## ◆ _nested_smallmap_bar

constexpr std::initializer_list<NWidgetPart> _nested_smallmap_bar
| staticconstexpr

Widget parts of the smallmap legend bar + image buttons.

Definition at line 1973 of file smallmap_gui.cpp.

## ◆ _nested_smallmap_display

constexpr std::initializer_list<NWidgetPart> _nested_smallmap_display
| staticconstexpr

Initial value:
= {
NWidget(WWT_PANEL, COLOUR_BROWN, WID_SM_MAP_BORDER),
NWidget(WWT_INSET, COLOUR_BROWN, WID_SM_MAP), SetMinimalSize(346, 140), SetResize(1, 1), SetPadding(2, 2, 2, 2), EndContainer(),
EndContainer(),
}
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
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
SetResize
constexpr NWidgetPart SetResize(int16_t dx, int16_t dy)
Widget part function for setting the resize step.
Definition widget_type.h:1148
WID_SM_MAP_BORDER
@ WID_SM_MAP_BORDER
Border around the smallmap.
Definition smallmap_widget.h:16
WID_SM_MAP
@ WID_SM_MAP
Panel containing the smallmap.
Definition smallmap_widget.h:17
WWT_INSET
@ WWT_INSET
Pressed (inset) panel, most commonly used as combo box text area.
Definition widget_type.h:40
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition widget_type.h:39

Widget parts of the smallmap display.

Definition at line 1966 of file smallmap_gui.cpp.

## ◆ _nested_smallmap_widgets

constexpr std::initializer_list<NWidgetPart> _nested_smallmap_widgets
| staticconstexpr

Definition at line 2023 of file smallmap_gui.cpp.

## ◆ _smallmap_cargo_count

int _smallmap_cargo_count
| static

Number of cargos in the link stats legend.

Definition at line 43 of file smallmap_gui.cpp.

Referenced by BuildLinkStatsLegend(), SmallMapWindow::GetNumberRowsLegend(), SmallMapWindow::OnClick(), and SmallMapWindow::SetOverlayCargoMask().

## ◆ _smallmap_company_count

int _smallmap_company_count
| static

Number of entries in the owner legend.

Definition at line 42 of file smallmap_gui.cpp.

Referenced by BuildOwnerLegend(), SmallMapWindow::GetNumberRowsLegend(), and SmallMapWindow::OnClick().

## ◆ _smallmap_contours_andor

const AndOr _smallmap_contours_andor[]
| static

Initial value:
= {
{MKCOLOUR_0000 , MKCOLOUR_FFFF},
{MKCOLOUR_0XX0(PC_GREY ), MKCOLOUR_F00F},
{MKCOLOUR_0XX0(PC_BLACK ), MKCOLOUR_F00F},
{MKCOLOUR_0XX0(PC_DARK_RED ), MKCOLOUR_F00F},
{MKCOLOUR_0000 , MKCOLOUR_FFFF},
{MKCOLOUR_XXXX(PC_LIGHT_BLUE), MKCOLOUR_0000},
{MKCOLOUR_XXXX(PC_WATER ), MKCOLOUR_0000},
{MKCOLOUR_0000 , MKCOLOUR_FFFF},
{MKCOLOUR_XXXX(PC_DARK_RED ), MKCOLOUR_0000},
{MKCOLOUR_0000 , MKCOLOUR_FFFF},
{MKCOLOUR_0XX0(PC_DARK_RED ), MKCOLOUR_F00F},
{MKCOLOUR_0XX0(PC_GREY ), MKCOLOUR_F00F},
}

Colour masks for "Contour" and "Routes" modes.

Definition at line 375 of file smallmap_gui.cpp.

Referenced by GetSmallMapContoursPixels(), and GetSmallMapRoutesPixels().

## ◆ _smallmap_industry_count

int _smallmap_industry_count
| static

Number of used industries.

Definition at line 41 of file smallmap_gui.cpp.

Referenced by BuildIndustriesLegend(), SmallMapWindow::GetNumberRowsLegend(), SmallMapWindow::OnClick(), SmallMapWindow::OnInvalidateData(), and SmallMapWindow::OnMouseOver().

## ◆ _smallmap_industry_highlight

IndustryType _smallmap_industry_highlight = IT_INVALID
| static

Highlight a specific industry type.

Definition at line 180 of file smallmap_gui.cpp.

Referenced by SmallMapWindow::Blink(), SmallMapWindow::DrawIndustryNames(), SmallMapWindow::DrawWidget(), SmallMapWindow::ForceRefresh(), SmallMapWindow::GetTileColours(), and SmallMapWindow::OnMouseOver().

## ◆ _smallmap_industry_highlight_state

bool _smallmap_industry_highlight_state
| static

State of highlight blinking.

Definition at line 182 of file smallmap_gui.cpp.

Referenced by SmallMapWindow::Blink(), SmallMapWindow::DrawIndustryNames(), SmallMapWindow::DrawWidget(), SmallMapWindow::GetTileColours(), and SmallMapWindow::OnMouseOver().

## ◆ _smallmap_show_heightmap

bool _smallmap_show_heightmap = false
| static

Show heightmap in industry and owner mode of smallmap window.

Definition at line 178 of file smallmap_gui.cpp.

Referenced by GetSmallMapIndustriesPixels(), GetSmallMapLinkStatsPixels(), GetSmallMapOwnerPixels(), and SmallMapWindow::OnClick().

## ◆ _smallmap_vehicles_andor

const AndOr _smallmap_vehicles_andor[]
| static

Initial value:
= {
{MKCOLOUR_0000 , MKCOLOUR_FFFF},
{MKCOLOUR_0XX0(PC_BLACK ), MKCOLOUR_F00F},
{MKCOLOUR_0XX0(PC_BLACK ), MKCOLOUR_F00F},
{MKCOLOUR_0XX0(PC_DARK_RED ), MKCOLOUR_F00F},
{MKCOLOUR_0000 , MKCOLOUR_FFFF},
{MKCOLOUR_0XX0(PC_BLACK ), MKCOLOUR_F00F},
{MKCOLOUR_XXXX(PC_WATER ), MKCOLOUR_0000},
{MKCOLOUR_0000 , MKCOLOUR_FFFF},
{MKCOLOUR_XXXX(PC_DARK_RED ), MKCOLOUR_0000},
{MKCOLOUR_0000 , MKCOLOUR_FFFF},
{MKCOLOUR_0XX0(PC_DARK_RED ), MKCOLOUR_F00F},
{MKCOLOUR_0XX0(PC_BLACK ), MKCOLOUR_F00F},
}

Colour masks for "Vehicles", "Industry", and "Vegetation" modes.

Definition at line 391 of file smallmap_gui.cpp.

Referenced by GetSmallMapIndustriesPixels(), GetSmallMapVegetationPixels(), and GetSmallMapVehiclesPixels().

## ◆ _tiletype_importance

const uint8_t _tiletype_importance[]
| static

Initial value:
= {
2,
8,
7,
5,
2,
9,
2,
1,
6,
8,
2,
0,
}

Mapping of tile type to importance of the tile (higher number means more interesting to show).

Definition at line 407 of file smallmap_gui.cpp.

Referenced by SmallMapWindow::GetTileColours().

## ◆ _vegetation_clear_bits

const uint32_t _vegetation_clear_bits[]
| static

Initial value:
= {
MKCOLOUR_XXXX(PC_GRASS_LAND),
MKCOLOUR_XXXX(PC_ROUGH_LAND),
MKCOLOUR_XXXX(PC_GREY),
MKCOLOUR_XXXX(PC_FIELDS),
MKCOLOUR_XXXX(PC_LIGHT_BLUE),
MKCOLOUR_XXXX(PC_ORANGE),
MKCOLOUR_XXXX(PC_GRASS_LAND),
MKCOLOUR_XXXX(PC_GRASS_LAND),
}

Definition at line 529 of file smallmap_gui.cpp.

## ◆ _vehicle_type_colours

const PixelColour _vehicle_type_colours[6]
| static

Initial value:
= {
PC_RED, PC_YELLOW, PC_LIGHT_BLUE, PC_WHITE, PC_BLACK, PC_RED
}

Vehicle colours in SMT_VEHICLES mode.

Indexed by VehicleType.

Definition at line 610 of file smallmap_gui.cpp.

Referenced by SmallMapWindow::DrawVehicles().

## ◆ NUM_NO_COMPANY_ENTRIES

const int NUM_NO_COMPANY_ENTRIES = 4
| static

Number of entries in the owner legend that are not companies.

Definition at line 60 of file smallmap_gui.cpp.

Referenced by BuildOwnerLegend(), and SmallMapWindow::OnClick().