/** Deletes a SoundPointer * @param[in] _pstSoundPointer Concerned SoundPointer * @return orxSTATUS_SUCCESS / orxSTATUS_FAILURE */ orxSTATUS orxFASTCALL orxSoundPointer_Delete(orxSOUNDPOINTER *_pstSoundPointer) { orxSTATUS eResult = orxSTATUS_SUCCESS; /* Checks */ orxASSERT(sstSoundPointer.u32Flags & orxSOUNDPOINTER_KU32_STATIC_FLAG_READY); orxSTRUCTURE_ASSERT(_pstSoundPointer); /* Decreases counter */ orxStructure_DecreaseCounter(_pstSoundPointer); /* Not referenced? */ if(orxStructure_GetRefCounter(_pstSoundPointer) == 0) { /* Removes all sounds */ orxSoundPointer_RemoveAllSounds(_pstSoundPointer); /* Deletes structure */ orxStructure_Delete(_pstSoundPointer); } else { /* Referenced by others */ eResult = orxSTATUS_FAILURE; } /* Done! */ return eResult; }
/** Deletes a text * @param[in] _pstText Concerned text * @return orxSTATUS_SUCCESS / orxSTATUS_FAILURE */ orxSTATUS orxFASTCALL orxText_Delete(orxTEXT *_pstText) { orxSTATUS eResult = orxSTATUS_SUCCESS; /* Checks */ orxASSERT(sstText.u32Flags & orxTEXT_KU32_STATIC_FLAG_READY); orxSTRUCTURE_ASSERT(_pstText); /* Decreases counter */ orxStructure_DecreaseCounter(_pstText); /* Not referenced? */ if(orxStructure_GetRefCounter(_pstText) == 0) { /* Removes string */ orxText_SetString(_pstText, orxNULL); /* Removes font */ orxText_SetFont(_pstText, orxNULL); /* Deletes structure */ orxStructure_Delete(_pstText); } else { /* Referenced by others */ eResult = orxSTATUS_FAILURE; } /* Done! */ return eResult; }
/** Deletes an FXPointer * @param[in] _pstFXPointer Concerned FXPointer * @return orxSTATUS_SUCCESS / orxSTATUS_FAILURE */ orxSTATUS orxFASTCALL orxFXPointer_Delete(orxFXPOINTER *_pstFXPointer) { orxSTATUS eResult = orxSTATUS_SUCCESS; /* Checks */ orxASSERT(sstFXPointer.u32Flags & orxFXPOINTER_KU32_STATIC_FLAG_READY); orxSTRUCTURE_ASSERT(_pstFXPointer); /* Decreases counter */ orxStructure_DecreaseCounter(_pstFXPointer); /* Not referenced? */ if(orxStructure_GetRefCounter(_pstFXPointer) == 0) { orxU32 i; /* For all FXs */ for(i = 0; i < orxFXPOINTER_KU32_FX_NUMBER; i++) { /* Valid? */ if(_pstFXPointer->astFXList[i].pstFX != orxNULL) { /* Decreases its reference counter */ orxStructure_DecreaseCounter(_pstFXPointer->astFXList[i].pstFX); /* Is internal? */ if(orxFLAG_TEST(_pstFXPointer->astFXList[i].u32Flags, orxFXPOINTER_HOLDER_KU32_FLAG_INTERNAL)) { /* Removes its owner */ orxStructure_SetOwner(_pstFXPointer->astFXList[i].pstFX, orxNULL); /* Deletes it */ orxFX_Delete(_pstFXPointer->astFXList[i].pstFX); } } } /* Deletes structure */ orxStructure_Delete(_pstFXPointer); } else { /* Referenced by others */ eResult = orxSTATUS_FAILURE; } /* Done! */ return eResult; }
/** Deletes a camera * @param[in] _pstCamera Camera to delete * @return orxSTATUS_SUCCESS / orxSTATUS_FAILURE */ orxSTATUS orxFASTCALL orxCamera_Delete(orxCAMERA *_pstCamera) { orxSTATUS eResult = orxSTATUS_SUCCESS; /* Checks */ orxASSERT(sstCamera.u32Flags & orxCAMERA_KU32_STATIC_FLAG_READY); orxSTRUCTURE_ASSERT(_pstCamera); /* Not referenced? */ if(orxStructure_GetRefCounter(_pstCamera) == 0) { /* Removes frame reference */ orxStructure_DecreaseCounter(_pstCamera->pstFrame); /* Deletes frame*/ orxFrame_Delete(_pstCamera->pstFrame); /* Is referenced? */ if(orxStructure_TestFlags(_pstCamera, orxCAMERA_KU32_FLAG_REFERENCED) != orxFALSE) { /* Removes it from reference table */ orxHashTable_Remove(sstCamera.pstReferenceTable, orxString_ToCRC(_pstCamera->zReference)); } /* Has reference? */ if(_pstCamera->zReference != orxNULL) { /* Unprotects it */ orxConfig_ProtectSection(_pstCamera->zReference, orxFALSE); } /* Deletes structure */ orxStructure_Delete(_pstCamera); } else { /* Logs message */ orxDEBUG_PRINT(orxDEBUG_LEVEL_RENDER, "Cannot delete camera while it is still referenced."); /* Referenced by others */ eResult = orxSTATUS_FAILURE; } /* Done! */ return eResult; }
/** Deletes a graphic * @param[in] _pstGraphic Graphic to delete */ orxSTATUS orxFASTCALL orxGraphic_Delete(orxGRAPHIC *_pstGraphic) { orxSTATUS eResult = orxSTATUS_SUCCESS; /* Checks */ orxASSERT(sstGraphic.u32Flags & orxGRAPHIC_KU32_STATIC_FLAG_READY); orxSTRUCTURE_ASSERT(_pstGraphic); /* Decreases counter */ orxStructure_DecreaseCounter(_pstGraphic); /* Not referenced? */ if(orxStructure_GetRefCounter(_pstGraphic) == 0) { /* Cleans data */ orxGraphic_SetData(_pstGraphic, orxNULL); /* Has reference? */ if(_pstGraphic->zReference != orxNULL) { /* Unprotects it */ orxConfig_ProtectSection(_pstGraphic->zReference, orxFALSE); } /* Deletes structure */ orxStructure_Delete(_pstGraphic); } else { /* Referenced by others */ eResult = orxSTATUS_FAILURE; } /* Done! */ return eResult; }
/** Deletes a TimeLine * @param[in] _pstTimeLine Concerned TimeLine * @return orxSTATUS_SUCCESS / orxSTATUS_FAILURE */ orxSTATUS orxFASTCALL orxTimeLine_Delete(orxTIMELINE *_pstTimeLine) { orxSTATUS eResult = orxSTATUS_SUCCESS; /* Checks */ orxASSERT(sstTimeLine.u32Flags & orxTIMELINE_KU32_STATIC_FLAG_READY); orxSTRUCTURE_ASSERT(_pstTimeLine); /* Decreases counter */ orxStructure_DecreaseCounter(_pstTimeLine); /* Not referenced? */ if(orxStructure_GetRefCounter(_pstTimeLine) == 0) { orxTIMELINE_EVENT_PAYLOAD stPayload; orxSTRUCTURE *pstOwner; orxU32 i; /* Gets owner */ pstOwner = orxStructure_GetOwner(_pstTimeLine); /* Inits event payload */ orxMemory_Zero(&stPayload, sizeof(orxTIMELINE_EVENT_PAYLOAD)); stPayload.pstTimeLine = _pstTimeLine; /* For all tracks */ for(i = 0; i < orxTIMELINE_KU32_TRACK_NUMBER; i++) { /* Valid? */ if(_pstTimeLine->astTrackList[i].pstTrack != orxNULL) { orxTIMELINE_TRACK *pstTrack; /* Gets track */ pstTrack = _pstTimeLine->astTrackList[i].pstTrack; /* Removes its reference */ _pstTimeLine->astTrackList[i].pstTrack = orxNULL; /* Updates payload */ stPayload.zTrackName = pstTrack->zReference; /* Sends event */ orxEVENT_SEND(orxEVENT_TYPE_TIMELINE, orxTIMELINE_EVENT_TRACK_REMOVE, pstOwner, pstOwner, &stPayload); /* Deletes it */ orxTimeLine_DeleteTrack(pstTrack); } } /* Deletes structure */ orxStructure_Delete(_pstTimeLine); } else { /* Referenced by others */ eResult = orxSTATUS_FAILURE; } /* Done! */ return eResult; }
/** Deletes a clock * @param[in] _pstClock Concerned clock * @return orxSTATUS_SUCCESS / orxSTATUS_FAILURE */ orxSTATUS orxFASTCALL orxClock_Delete(orxCLOCK *_pstClock) { orxSTATUS eResult = orxSTATUS_SUCCESS; /* Checks */ orxASSERT(sstClock.u32Flags & orxCLOCK_KU32_STATIC_FLAG_READY); orxSTRUCTURE_ASSERT(_pstClock); /* Decreases counter */ orxStructure_DecreaseCounter(_pstClock); /* Not referenced? */ if(orxStructure_GetRefCounter(_pstClock) == 0) { /* Not locked? */ if(!orxStructure_TestFlags(_pstClock, orxCLOCK_KU32_FLAG_UPDATE_LOCK)) { orxCLOCK_TIMER_STORAGE *pstTimerStorage; /* For all stored timers */ for(pstTimerStorage = (orxCLOCK_TIMER_STORAGE *)orxLinkList_GetFirst(&(_pstClock->stTimerList)); pstTimerStorage != orxNULL; pstTimerStorage = (orxCLOCK_TIMER_STORAGE *)orxLinkList_GetFirst(&(_pstClock->stTimerList))) { /* Removes it */ orxLinkList_Remove(&(pstTimerStorage->stNode)); /* Deletes it */ orxBank_Free(sstClock.pstTimerBank, pstTimerStorage); } /* Deletes function bank */ orxBank_Delete(_pstClock->pstFunctionBank); /* Is referenced? */ if(orxStructure_TestFlags(_pstClock, orxCLOCK_KU32_FLAG_REFERENCED)) { /* Removes it from reference table */ orxHashTable_Remove(sstClock.pstReferenceTable, orxString_ToCRC(_pstClock->zReference)); } /* Has reference? */ if(_pstClock->zReference != orxNULL) { /* Unprotects it */ orxConfig_ProtectSection(_pstClock->zReference, orxFALSE); } /* Deletes clock */ orxStructure_Delete(_pstClock); } else { /* Increases counter */ orxStructure_IncreaseCounter(_pstClock); /* Logs message */ orxDEBUG_PRINT(orxDEBUG_LEVEL_CLOCK, "Can't delete clock <%s> as it's currently locked for processing!", orxStructure_TestFlags(_pstClock, orxCLOCK_KU32_FLAG_REFERENCED) ? _pstClock->zReference : orxSTRING_EMPTY); /* Updates result */ eResult = orxSTATUS_FAILURE; } } else { /* Referenced by others */ eResult = orxSTATUS_FAILURE; } /* Done! */ return eResult; }