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

Function GetSmallMapVegetationPixels

src/smallmap_gui.cpp:547–569  ·  view source on GitHub ↗

* Return the colour a tile would be displayed with in the smallmap in mode "Vegetation". * * @param tile The tile of which we would like to get the colour. * @param t Effective tile type of the tile (see #SmallMapWindow::GetTileColours). * @return The colour of tile in the smallmap in mode "Vegetation" */

Source from the content-addressed store, hash-verified

545 * @return The colour of tile in the smallmap in mode "Vegetation"
546 */
547static inline uint32_t GetSmallMapVegetationPixels(TileIndex tile, TileType t)
548{
549 switch (t) {
550 case MP_CLEAR:
551 if (IsClearGround(tile, CLEAR_GRASS)) {
552 if (GetClearDensity(tile) < 3) return MKCOLOUR_XXXX(PC_BARE_LAND);
553 if (GetTropicZone(tile) == TROPICZONE_RAINFOREST) return MKCOLOUR_XXXX(PC_RAINFOREST);
554 }
555 return _vegetation_clear_bits[IsSnowTile(tile) ? CLEAR_SNOW : GetClearGround(tile)];
556
557 case MP_INDUSTRY:
558 return IsTileForestIndustry(tile) ? MKCOLOUR_XXXX(PC_GREEN) : MKCOLOUR_XXXX(PC_DARK_RED);
559
560 case MP_TREES:
561 if (GetTreeGround(tile) == TREE_GROUND_SNOW_DESERT || GetTreeGround(tile) == TREE_GROUND_ROUGH_SNOW) {
562 return (_settings_game.game_creation.landscape == LandscapeType::Arctic) ? MKCOLOUR_XYYX(PC_LIGHT_BLUE, PC_TREES) : MKCOLOUR_XYYX(PC_ORANGE, PC_TREES);
563 }
564 return (GetTropicZone(tile) == TROPICZONE_RAINFOREST) ? MKCOLOUR_XYYX(PC_RAINFOREST, PC_TREES) : MKCOLOUR_XYYX(PC_GRASS_LAND, PC_TREES);
565
566 default:
567 return ApplyMask(MKCOLOUR_XXXX(PC_GRASS_LAND), &_smallmap_vehicles_andor[t]);
568 }
569}
570
571/**
572 * Return the colour a tile would be displayed with in the small map in mode "Owner".

Callers 1

GetTileColoursMethod · 0.85

Calls 8

IsClearGroundFunction · 0.85
GetClearDensityFunction · 0.85
GetTropicZoneFunction · 0.85
IsSnowTileFunction · 0.85
GetClearGroundFunction · 0.85
IsTileForestIndustryFunction · 0.85
GetTreeGroundFunction · 0.85
ApplyMaskFunction · 0.85

Tested by

no test coverage detected