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

Function getRouteColour

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

Source from the content-addressed store, hash-verified

1773 }
1774
1775 static std::optional<uint8_t> getRouteColour(Vehicles::Vehicle train)
1776 {
1777 uint8_t colour;
1778 if (train.head->vehicleType == VehicleType::aircraft)
1779 {
1780 colour = 211;
1781 auto index = Numerics::bitScanForward(_flashingItems);
1782 if (index != -1)
1783 {
1784 if (_routeToObjectIdMap[index] == 0xFE)
1785 {
1786 if (mapFrameNumber & (1 << 2))
1787 {
1788 colour = kFlashColours[colour];
1789 }
1790 }
1791 }
1792 }
1793 else if (train.head->vehicleType == VehicleType::ship)
1794 {
1795 colour = 139;
1796 auto index = Numerics::bitScanForward(_flashingItems);
1797 if (index != -1)
1798 {
1799 if (_routeToObjectIdMap[index] == 0xFD)
1800 {
1801 if (mapFrameNumber & (1 << 2))
1802 {
1803 colour = kFlashColours[colour];
1804 }
1805 }
1806 }
1807 }
1808 else
1809 {
1810 return std::nullopt;
1811 }
1812
1813 return colour;
1814 }
1815
1816 // 0x0046C18D
1817 static void drawRoutesOnMap(Gfx::DrawingContext& drawingCtx, Vehicles::Vehicle train)

Callers 1

drawRoutesOnMapFunction · 0.85

Calls 1

bitScanForwardFunction · 0.85

Tested by

no test coverage detected