MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / GetSmallMapOwnerPixels

Function GetSmallMapOwnerPixels

src/smallmap_gui.cpp:580–607  ·  view source on GitHub ↗

* 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) * @param tile The tile of which we would like to get the colour. * @param t Effective tile type of the tile (see #SmallMapWindow::GetTileColours). * @pa

Source from the content-addressed store, hash-verified

578 * @return The colour of tile in the small map in mode "Owner"
579 */
580uint32_t GetSmallMapOwnerPixels(TileIndex tile, TileType t, IncludeHeightmap include_heightmap)
581{
582 Owner o;
583
584 switch (t) {
585 case MP_VOID: return MKCOLOUR_XXXX(PC_BLACK);
586 case MP_INDUSTRY: return MKCOLOUR_XXXX(PC_DARK_GREY);
587 case MP_HOUSE: return MKCOLOUR_XXXX(PC_DARK_RED);
588 case MP_ROAD:
589 o = GetRoadOwner(tile, HasRoadTypeRoad(tile) ? RTT_ROAD : RTT_TRAM);
590 break;
591
592 default:
593 o = GetTileOwner(tile);
594 break;
595 }
596
597 if ((o < MAX_COMPANIES && !_legend_land_owners[_company_to_list_pos[o]].show_on_map) || o == OWNER_NONE || o == OWNER_WATER) {
598 if (t == MP_WATER) return MKCOLOUR_XXXX(PC_WATER);
599 const SmallMapColourScheme *cs = &_heightmap_schemes[_settings_client.gui.smallmap_land_colour];
600 return ((include_heightmap == IncludeHeightmap::IfEnabled && _smallmap_show_heightmap) || include_heightmap == IncludeHeightmap::Always)
601 ? cs->height_colours[TileHeight(tile)] : cs->default_colour;
602 } else if (o == OWNER_TOWN) {
603 return MKCOLOUR_XXXX(PC_DARK_RED);
604 }
605
606 return MKCOLOUR_XXXX(_legend_land_owners[_company_to_list_pos[o]].colour);
607}
608
609/** Vehicle colours in #SMT_VEHICLES mode. Indexed by #VehicleType. */
610static const PixelColour _vehicle_type_colours[6] = {

Callers 2

MinimapScreenCallbackFunction · 0.85
GetTileColoursMethod · 0.85

Calls 4

GetRoadOwnerFunction · 0.85
HasRoadTypeRoadFunction · 0.85
GetTileOwnerFunction · 0.85
TileHeightFunction · 0.85

Tested by

no test coverage detected