MCPcopy Create free account
hub / github.com/ZDoom/Raze / DestroyObjects

Function DestroyObjects

source/common/objects/dobjgc.cpp:283–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

281//==========================================================================
282
283static size_t DestroyObjects(size_t count)
284{
285 DObject *curr;
286 size_t bytes_destroyed = 0;
287
288 while ((curr = ToDestroy) != nullptr && count-- > 0)
289 {
290 // Note that we cannot assume here that the object has not yet been destroyed.
291 // If destruction happens as the result of another object's destruction we may
292 // get entries here that have been destroyed already if that owning object was
293 // first in the list.
294 if (!(curr->ObjectFlags & OF_EuthanizeMe))
295 {
296 bytes_destroyed += curr->GetClass()->Size + GCDESTROYCOST;
297 ToDestroy = curr->GCNext;
298 curr->GCNext = nullptr;
299 curr->Destroy();
300 }
301 else
302 {
303 ToDestroy = curr->GCNext;
304 curr->GCNext = nullptr;
305 }
306 }
307 return bytes_destroyed;
308}
309
310//==========================================================================
311//

Callers 1

SingleStepFunction · 0.85

Calls 2

GetClassMethod · 0.80
DestroyMethod · 0.45

Tested by

no test coverage detected