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

Function getRoadElement

src/OpenLoco/src/GameCommands/Road/CreateRoadMod.cpp:10–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8namespace OpenLoco::GameCommands
9{
10 static World::RoadElement* getRoadElement(const RoadModsPlacementArgs& args)
11 {
12 auto tile = World::TileManager::get(args.pos);
13 for (auto& element : tile)
14 {
15 auto* roadEl = element.as<World::RoadElement>();
16 if (roadEl == nullptr)
17 {
18 continue;
19 }
20 if (roadEl->baseHeight() != args.pos.z)
21 {
22 continue;
23 }
24 if (roadEl->rotation() != args.rotation)
25 {
26 continue;
27 }
28 if (roadEl->rotation() != args.rotation)
29 {
30 continue;
31 }
32 if (roadEl->sequenceIndex() != args.index)
33 {
34 continue;
35 }
36 if (roadEl->roadObjectId() != args.roadObjType)
37 {
38 continue;
39 }
40 if (roadEl->roadId() != args.roadId)
41 {
42 continue;
43 }
44 return roadEl;
45 }
46 return nullptr;
47 }
48
49 // 0x0047A21E
50 static uint32_t createRoadMod(const RoadModsPlacementArgs& args, uint8_t flags)

Callers 1

createRoadModFunction · 0.70

Calls 6

baseHeightMethod · 0.80
roadObjectIdMethod · 0.80
roadIdMethod · 0.80
getFunction · 0.50
rotationMethod · 0.45
sequenceIndexMethod · 0.45

Tested by

no test coverage detected