MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / getVehicleColour

Function getVehicleColour

src/OpenLoco/src/Ui/Windows/MapWindow.cpp:1851–1880  ·  view source on GitHub ↗

0x0046C426

Source from the content-addressed store, hash-verified

1849
1850 // 0x0046C426
1851 static uint8_t getVehicleColour(WidgetIndex_t widgetIndex, Vehicles::Vehicle train, Vehicles::Car car)
1852 {
1853 auto colour = PaletteIndex::blackB;
1854
1855 if (widgetIndex == widx::tabOwnership || widgetIndex == widx::tabVehicles)
1856 {
1857 auto companyId = car.front->owner;
1858 colour = Colours::getShade(CompanyManager::getCompanyColour(companyId), 7);
1859
1860 if (widgetIndex == widx::tabVehicles)
1861 {
1862 auto index = enumValue(train.head->vehicleType);
1863 colour = vehicleTypeColours[index];
1864 }
1865
1866 // clang-format off
1867 auto vehicleType = train.head->vehicleType;
1868 if ((widgetIndex == widx::tabOwnership && _flashingItems & (1 << enumValue(companyId))) ||
1869 (widgetIndex == widx::tabVehicles && _flashingItems & (1 << enumValue(vehicleType))))
1870 {
1871 if (mapFrameNumber & (1 << 2))
1872 {
1873 colour = kFlashColours[colour];
1874 }
1875 }
1876 // clang-format on
1877 }
1878
1879 return colour;
1880 }
1881
1882 // 0x0046BFAD
1883 static void countVehiclesOnMap()

Callers 1

drawVehiclesOnMapFunction · 0.85

Calls 3

getShadeFunction · 0.85
getCompanyColourFunction · 0.85
enumValueFunction · 0.85

Tested by

no test coverage detected