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

Method updateVehicleColours

src/OpenLoco/src/World/Company.cpp:787–808  ·  view source on GitHub ↗

0x004B8ED2

Source from the content-addressed store, hash-verified

785
786 // 0x004B8ED2
787 void Company::updateVehicleColours()
788 {
789 for (auto* v : VehicleManager::VehicleList())
790 {
791 if (v->owner != id())
792 {
793 continue;
794 }
795 Vehicles::Vehicle train(*v);
796 for (auto& car : train.cars)
797 {
798 const auto* vehObject = car.body->getObject();
799 auto colour = mainColours;
800 if (customVehicleColoursSet & (1 << vehObject->colourType))
801 {
802 colour = vehicleColours[vehObject->colourType - 1];
803 }
804 car.applyToComponents([colour](auto& component) { component.colourScheme = colour; });
805 }
806 }
807 Gfx::invalidateScreen();
808 }
809
810 // 0x0042F0C1
811 static void updateHeadquartersColourAtTile(const World::TilePos2& pos, uint8_t zPos, Colour newColour)

Callers 1

changeCompanyColourFunction · 0.80

Calls 3

invalidateScreenFunction · 0.85
getObjectMethod · 0.45
applyToComponentsMethod · 0.45

Tested by

no test coverage detected