void CSector::RespawnDeadNPCs() { ADDTOCALLSTACK("CSector::RespawnDeadNPCs"); // skip sectors in unsupported maps if ( !g_MapList.m_maps[m_map] ) return; // Respawn dead NPC's CChar * pCharNext; CChar * pChar = STATIC_CAST <CChar *>( m_Chars_Disconnect.GetHead()); for ( ; pChar != NULL; pChar = pCharNext ) { pCharNext = pChar->GetNext(); if ( ! pChar->m_pNPC ) continue; if ( ! pChar->m_ptHome.IsValidPoint()) continue; if ( ! pChar->IsStatFlag( STATF_DEAD )) continue; // Restock them with npc stuff. pChar->NPC_LoadScript(true); // Res them back to their "home". int iDist = pChar->m_pNPC->m_Home_Dist_Wander; pChar->MoveNear( pChar->m_ptHome, ( iDist < SHRT_MAX ) ? iDist : 4 ); pChar->NPC_CreateTrigger(); //Removed from NPC_LoadScript() and triggered after char placement pChar->Spell_Resurrection(); } }