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

Function getStreetLightStyle

src/OpenLoco/src/World/Town.cpp:868–888  ·  view source on GitHub ↗

0x00498C6B roadObjId : bh townDensity : 0x01135C5F return : edi

Source from the content-addressed store, hash-verified

866 // townDensity : 0x01135C5F
867 // return : edi
868 static uint32_t getStreetLightStyle(uint8_t roadObjId, uint8_t townDensity)
869 {
870 auto* roadObj = ObjectManager::get<RoadObject>(roadObjId);
871 if (!roadObj->hasFlags(RoadObjectFlags::canHaveStreetLights) || townDensity == 0)
872 {
873 return 0;
874 }
875
876 return []() {
877 auto* streetLightObj = ObjectManager::get<StreetLightObject>();
878 const auto curYear = getCurrentYear();
879 for (auto i = 0U; i < std::size(streetLightObj->designedYear); ++i)
880 {
881 if (curYear < streetLightObj->designedYear[i])
882 {
883 return i;
884 }
885 }
886 return static_cast<uint32_t>(std::size(streetLightObj->designedYear));
887 }();
888 }
889
890 // 0x0047AC3E
891 static RoadInformation getRoadInformation(const World::Pos3& loc, Vehicles::TrackAndDirection::_RoadAndDirection tad)

Callers 1

growMethod · 0.85

Calls 2

getCurrentYearFunction · 0.85
hasFlagsMethod · 0.45

Tested by

no test coverage detected