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

Function applyToMultiTile

src/OpenLoco/src/Map/BuildingElement.cpp:29–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27
28 template<typename TFunction>
29 static void applyToMultiTile(BuildingElement& el0, const World::Pos2& loc, bool isMultiTile, TFunction&& func)
30 {
31 for (auto& offset : getBuildingTileOffsets(isMultiTile))
32 {
33 auto* elBuilding = &el0;
34 const auto pos = loc + offset.pos;
35 if (offset.index != 0)
36 {
37 auto tile = World::TileManager::get(pos);
38 for (auto& el : tile)
39 {
40 elBuilding = el.as<BuildingElement>();
41 if (elBuilding == nullptr)
42 {
43 continue;
44 }
45 if (elBuilding->baseZ() != el0.baseZ())
46 {
47 elBuilding = nullptr;
48 continue;
49 }
50 break;
51 }
52 }
53 if (elBuilding != nullptr)
54 {
55 func(*elBuilding, pos);
56 }
57 }
58 }
59
60 // 0x0042DF8B
61 bool BuildingElement::update(const World::Pos2& loc)

Callers 2

updateMethod · 0.70
updateBuildingAnimation1Function · 0.70

Calls 3

getBuildingTileOffsetsFunction · 0.85
baseZMethod · 0.80
getFunction · 0.70

Tested by

no test coverage detected