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

Function getElTrackAt

src/OpenLoco/src/GameCommands/Track/RemoveSignal.cpp:14–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12namespace OpenLoco::GameCommands
13{
14 static World::TrackElement* getElTrackAt(const SignalRemovalArgs& args, const World::Pos3 pos, const uint8_t sequenceIndex)
15 {
16 auto tile = World::TileManager::get(pos);
17 for (auto& el : tile)
18 {
19 auto* elTrack = el.as<World::TrackElement>();
20 if (elTrack == nullptr)
21 {
22 continue;
23 }
24 if (elTrack->baseHeight() != pos.z)
25 {
26 continue;
27 }
28 if (elTrack->rotation() != args.rotation)
29 {
30 continue;
31 }
32 if (elTrack->sequenceIndex() != sequenceIndex)
33 {
34 continue;
35 }
36 if (elTrack->trackObjectId() != args.trackObjType)
37 {
38 continue;
39 }
40 if (elTrack->trackId() != args.trackId)
41 {
42 continue;
43 }
44 return elTrack;
45 }
46 return nullptr;
47 };
48
49 static currency32_t signalRemoveCost(const SignalRemovalArgs& args, const World::TrackData::PreviewTrack trackPiece0, const World::Pos3 trackStart)
50 {

Callers 2

signalRemoveCostFunction · 0.70
removeSignalFunction · 0.70

Calls 6

baseHeightMethod · 0.80
trackObjectIdMethod · 0.80
trackIdMethod · 0.80
getFunction · 0.50
rotationMethod · 0.45
sequenceIndexMethod · 0.45

Tested by

no test coverage detected