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

Function paintSignal

src/OpenLoco/src/Paint/PaintSignal.cpp:213–254  ·  view source on GitHub ↗

0x0048864C

Source from the content-addressed store, hash-verified

211
212 // 0x0048864C
213 void paintSignal(PaintSession& session, const World::SignalElement& elSignal)
214 {
215 if (elSignal.isAiAllocated())
216 {
217 return;
218 }
219
220 auto* elTrack = elSignal.prev()->as<World::TrackElement>();
221 if (elTrack == nullptr)
222 {
223 return;
224 }
225 if (elSignal.isGhost()
226 && CompanyManager::getSecondaryPlayerId() != CompanyId::null
227 && elTrack->owner() == CompanyManager::getSecondaryPlayerId())
228 {
229 return;
230 }
231
232 if (session.getRenderTarget()->zoomLevel > 1)
233 {
234 return;
235 }
236
237 const coord_t height = elSignal.baseHeight();
238 const auto trackId = elTrack->trackId();
239 const uint8_t rotation = (session.getRotation() + elSignal.rotation()) & 0x3;
240 if (elTrack->sequenceIndex() == 0)
241 {
242 auto& leftSignal = elSignal.getLeft();
243 const bool leftIsGhost = elSignal.isGhost() || elSignal.isLeftGhost();
244 paintSignalSide(session, leftSignal, false, leftIsGhost, trackId, rotation, height);
245 }
246 if (!elTrack->isFlag6())
247 {
248 return;
249 }
250
251 auto& rightSignal = elSignal.getRight();
252 const bool rightIsGhost = elSignal.isGhost() || elSignal.isRightGhost();
253 paintSignalSide(session, rightSignal, true, rightIsGhost, trackId, rotation, height);
254 }
255}

Callers 1

paintTileElementsFunction · 0.85

Calls 15

getSecondaryPlayerIdFunction · 0.85
paintSignalSideFunction · 0.85
isAiAllocatedMethod · 0.80
prevMethod · 0.80
getRenderTargetMethod · 0.80
baseHeightMethod · 0.80
trackIdMethod · 0.80
isLeftGhostMethod · 0.80
isFlag6Method · 0.80
isRightGhostMethod · 0.80
isGhostMethod · 0.45
ownerMethod · 0.45

Tested by

no test coverage detected