12 #ifndef SMALLMAP_GUI_H 13 #define SMALLMAP_GUI_H 68 static const uint LEGEND_BLOB_WIDTH = 8;
69 static const uint INDUSTRY_MIN_NUMBER_OF_COLUMNS = 2;
70 static const uint FORCE_REFRESH_PERIOD = 0x1F;
71 static const uint BLINK_PERIOD = 0x0F;
85 static void BreakIndustryChainLink();
86 Point SmallmapRemapCoords(
int x,
int y)
const;
127 return width / this->column_width;
151 void RebuildColourIndexIfNecessary();
152 uint GetNumberRowsLegend(uint columns)
const;
153 void SelectLegendItem(
int click_pos,
LegendAndColour *
legend,
int end_legend_item,
int begin_legend_item = 0);
155 void SetNewScroll(
int sx,
int sy,
int sub);
157 void DrawMapIndicators()
const;
158 void DrawSmallMapColumn(
void *dst, uint xc, uint yc,
int pitch,
int reps,
int start_pos,
int end_pos,
Blitter *blitter)
const;
163 Point RemapTile(
int tile_x,
int tile_y)
const;
164 Point PixelToTile(
int px,
int py,
int *sub,
bool add_sub =
true)
const;
165 Point ComputeScroll(
int tx,
int ty,
int x,
int y,
int *sub);
167 void SetOverlayCargoMask();
168 void SetupWidgetData();
169 uint32 GetTileColours(
const TileArea &ta)
const;
171 int GetPositionOnLegend(
Point pt);
179 void SmallMapCenterOnCurrentPos();
182 virtual void SetStringParameters(
int widget)
const;
183 virtual void OnInit();
184 virtual void OnPaint();
185 virtual void DrawWidget(
const Rect &r,
int widget)
const;
186 virtual void OnClick(
Point pt,
int widget,
int click_count);
187 virtual void OnInvalidateData(
int data = 0,
bool gui_scope =
true);
188 virtual bool OnRightClick(
Point pt,
int widget);
189 virtual void OnMouseWheel(
int wheel);
190 virtual void OnTick();
191 virtual void OnScroll(
Point delta);
192 virtual void OnMouseOver(
Point pt,
int widget);
Functions related to OTTD's strings.
Definition of stuff that is very close to a company, like the company struct itself.
Data about how and where to blit pixels.
uint8 colour
Colour of the item on the map.
Types related to the industry.
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...
int zoom
Zoom level. Bigger number means more zoom-out (further away).
High level window description.
uint column_width
Width of a column in the WID_SM_LEGEND widget.
Offset at top to draw the frame rectangular area.
static void DrawVertMapIndicator(int x, int y, int y2)
Draws vertical part of map indicator.
uint GetNumberColumnsLegend(uint width) const
Return number of columns that can be displayed in width pixels.
uint GetMinLegendWidth() const
Compute minimal required width of the legends.
uint8 refresh
Refresh counter, zeroed every FORCE_REFRESH_PERIOD ticks.
ZoomLevelChange
Available kinds of zoomlevel changes.
Structure for holding relevant data for legends in small map.
uint GetLegendHeight(uint num_columns) const
Compute height given a number of columns.
uint8 height
Height in tiles. Only valid for height legend entries.
How all blitters should look like.
bool show_on_map
For filtering industries, if true, industry is shown on the map in colour.
Functions, definitions and such used only by the GUI.
CompanyByte _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
static void DrawHorizMapIndicator(int x, int x2, int y)
Draws horizontal part of map indicator.
Declaration of linkgraph overlay GUI.
Data structure for an opened window.
static SmallMapType map_type
Currently displayed legends.
SmallMapType
Types of legends in the WID_SM_LEGEND widget.
bool end
This is the end of the list.
IndustryType type
Type of industry. Only valid for industry entries.
#define FONT_HEIGHT_SMALL
Height of characters in the small (FS_SMALL) font.
Class managing the smallmap window.
void BuildLandLegend()
(Re)build the colour tables for the legends.
void ShowSmallMap()
Show the smallmap window.
void BuildOwnerLegend()
Completes the array for the owned property legend.
uint32 GetOverlayCompanyMask() const
Get a bitmask for company links to be displayed.
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...
CompanyID company
Company to display. Only valid for company entries of the owner legend.
Represents the covered area of e.g.
void BuildLinkStatsLegend()
Populate legend table for the link stat view.
Offset at bottom to draw the frame rectangular area.
static bool show_towns
Display town names in the smallmap.
int32 scroll_y
Vertical world coordinate of the base tile left of the top-left corner of the smallmap display...
uint32 StringID
Numeric value that represents a string, independent of the selected language.
static int max_heightlevel
Currently used/cached maximum heightlevel.
void BuildIndustriesLegend()
Fills an array for the industries legends.
bool col_break
Perform a column break and go further at the next column.
Coordinates of a point in 2D.
int32 subscroll
Number of pixels (0..3) between the right end of the base tile and the pixel at the top-left corner o...
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-NULL) Titem.
StringID legend
String corresponding to the coloured item.
uint min_number_of_fixed_rows
Minimal number of rows in the legends for the fixed layouts only (all except #SMT_INDUSTRY).
Specification of a rectangle with absolute coordinates of all edges.
Owner
Enum for all companies/owners.
static const uint8 PC_VERY_LIGHT_YELLOW
Almost-white yellow palette colour.
Offset at left to draw the frame rectangular area.
Factory to 'query' all available blitters.
Handles drawing of links into some window.