MCPcopy Create free account
hub / github.com/Warzone2100/warzone2100 / processScriptQueuedObjectRemovals

Method processScriptQueuedObjectRemovals

src/wzapi.cpp:4823–4856  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4821}
4822
4823void wzapi::processScriptQueuedObjectRemovals()
4824{
4825 auto& queuedObjRemovals = scriptQueuedObjectRemovals();
4826 for (auto& objWithSfxFlag : queuedObjRemovals)
4827 {
4828 BASE_OBJECT* psObj = objWithSfxFlag.first;
4829 if (psObj->died)
4830 {
4831 debug(LOG_MSG, "Object %p is already dead, not processing", static_cast<void*>(psObj));
4832 continue;
4833 }
4834 if (objWithSfxFlag.second)
4835 {
4836 switch (psObj->type)
4837 {
4838 case OBJ_STRUCTURE: destroyStruct((STRUCTURE*)psObj, gameTime); break;
4839 case OBJ_DROID: destroyDroid((DROID*)psObj, gameTime); break;
4840 case OBJ_FEATURE: destroyFeature((FEATURE*)psObj, gameTime); break;
4841 default: ASSERT(false, "Wrong game object type"); break;
4842 }
4843 }
4844 else
4845 {
4846 switch (psObj->type)
4847 {
4848 case OBJ_STRUCTURE: removeStruct((STRUCTURE*)psObj, true); break;
4849 case OBJ_DROID: removeDroidBase((DROID*)psObj); break;
4850 case OBJ_FEATURE: removeFeature((FEATURE*)psObj); break;
4851 default: ASSERT(false, "Wrong game object type"); break;
4852 }
4853 }
4854 }
4855 queuedObjRemovals.clear();
4856}

Callers

nothing calls this directly

Calls 8

destroyStructFunction · 0.85
destroyDroidFunction · 0.85
destroyFeatureFunction · 0.85
removeStructFunction · 0.85
removeDroidBaseFunction · 0.85
removeFeatureFunction · 0.85
ASSERTFunction · 0.70
clearMethod · 0.45

Tested by

no test coverage detected