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

Function removeElement

src/OpenLoco/src/Map/TileManager.cpp:155–184  ·  view source on GitHub ↗

0x00461760

Source from the content-addressed store, hash-verified

153
154 // 0x00461760
155 void removeElement(TileElement& element)
156 {
157 // This is used to indicate if the caller can still use this pointer
158 if (&element == _F00158)
159 {
160 if (element.isLast())
161 {
162 _F00158 = nullptr;
163 }
164 }
165
166 if (element.isLast())
167 {
168 auto* prev = element.prev();
169 prev->setLastFlag(true);
170 markElementAsFree(element);
171 }
172 else
173 {
174 // Move all of the elements up one until last for the tile
175 auto* next = element.next();
176 auto* cur = &element;
177 do
178 {
179 *cur++ = *next;
180 } while (!next++->isLast());
181
182 markElementAsFree(*cur);
183 }
184 }
185
186 void setRemoveElementPointerChecker(TileElement& element)
187 {

Callers 6

updateTreeElementFunction · 0.70
removeTreeFunction · 0.70
removeBuildingElementFunction · 0.70
generateTreesFunction · 0.50

Calls 5

markElementAsFreeFunction · 0.85
prevMethod · 0.80
setLastFlagMethod · 0.80
isLastMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected