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

Function insertElementPrepareDest

src/OpenLoco/src/Map/TileManager.cpp:231–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

229 }
230
231 static std::pair<TileElement*, TileElement*> insertElementPrepareDest(const TilePos2 pos)
232 {
233 const auto index = getTileIndex(pos);
234 if (index >= _tiles.size())
235 {
236 Logging::error("Attempted to get tile out of bounds! ({0}, {1})", pos.x, pos.y);
237 return std::make_pair(nullptr, nullptr);
238 }
239
240 auto* source = _tiles[index];
241 // _elementsEnd points to the free space at the end of the
242 // tile elements. You must always check there is space (checkFreeElementsAndReorganise)
243 // prior to calling this function!
244 auto* dest = &_elements[_elementsEnd];
245 set(pos, dest);
246 return std::make_pair(source, dest);
247 }
248
249 static TileElement* insertElementEnd(ElementType type, uint8_t baseZ, uint8_t occupiedQuads, TileElement* source, TileElement* dest, bool lastFound)
250 {

Callers 3

insertElementFunction · 0.85
insertElementRoadFunction · 0.85

Calls 4

getTileIndexFunction · 0.85
errorFunction · 0.85
setFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected