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

Function insertElementAfterNoReorg

src/OpenLoco/src/Map/TileManager.cpp:359–387  ·  view source on GitHub ↗

0x00461578

Source from the content-addressed store, hash-verified

357
358 // 0x00461578
359 TileElement* insertElementAfterNoReorg(TileElement* after, ElementType type, const Pos2& pos, uint8_t baseZ, uint8_t occupiedQuads)
360 {
361 auto [source, dest] = insertElementPrepareDest(toTileSpace(pos));
362 if (source == nullptr)
363 {
364 return nullptr;
365 }
366
367 bool lastFound = false;
368 // Copy all of the elements that are underneath the new tile (or till end)
369 while (source <= after)
370 {
371 *dest = *source;
372 source->setBaseZ(0xFFU);
373 source++;
374 if (dest->isLast())
375 {
376 // The new element will become the last
377 // so we are clearing the flag
378 dest->setLastFlag(false);
379 dest++;
380 lastFound = true;
381 break;
382 }
383 dest++;
384 }
385
386 return insertElementEnd(type, baseZ, occupiedQuads, source, dest, lastFound);
387 }
388
389 constexpr uint8_t kTileSize = 31;
390

Callers

nothing calls this directly

Calls 6

insertElementPrepareDestFunction · 0.85
toTileSpaceFunction · 0.85
insertElementEndFunction · 0.85
setBaseZMethod · 0.80
setLastFlagMethod · 0.80
isLastMethod · 0.45

Tested by

no test coverage detected