OpenTTD Source 20241224-master-gf74b0cf984
smallmap_gui.h File Reference

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.
 

Detailed Description

Smallmap GUI functions.

Definition in file smallmap_gui.h.

Enumeration Type Documentation

◆ IncludeHeightmap

enum class IncludeHeightmap
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.

Function Documentation

◆ BuildIndustriesLegend()

◆ BuildLandLegend()

◆ BuildLinkStatsLegend()

◆ BuildOwnerLegend()

◆ 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
tileThe tile of which we would like to get the colour.
tEffective tile type of the tile (see SmallMapWindow::GetTileColours).
include_heightmapWhether 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, 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().

◆ GetSmallMapStationMiddle()

Point GetSmallMapStationMiddle ( const Window w,
const Station st 
)

Determine the middle of a station in the smallmap window.

Parameters
stThe station we're looking for.
Returns
Middle point of the station in the smallmap window.

Definition at line 2098 of file smallmap_gui.cpp.

Referenced by LinkGraphOverlay::GetStationMiddle().

◆ ShowSmallMap()

void ShowSmallMap ( )