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

Function countVehiclesOnMap

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

0x0046BFAD

Source from the content-addressed store, hash-verified

1881
1882 // 0x0046BFAD
1883 static void countVehiclesOnMap()
1884 {
1885 for (auto i = 0; i < 6; i++)
1886 {
1887 _vehicleTypeCounts[i] = 0;
1888 }
1889
1890 for (auto* vehicle : VehicleManager::VehicleList())
1891 {
1892 Vehicles::Vehicle train(*vehicle);
1893
1894 if (train.head->has38Flags(Vehicles::Flags38::isGhost))
1895 {
1896 continue;
1897 }
1898
1899 if (train.head->position.x == Location::null)
1900 {
1901 continue;
1902 }
1903
1904 auto vehicleType = train.head->vehicleType;
1905 _vehicleTypeCounts[static_cast<uint8_t>(vehicleType)] = _vehicleTypeCounts[static_cast<uint8_t>(vehicleType)] + 1;
1906 }
1907 }
1908
1909 // 0x0046BE6E, 0x0046C35A
1910 static void drawVehiclesOnMap(Gfx::DrawingContext& drawingCtx, WidgetIndex_t widgetIndex)

Callers 1

drawScrollFunction · 0.85

Calls 1

has38FlagsMethod · 0.80

Tested by

no test coverage detected