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

Function drawVehiclesOnMap

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

0x0046BE6E, 0x0046C35A

Source from the content-addressed store, hash-verified

1908
1909 // 0x0046BE6E, 0x0046C35A
1910 static void drawVehiclesOnMap(Gfx::DrawingContext& drawingCtx, WidgetIndex_t widgetIndex)
1911 {
1912 for (auto* vehicle : VehicleManager::VehicleList())
1913 {
1914 Vehicles::Vehicle train(*vehicle);
1915
1916 if (train.head->has38Flags(Vehicles::Flags38::isGhost))
1917 {
1918 continue;
1919 }
1920
1921 if (train.head->position.x == Location::null)
1922 {
1923 continue;
1924 }
1925
1926 for (auto& car : train.cars)
1927 {
1928 auto colour = getVehicleColour(widgetIndex, train, car);
1929 car.applyToComponents([&drawingCtx, colour](auto& component) {
1930 drawVehicleOnMap(drawingCtx, &component, colour);
1931 });
1932 }
1933
1934 if (widgetIndex == widx::tabRoutes)
1935 {
1936 drawRoutesOnMap(drawingCtx, train);
1937 }
1938 }
1939 }
1940
1941 // 0x0046BE51, 0x0046BE34
1942 static void drawRectOnMap(Gfx::DrawingContext& drawingCtx, int16_t left, int16_t top, int16_t right, int16_t bottom, uint8_t colour, Gfx::RectFlags flags)

Callers 1

drawScrollFunction · 0.85

Calls 5

getVehicleColourFunction · 0.85
drawVehicleOnMapFunction · 0.85
drawRoutesOnMapFunction · 0.85
has38FlagsMethod · 0.80
applyToComponentsMethod · 0.45

Tested by

no test coverage detected