OpenTTD Source
1.11.0-beta2
|
Go to the documentation of this file.
10 #ifndef SMALLMAP_GUI_H
11 #define SMALLMAP_GUI_H
85 Point SmallmapRemapCoords(
int x,
int y)
const;
157 void DrawSmallMapColumn(
void *dst, uint xc, uint yc,
int pitch,
int reps,
int start_pos,
int end_pos,
Blitter *blitter)
const;
185 void OnClick(
Point pt,
int widget,
int click_count)
override;
IndustryType type
Type of industry. Only valid for industry entries.
@ WD_FRAMERECT_TOP
Offset at top to draw the frame rectangular area.
uint min_number_of_fixed_rows
Minimal number of rows in the legends for the fixed layouts only (all except #SMT_INDUSTRY).
static SmallMapType map_type
Currently displayed legends.
static const uint LEGEND_BLOB_WIDTH
Width of the coloured blob in front of a line text in the WID_SM_LEGEND widget.
void OnPaint() override
The window must be repainted.
How all blitters should look like.
void SmallMapCenterOnCurrentPos()
Center the small map on the current center of the viewport.
static void DrawHorizMapIndicator(int x, int x2, int y)
Draws horizontal part of map indicator.
CompanyID company
Company to display. Only valid for company entries of the owner legend.
bool OnRightClick(Point pt, int widget) override
A click with the right mouse button has been made on the window.
uint32 GetOverlayCompanyMask() const
Get a bitmask for company links to be displayed.
void SetupWidgetData()
Function to set up widgets depending on the information being shown on the smallmap.
uint32 GetTileColours(const TileArea &ta) const
Decide which colours to show to the user for a group of tiles.
int zoom
Zoom level. Bigger number means more zoom-out (further away).
void SwitchMapType(SmallMapType map_type)
Select a new map type.
Owner
Enum for all companies/owners.
void OnInit() override
Notification that the nested widget tree gets initialized.
uint column_width
Width of a column in the WID_SM_LEGEND widget.
uint min_number_of_columns
Minimal number of columns in legends.
int32 scroll_x
Horizontal world coordinate of the base tile left of the top-left corner of the smallmap display.
Class managing the smallmap window.
static bool show_towns
Display town names in the smallmap.
uint GetNumberColumnsLegend(uint width) const
Return number of columns that can be displayed in width pixels.
void DrawSmallMap(DrawPixelInfo *dpi) const
Draws the small map.
Point GetStationMiddle(const Station *st) const
Get the center of the given station as point on the screen in the smallmap window.
void SetZoomLevel(ZoomLevelChange change, const Point *zoom_pt)
Initialize or change the zoom level.
High level window description.
Point ComputeScroll(int tx, int ty, int x, int y, int *sub)
Compute base parameters of the smallmap such that tile (tx, ty) starts at pixel (x,...
static const uint8 PC_VERY_LIGHT_YELLOW
Almost-white yellow palette colour.
uint GetMinLegendWidth() const
Compute minimal required width of the legends.
Handles drawing of links into some window.
ZoomLevelChange
Available kinds of zoomlevel changes.
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
uint GetNumberRowsLegend(uint columns) const
Get the number of rows in the legend from the number of columns.
void DrawVehicles(const DrawPixelInfo *dpi, Blitter *blitter) const
Adds vehicles to the smallmap.
void BuildLinkStatsLegend()
Populate legend table for the link stat view.
static void DrawVertMapIndicator(int x, int y, int y2)
Draws vertical part of map indicator.
void ShowSmallMap()
Show the smallmap window.
bool col_break
Perform a column break and go further at the next column.
@ WD_FRAMERECT_LEFT
Offset at left to draw the frame rectangular area.
void DrawMapIndicators() const
Adds map indicators to the smallmap.
@ WD_FRAMERECT_BOTTOM
Offset at bottom to draw the frame rectangular area.
static int max_heightlevel
Currently used/cached maximum heightlevel.
void BuildLandLegend()
(Re)build the colour tables for the legends.
Represents the covered area of e.g.
int GetPositionOnLegend(Point pt)
Determines the mouse position on the legend.
StringID legend
String corresponding to the coloured item.
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
void BuildOwnerLegend()
Completes the array for the owned property legend.
void BuildIndustriesLegend()
Fills an array for the industries legends.
Coordinates of a point in 2D.
SmallMapType
Types of legends in the WID_SM_LEGEND widget.
WindowNumber window_number
Window number within the window class.
void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectMode mode)
Applies a certain FillRectMode-operation to a rectangle [left, right] x [top, bottom] on the screen.
void DrawSmallMapColumn(void *dst, uint xc, uint yc, int pitch, int reps, int start_pos, int end_pos, Blitter *blitter) const
Draws one column of tiles of the small map in a certain mode onto the screen buffer,...
void DrawWidget(const Rect &r, int widget) const override
Draw the contents of a nested widget.
static void BreakIndustryChainLink()
Notify the industry chain window to stop sending newly selected industries.
#define FONT_HEIGHT_SMALL
Height of characters in the small (FS_SMALL) font.
void OnRealtimeTick(uint delta_ms) override
Called periodically.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
void SetStringParameters(int widget) const override
Initialize string parameters for a widget.
int32 subscroll
Number of pixels (0..3) between the right end of the base tile and the pixel at the top-left corner o...
void OnScroll(Point delta) override
Handle the request for (viewport) scrolling.
void OnMouseOver(Point pt, int widget) override
The mouse is currently moving over the window or has just moved outside of the window.
void SetOverlayCargoMask()
Set the link graph overlay cargo mask from the legend.
void SetNewScroll(int sx, int sy, int sub)
Set new scroll_x, scroll_y, and subscroll values after limiting them such that the center of the smal...
static const uint INDUSTRY_MIN_NUMBER_OF_COLUMNS
Minimal number of columns in the WID_SM_LEGEND widget for the #SMT_INDUSTRY legend.
uint8 height
Height in tiles. Only valid for height legend entries.
uint8 colour
Colour of the item on the map.
bool show_on_map
For filtering industries, if true, industry is shown on the map in colour.
void DrawTowns(const DrawPixelInfo *dpi) const
Adds town names to the smallmap.
Point RemapTile(int tile_x, int tile_y) const
Remap tile to location on this smallmap.
int width
width of the window (number of pixels to the right in x direction)
GUITimer refresh
Refresh timer.
int32 scroll_y
Vertical world coordinate of the base tile left of the top-left corner of the smallmap display.
Data structure for an opened window.
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
void SelectLegendItem(int click_pos, LegendAndColour *legend, int end_legend_item, int begin_legend_item=0)
Select and toggle a legend item.
void RebuildColourIndexIfNecessary()
Rebuilds the colour indices used for fast access to the smallmap contour colours based on the heightl...
@ ZLC_INITIALIZE
Initialize zoom level.
Structure for holding relevant data for legends in small map.
Specification of a rectangle with absolute coordinates of all edges.
bool end
This is the end of the list.
Point PixelToTile(int px, int py, int *sub, bool add_sub=true) const
Determine the tile relative to the base tile of the smallmap, and the pixel position at that tile for...
static const uint FORCE_REFRESH_PERIOD
map is redrawn after that many milliseconds.
uint GetLegendHeight(uint num_columns) const
Compute height given a number of columns.
void OnMouseWheel(int wheel) override
The mouse wheel has been turned.
Data about how and where to blit pixels.
static const uint BLINK_PERIOD
highlight blinking interval in milliseconds.