bool Game::ProtectedUpdate(AUDynArray<AUEntityId> &entities, float fDeltaTime) { bool bSuccess = true; assert(!m_bHaveProgramError); __try { for (size_t i=0; i<entities.Size(); ++i) { IAUEntity* pEnt = m_pEnv->sys->pEntitySystem->Get(entities[i]); if (pEnt) // Safety check in case entity was deleted during this update by another object { IAUUpdateable* pUpdateable = pEnt->GetUpdateable(); if (pUpdateable) { // If dropped here after a runtime failure, your crash was likely // somewhere directly in the pUpdatable object's Update method pUpdateable->Update(fDeltaTime); } } } } __except( RuntimeExceptionFilter() ) { bSuccess = false; } return bSuccess; }
void Game::EntityUpdateProtector::ProtectedFunc() { for (size_t i=0; i<entities.Size(); ++i) { IAUEntity* pEnt = pEntitySystem->Get(entities[i]); if (pEnt) // Safety check in case entity was deleted during this update by another object { IAUUpdateable* pUpdateable = pEnt->GetUpdateable(); if (pUpdateable) { // If dropped here after a runtime failure, your crash was likely // somewhere directly in the pUpdatable object's Update method pUpdateable->Update(fDeltaTime); } } } }