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

Function GetSmallMapRoutesPixels

src/smallmap_gui.cpp:468–515  ·  view source on GitHub ↗

* Return the colour a tile would be displayed with in the small map in mode "Routes". * * @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 small map in mode "Routes" */

Source from the content-addressed store, hash-verified

466 * @return The colour of tile in the small map in mode "Routes"
467 */
468static inline uint32_t GetSmallMapRoutesPixels(TileIndex tile, TileType t)
469{
470 switch (t) {
471 case MP_STATION:
472 switch (GetStationType(tile)) {
473 case StationType::Rail: return MKCOLOUR_XXXX(PC_VERY_DARK_BROWN);
474 case StationType::Airport: return MKCOLOUR_XXXX(PC_RED);
475 case StationType::Truck: return MKCOLOUR_XXXX(PC_ORANGE);
476 case StationType::Bus: return MKCOLOUR_XXXX(PC_YELLOW);
477 case StationType::Dock: return MKCOLOUR_XXXX(PC_LIGHT_BLUE);
478 default: return MKCOLOUR_FFFF;
479 }
480
481 case MP_RAILWAY: {
482 AndOr andor = {
483 MKCOLOUR_0XX0(GetRailTypeInfo(GetRailType(tile))->map_colour),
484 _smallmap_contours_andor[t].mand
485 };
486
487 const SmallMapColourScheme *cs = &_heightmap_schemes[_settings_client.gui.smallmap_land_colour];
488 return ApplyMask(cs->default_colour, &andor);
489 }
490
491 case MP_ROAD: {
492 const RoadTypeInfo *rti = nullptr;
493 if (GetRoadTypeRoad(tile) != INVALID_ROADTYPE) {
494 rti = GetRoadTypeInfo(GetRoadTypeRoad(tile));
495 } else {
496 rti = GetRoadTypeInfo(GetRoadTypeTram(tile));
497 }
498 if (rti != nullptr) {
499 AndOr andor = {
500 MKCOLOUR_0XX0(rti->map_colour),
501 _smallmap_contours_andor[t].mand
502 };
503
504 const SmallMapColourScheme *cs = &_heightmap_schemes[_settings_client.gui.smallmap_land_colour];
505 return ApplyMask(cs->default_colour, &andor);
506 }
507 [[fallthrough]];
508 }
509
510 default:
511 /* Ground colour */
512 const SmallMapColourScheme *cs = &_heightmap_schemes[_settings_client.gui.smallmap_land_colour];
513 return ApplyMask(cs->default_colour, &_smallmap_contours_andor[t]);
514 }
515}
516
517/**
518 * Return the colour a tile would be displayed with in the small map in mode "link stats".

Callers 2

GetTileColoursMethod · 0.85

Calls 7

GetStationTypeFunction · 0.85
GetRailTypeInfoFunction · 0.85
GetRailTypeFunction · 0.85
ApplyMaskFunction · 0.85
GetRoadTypeRoadFunction · 0.85
GetRoadTypeInfoFunction · 0.85
GetRoadTypeTramFunction · 0.85

Tested by

no test coverage detected