19.07.2017, 18:21
CA_DestroyObject_DC -> check object type from ColAndreas Table -> DestroyObject/DestroyDynamicObject
PHP Code:
stock CA_DestroyObject_DC(index)
{
// Out of bounds
if(index < 0 || index >= MAX_CA_OBJECTS) return -1;
#if defined _Y_ITERATE_LOCAL_VERSION
if(Iter_Contains(CA_Objects, index))
{
new next;
Iter_SafeRemove(CA_Objects, index, next);
if(CA_ObjectList[index][ObjectType] == OBJECT_TYPE_OBJECT) DestroyObject(CA_ObjectList[index][ObjectID]);
#if defined STREAMER_TYPE_OBJECT
else if(CA_ObjectList[index][ObjectType] == OBJECT_TYPE_DYNAMIC) DestroyDynamicObject(CA_ObjectList[index][ObjectID]);
#endif
CA_DestroyObject(CA_ObjectList[index][ColdAndreadsID]);
return next;
}
#else
if(CA_ObjectList[index][ObjectUsed])
{
if(CA_ObjectList[index][ObjectType] == OBJECT_TYPE_OBJECT) DestroyObject(CA_ObjectList[index][ObjectID]);
#if defined STREAMER_TYPE_OBJECT
else if(CA_ObjectList[index][ObjectType] == OBJECT_TYPE_DYNAMIC) DestroyDynamicObject(CA_ObjectList[index][ObjectID]);
#endif
CA_ObjectList[index][ObjectUsed] = false;
CA_DestroyObject(CA_ObjectList[index][ColdAndreadsID]);
return 1;
}
#endif
return -1;
}