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

Function updateSignalAnimation

src/OpenLoco/src/Map/SignalElement.cpp:54–81  ·  view source on GitHub ↗

0x0048950F

Source from the content-addressed store, hash-verified

52
53 // 0x0048950F
54 bool updateSignalAnimation(const Animation& anim)
55 {
56 AnimResult result{};
57 auto tile = TileManager::get(anim.pos);
58 // It's possible to have multiple signal elements on the same tile/baseZ ???
59 // Unsure why
60 for (auto& el : tile)
61 {
62 auto* elSignal = el.as<SignalElement>();
63 if (elSignal == nullptr)
64 {
65 continue;
66 }
67 if (elSignal->baseZ() != anim.baseZ)
68 {
69 continue;
70 }
71 result |= updateSignalAnimationSide(elSignal->getLeft());
72 result |= updateSignalAnimationSide(elSignal->getRight());
73 }
74
75 if (result.shouldInvalidate)
76 {
77 Ui::ViewportManager::invalidate(anim.pos, anim.baseZ * kSmallZStep, anim.baseZ * kSmallZStep + 32, ZoomLevel::half);
78 }
79
80 return !result.hasAnimation;
81 }
82}

Callers 1

callUpdateFunctionFunction · 0.85

Calls 4

baseZMethod · 0.80
getFunction · 0.70
invalidateFunction · 0.50

Tested by

no test coverage detected