#include "stdafx.h"
#include "openttd.h"
#include "bridge_map.h"
#include "clear_map.h"
#include "industry_map.h"
#include "industry.h"
#include "station_map.h"
#include "landscape.h"
#include "gui.h"
#include "window_gui.h"
#include "tree_map.h"
#include "tunnel_map.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "player_base.h"
#include "town.h"
#include "variables.h"
#include "blitter/factory.hpp"
#include "tunnelbridge_map.h"
#include "strings_func.h"
#include "zoom_func.h"
#include "core/endian_func.hpp"
#include "vehicle_base.h"
#include "sound_func.h"
#include "settings_type.h"
#include "table/strings.h"
#include "table/sprites.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 | AndOr |
Defines | |
#define | MK(a, b) {a, b, INVALID_INDUSTRYTYPE, true, false, false} |
Macro for ordinary entry of LegendAndColor. | |
#define | MKEND() {0, STR_NULL, INVALID_INDUSTRYTYPE, true, true, false} |
Macro for end of list marker in arrays of LegendAndColor. | |
#define | MS(a, b) {a, b, INVALID_INDUSTRYTYPE, true, false, true} |
Macro for break marker in arrays of LegendAndColor. | |
#define | MKCOLOR(x) TO_LE32X(x) |
Typedefs | |
typedef uint32 | GetSmallMapPixels (TileIndex tile) |
Enumerations | |
enum | SmallMapWindowWidgets { SM_WIDGET_MAP = 4, SM_WIDGET_CONTOUR, SM_WIDGET_VEHICLES, SM_WIDGET_INDUSTRIES, SM_WIDGET_ROUTES, SM_WIDGET_VEGETATION, SM_WIDGET_OWNERS, SM_WIDGET_CENTERMAP, SM_WIDGET_TOGGLETOWNNAME, SM_WIDGET_LEGEND, SM_WIDGET_BUTTONSPANEL, SM_WIDGET_BOTTOMPANEL, SM_WIDGET_ENABLEINDUSTRIES, SM_WIDGET_DISABLEINDUSTRIES, SM_WIDGET_RESIZEBOX } |
enum | SmallMapType { SMT_CONTOUR, SMT_VEHICLES, SMT_INDUSTRY, SMT_OWNER = 5 } |
enum | { BASE_NB_PER_COLUMN = 6 } |
Functions | |
void | BuildIndustriesLegend () |
Fills an array for the industries legends. | |
assert_compile (lengthof(_map_height_bits)==MAX_TILE_HEIGHT+1) | |
static uint32 | ApplyMask (uint32 colour, const AndOr *mask) |
static void | DrawSmallMapStuff (void *dst, uint xc, uint yc, int pitch, int reps, uint32 mask, GetSmallMapPixels *proc) |
Draws one column of the small map in a certain mode onto the screen buffer. | |
static TileType | GetEffectiveTileType (TileIndex tile) |
static uint32 | GetSmallMapContoursPixels (TileIndex tile) |
Return the color a tile would be displayed with in the small map in mode "Contour". | |
static uint32 | GetSmallMapVehiclesPixels (TileIndex tile) |
Return the color a tile would be displayed with in the small map in mode "Vehicles". | |
static uint32 | GetSmallMapIndustriesPixels (TileIndex tile) |
Return the color a tile would be displayed with in the small map in mode "Industries". | |
static uint32 | GetSmallMapRoutesPixels (TileIndex tile) |
Return the color a tile would be displayed with in the small map in mode "Routes". | |
static uint32 | GetSmallMapVegetationPixels (TileIndex tile) |
static uint32 | GetSmallMapOwnerPixels (TileIndex tile) |
Return the color a tile would be displayed with in the small map in mode "Owner". | |
static void | DrawVertMapIndicator (int x, int y, int x2, int y2) |
static void | DrawHorizMapIndicator (int x, int y, int x2, int y2) |
static void | DrawSmallMap (DrawPixelInfo *dpi, Window *w, int type, bool show_towns) |
Draws the small map. | |
void | SmallMapCenterOnCurrentPos (Window *w) |
static void | SmallMapWindowProc (Window *w, WindowEvent *e) |
void | ShowSmallMap () |
static void | ExtraViewPortWndProc (Window *w, WindowEvent *e) |
void | ShowExtraViewPortWindow () |
Variables | |
static const Widget | _smallmap_widgets [] |
static int | _smallmap_type |
static bool | _smallmap_show_towns = true |
static int | _smallmap_industry_count |
static uint | _industries_per_column |
static const 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 const LegendAndColour | _legend_land_owners [] |
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 indutry slots all filled up. | |
static uint | _industry_to_list_pos [NUM_INDUSTRYTYPES] |
static const LegendAndColour *const | _legend_table [] |
static const uint32 | _map_height_bits [] |
Height encodings; MAX_TILE_HEIGHT + 1 levels, from 0 to MAX_TILE_HEIGHT. | |
static const AndOr | _smallmap_contours_andor [] |
static const AndOr | _smallmap_vehicles_andor [] |
static const AndOr | _smallmap_vegetation_andor [] |
static const uint32 | _vegetation_clear_bits [] |
static uint32 | _owner_colors [OWNER_END+1] |
static const uint32 | _smallmap_mask_left [3] |
static const uint32 | _smallmap_mask_right [] |
static GetSmallMapPixels * | _smallmap_draw_procs [] |
static const byte | _vehicle_type_colors [6] |
static const WindowDesc | _smallmap_desc |
static const Widget | _extra_view_port_widgets [] |
static const WindowDesc | _extra_view_port_desc |
Definition in file smallmap_gui.cpp.
#define MS | ( | a, | |||
b | ) | {a, b, INVALID_INDUSTRYTYPE, true, false, true} |
Macro for break marker in arrays of LegendAndColor.
It will have valid data, though
Definition at line 71 of file smallmap_gui.cpp.
static void DrawSmallMap | ( | DrawPixelInfo * | dpi, | |
Window * | w, | |||
int | type, | |||
bool | show_towns | |||
) | [static] |
Draws the small map.
Basically, the small map is draw column of pixels by column of pixels. The pixels are drawn directly into the screen buffer. The final map is drawn in multiple passes. The passes are:
dpi | pointer to pixel to write onto | |
w | pointer to Window struct | |
type | type of map requested (vegetation, owners, routes, etc) | |
show_towns | true if the town names should be displayed, false if not. |
Definition at line 578 of file smallmap_gui.cpp.
References _colour_gradient, DrawSmallMapStuff(), BlitterFactoryBase::GetCurrentBlitter(), IsInsideMM(), Blitter::MoveTo(), OWNER_END, OWNER_NONE, OWNER_TOWN, OWNER_WATER, Blitter::SetPixel(), TILE_SIZE, TileX(), and TileY().
static void DrawSmallMapStuff | ( | void * | dst, | |
uint | xc, | |||
uint | yc, | |||
int | pitch, | |||
int | reps, | |||
uint32 | mask, | |||
GetSmallMapPixels * | proc | |||
) | [static] |
Draws one column of the small map in a certain mode onto the screen buffer.
This function looks exactly the same for all types
dst | Pointer to a part of the screen buffer to write to. | |
xc | The X coordinate of the first tile in the column. | |
yc | The Y coordinate of the first tile in the column | |
pitch | Number of pixels to advance in the screen buffer each time a pixel is written. | |
reps | Number of lines to draw | |
mask | ? | |
proc | Pointer to the colour function |
Definition at line 304 of file smallmap_gui.cpp.
References BlitterFactoryBase::GetCurrentBlitter(), MapMaxX(), MapMaxY(), Blitter::MoveTo(), Blitter::SetPixelIfEmpty(), and TileXY().
Referenced by DrawSmallMap().
static uint32 GetSmallMapContoursPixels | ( | TileIndex | tile | ) | [inline, static] |
Return the color a tile would be displayed with in the small map in mode "Contour".
tile | The tile of which we would like to get the color. |
Definition at line 359 of file smallmap_gui.cpp.
References _map_height_bits, and TileHeight().
static uint32 GetSmallMapIndustriesPixels | ( | TileIndex | tile | ) | [inline, static] |
Return the color a tile would be displayed with in the small map in mode "Industries".
tile | The tile of which we would like to get the color. |
Definition at line 386 of file smallmap_gui.cpp.
References GetIndustryByTile(), GetIndustrySpec(), IndustrySpec::map_colour, MP_CLEAR, and MP_INDUSTRY.
static uint32 GetSmallMapOwnerPixels | ( | TileIndex | tile | ) | [inline, static] |
Return the color a tile would be displayed with in the small map in mode "Owner".
tile | The tile of which we would like to get the color. |
Definition at line 485 of file smallmap_gui.cpp.
References GetTileOwner(), GetTileType(), MP_HOUSE, MP_INDUSTRY, OWNER_END, and OWNER_TOWN.
static uint32 GetSmallMapRoutesPixels | ( | TileIndex | tile | ) | [inline, static] |
Return the color a tile would be displayed with in the small map in mode "Routes".
tile | The tile of which we would like to get the color. |
Definition at line 409 of file smallmap_gui.cpp.
References MP_STATION.
static uint32 GetSmallMapVehiclesPixels | ( | TileIndex | tile | ) | [inline, static] |
Return the color a tile would be displayed with in the small map in mode "Vehicles".
tile | The tile of which we would like to get the color. |
Definition at line 373 of file smallmap_gui.cpp.
const WindowDesc _extra_view_port_desc [static] |
Initial value:
{ WDP_AUTO, WDP_AUTO, 300, 68, 300, 268, WC_EXTRA_VIEW_PORT, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, _extra_view_port_widgets, ExtraViewPortWndProc }
Definition at line 1188 of file smallmap_gui.cpp.
const Widget _extra_view_port_widgets[] [static] |
Initial value:
{ { WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, { WWT_CAPTION, RESIZE_RIGHT, 14, 11, 287, 0, 13, STR_EXTRA_VIEW_PORT_TITLE, STR_018C_WINDOW_TITLE_DRAG_THIS}, { WWT_STICKYBOX, RESIZE_LR, 14, 288, 299, 0, 13, 0x0, STR_STICKY_BUTTON}, { WWT_PANEL, RESIZE_RB, 14, 0, 299, 14, 33, 0x0, STR_NULL}, { WWT_INSET, RESIZE_RB, 14, 2, 297, 16, 31, 0x0, STR_NULL}, { WWT_PUSHIMGBTN, RESIZE_TB, 14, 0, 21, 34, 55, SPR_IMG_ZOOMIN, STR_017F_ZOOM_THE_VIEW_IN}, { WWT_PUSHIMGBTN, RESIZE_TB, 14, 22, 43, 34, 55, SPR_IMG_ZOOMOUT, STR_0180_ZOOM_THE_VIEW_OUT}, { WWT_PUSHTXTBTN, RESIZE_TB, 14, 44, 171, 34, 55, STR_EXTRA_VIEW_MOVE_MAIN_TO_VIEW, STR_EXTRA_VIEW_MOVE_MAIN_TO_VIEW_TT}, { WWT_PUSHTXTBTN, RESIZE_TB, 14, 172, 298, 34, 55, STR_EXTRA_VIEW_MOVE_VIEW_TO_MAIN, STR_EXTRA_VIEW_MOVE_VIEW_TO_MAIN_TT}, { WWT_PANEL, RESIZE_RTB, 14, 299, 299, 34, 55, 0x0, STR_NULL}, { WWT_PANEL, RESIZE_RTB, 14, 0, 287, 56, 67, 0x0, STR_NULL}, { WWT_RESIZEBOX, RESIZE_LRTB, 14, 288, 299, 56, 67, 0x0, STR_RESIZE_BUTTON}, { WIDGETS_END}, }
Definition at line 1094 of file smallmap_gui.cpp.
const LegendAndColour _legend_land_contours[] [static] |
Initial value:
{ MK(0x5A, STR_00F0_100M), MK(0x5C, STR_00F1_200M), MK(0x5E, STR_00F2_300M), MK(0x1F, STR_00F3_400M), MK(0x27, STR_00F4_500M), MS(0xD7, STR_00EB_ROADS), MK(0x0A, STR_00EC_RAILROADS), MK(0x98, STR_00ED_STATIONS_AIRPORTS_DOCKS), MK(0xB5, STR_00EE_BUILDINGS_INDUSTRIES), MK(0x0F, STR_00EF_VEHICLES), }
Definition at line 84 of file smallmap_gui.cpp.
const LegendAndColour _legend_land_owners[] [static] |
const LegendAndColour _legend_routes[] [static] |
Initial value:
{ MK(0xD7, STR_00EB_ROADS), MK(0x0A, STR_00EC_RAILROADS), MK(0xB5, STR_00EE_BUILDINGS_INDUSTRIES), MS(0x56, STR_011B_RAILROAD_STATION), MK(0xC2, STR_011C_TRUCK_LOADING_BAY), MK(0xBF, STR_011D_BUS_STATION), MK(0xB8, STR_011E_AIRPORT_HELIPORT), MK(0x98, STR_011F_DOCK), }
Definition at line 109 of file smallmap_gui.cpp.
const LegendAndColour* const _legend_table[] [static] |
Initial value:
{ _legend_land_contours, _legend_vehicles, _legend_from_industries, _legend_routes, _legend_vegetation, _legend_land_owners, }
Definition at line 199 of file smallmap_gui.cpp.
const LegendAndColour _legend_vegetation[] [static] |
Initial value:
{ MK(0x52, STR_0120_ROUGH_LAND), MK(0x54, STR_0121_GRASS_LAND), MK(0x37, STR_0122_BARE_LAND), MK(0x25, STR_0123_FIELDS), MK(0x57, STR_0124_TREES), MK(0xD0, STR_00FC_FOREST), MS(0x0A, STR_0125_ROCKS), MK(0xC2, STR_012A_DESERT), MK(0x98, STR_012B_SNOW), MK(0xD7, STR_00F9_TRANSPORT_ROUTES), MK(0xB5, STR_00EE_BUILDINGS_INDUSTRIES), }
Definition at line 122 of file smallmap_gui.cpp.
const LegendAndColour _legend_vehicles[] [static] |
const uint32 _map_height_bits[] [static] |
Initial value:
{ MKCOLOR(0x5A5A5A5A), MKCOLOR(0x5A5B5A5B), MKCOLOR(0x5B5B5B5B), MKCOLOR(0x5B5C5B5C), MKCOLOR(0x5C5C5C5C), MKCOLOR(0x5C5D5C5D), MKCOLOR(0x5D5D5D5D), MKCOLOR(0x5D5E5D5E), MKCOLOR(0x5E5E5E5E), MKCOLOR(0x5E5F5E5F), MKCOLOR(0x5F5F5F5F), MKCOLOR(0x5F1F5F1F), MKCOLOR(0x1F1F1F1F), MKCOLOR(0x1F271F27), MKCOLOR(0x27272727), MKCOLOR(0x27272727), }
Definition at line 213 of file smallmap_gui.cpp.
Referenced by GetSmallMapContoursPixels().
const AndOr _smallmap_contours_andor[] [static] |
Initial value:
{ {MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)}, {MKCOLOR(0x000A0A00), MKCOLOR(0xFF0000FF)}, {MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)}, {MKCOLOR(0x00B5B500), MKCOLOR(0xFF0000FF)}, {MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)}, {MKCOLOR(0x98989898), MKCOLOR(0x00000000)}, {MKCOLOR(0xCACACACA), MKCOLOR(0x00000000)}, {MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)}, {MKCOLOR(0xB5B5B5B5), MKCOLOR(0x00000000)}, {MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)}, {MKCOLOR(0x00B5B500), MKCOLOR(0xFF0000FF)}, {MKCOLOR(0x000A0A00), MKCOLOR(0xFF0000FF)}, }
Definition at line 244 of file smallmap_gui.cpp.
const WindowDesc _smallmap_desc [static] |
Initial value:
{ WDP_AUTO, WDP_AUTO, 350, 214, 446, 314, WC_SMALLMAP, WC_NONE, WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_RESIZABLE, _smallmap_widgets, SmallMapWindowProc }
Definition at line 1047 of file smallmap_gui.cpp.
GetSmallMapPixels* _smallmap_draw_procs[] [static] |
Initial value:
{ GetSmallMapContoursPixels, GetSmallMapVehiclesPixels, GetSmallMapIndustriesPixels, GetSmallMapRoutesPixels, GetSmallMapVegetationPixels, GetSmallMapOwnerPixels, }
Definition at line 513 of file smallmap_gui.cpp.
const uint32 _smallmap_mask_left[3] [static] |
Initial value:
{ MKCOLOR(0xFF000000), MKCOLOR(0xFFFF0000), MKCOLOR(0xFFFFFF00), }
Definition at line 499 of file smallmap_gui.cpp.
const uint32 _smallmap_mask_right[] [static] |
Initial value:
{ MKCOLOR(0x000000FF), MKCOLOR(0x0000FFFF), MKCOLOR(0x00FFFFFF), }
Definition at line 505 of file smallmap_gui.cpp.
const AndOr _smallmap_vegetation_andor[] [static] |
Initial value:
{ {MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)}, {MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)}, {MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)}, {MKCOLOR(0x00B5B500), MKCOLOR(0xFF0000FF)}, {MKCOLOR(0x00575700), MKCOLOR(0xFF0000FF)}, {MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)}, {MKCOLOR(0xCACACACA), MKCOLOR(0x00000000)}, {MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)}, {MKCOLOR(0xB5B5B5B5), MKCOLOR(0x00000000)}, {MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)}, {MKCOLOR(0x00B5B500), MKCOLOR(0xFF0000FF)}, {MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)}, }
Definition at line 274 of file smallmap_gui.cpp.
const AndOr _smallmap_vehicles_andor[] [static] |
Initial value:
{ {MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)}, {MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)}, {MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)}, {MKCOLOR(0x00B5B500), MKCOLOR(0xFF0000FF)}, {MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)}, {MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)}, {MKCOLOR(0xCACACACA), MKCOLOR(0x00000000)}, {MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)}, {MKCOLOR(0xB5B5B5B5), MKCOLOR(0x00000000)}, {MKCOLOR(0x00000000), MKCOLOR(0xFFFFFFFF)}, {MKCOLOR(0x00B5B500), MKCOLOR(0xFF0000FF)}, {MKCOLOR(0x00D7D700), MKCOLOR(0xFF0000FF)}, }
Definition at line 259 of file smallmap_gui.cpp.
const Widget _smallmap_widgets[] [static] |
Initial value:
{ { WWT_CLOSEBOX, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, { WWT_CAPTION, RESIZE_RIGHT, 13, 11, 337, 0, 13, STR_00B0_MAP, STR_018C_WINDOW_TITLE_DRAG_THIS}, { WWT_STICKYBOX, RESIZE_LR, 13, 338, 349, 0, 13, 0x0, STR_STICKY_BUTTON}, { WWT_PANEL, RESIZE_RB, 13, 0, 349, 14, 157, 0x0, STR_NULL}, { WWT_INSET, RESIZE_RB, 13, 2, 347, 16, 155, 0x0, STR_NULL}, { WWT_IMGBTN, RESIZE_LRTB, 13, 284, 305, 158, 179, SPR_IMG_SHOW_COUNTOURS, STR_0191_SHOW_LAND_CONTOURS_ON_MAP}, { WWT_IMGBTN, RESIZE_LRTB, 13, 306, 327, 158, 179, SPR_IMG_SHOW_VEHICLES, STR_0192_SHOW_VEHICLES_ON_MAP}, { WWT_IMGBTN, RESIZE_LRTB, 13, 328, 349, 158, 179, SPR_IMG_INDUSTRY, STR_0193_SHOW_INDUSTRIES_ON_MAP}, { WWT_IMGBTN, RESIZE_LRTB, 13, 284, 307, 180, 201, SPR_IMG_SHOW_ROUTES, STR_0194_SHOW_TRANSPORT_ROUTES_ON}, { WWT_IMGBTN, RESIZE_LRTB, 13, 306, 327, 180, 201, SPR_IMG_PLANTTREES, STR_0195_SHOW_VEGETATION_ON_MAP}, { WWT_IMGBTN, RESIZE_LRTB, 13, 328, 349, 180, 201, SPR_IMG_COMPANY_GENERAL, STR_0196_SHOW_LAND_OWNERS_ON_MAP}, { WWT_IMGBTN, RESIZE_LRTB, 13, 262, 283, 158, 179, SPR_IMG_SMALLMAP, STR_SMALLMAP_CENTER}, { WWT_IMGBTN, RESIZE_LRTB, 13, 262, 283, 180, 201, SPR_IMG_TOWN, STR_0197_TOGGLE_TOWN_NAMES_ON_OFF}, { WWT_PANEL, RESIZE_RTB, 13, 0, 261, 158, 201, 0x0, STR_NULL}, { WWT_PANEL, RESIZE_LRTB, 13, 262, 349, 202, 202, 0x0, STR_NULL}, { WWT_PANEL, RESIZE_RTB, 13, 0, 337, 202, 213, 0x0, STR_NULL}, { WWT_TEXTBTN, RESIZE_TB, 13, 0, 99, 202, 213, STR_MESSAGES_ENABLE_ALL, STR_NULL}, { WWT_TEXTBTN, RESIZE_TB, 13, 100, 201, 202, 213, STR_MESSAGES_DISABLE_ALL,STR_NULL}, { WWT_RESIZEBOX, RESIZE_LRTB, 13, 338, 349, 202, 213, 0x0, STR_RESIZE_BUTTON}, { WIDGETS_END}, }
Definition at line 35 of file smallmap_gui.cpp.
const uint32 _vegetation_clear_bits[] [static] |
Initial value:
{ MKCOLOR(0x54545454), MKCOLOR(0x52525252), MKCOLOR(0x0A0A0A0A), MKCOLOR(0x25252525), MKCOLOR(0x98989898), MKCOLOR(0xC2C2C2C2), MKCOLOR(0x54545454), MKCOLOR(0x54545454), }
Definition at line 431 of file smallmap_gui.cpp.
const byte _vehicle_type_colors[6] [static] |