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

Function applyToMultiTile

src/OpenLoco/src/Map/IndustryElement.cpp:69–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67 // A more generic version of the vanilla function
68 template<typename TFunction>
69 static void applyToMultiTile(IndustryElement& el0, const World::Pos2& loc, bool isMultiTile, TFunction&& func)
70 {
71 for (auto& offset : getBuildingTileOffsets(isMultiTile))
72 {
73 auto* elIndustry = &el0;
74 const auto pos = loc + offset.pos;
75 if (offset.index != 0)
76 {
77 auto tile = World::TileManager::get(pos);
78 for (auto& el : tile)
79 {
80 elIndustry = el.as<IndustryElement>();
81 if (elIndustry == nullptr)
82 {
83 continue;
84 }
85 if (elIndustry->baseZ() != el0.baseZ())
86 {
87 elIndustry = nullptr;
88 continue;
89 }
90 break;
91 }
92 }
93 if (elIndustry != nullptr)
94 {
95 func(*elIndustry, pos);
96 }
97 }
98 }
99
100 // 0x00456FF7
101 bool IndustryElement::update(const World::Pos2& loc)

Callers 2

updateMethod · 0.70
updateIndustryAnimation2Function · 0.70

Calls 3

getBuildingTileOffsetsFunction · 0.85
baseZMethod · 0.80
getFunction · 0.70

Tested by

no test coverage detected