Skip to content

Commit

Permalink
Fix issue with mobs no depopping (due to spawn_events) while zone is …
Browse files Browse the repository at this point in the history
…idle.
  • Loading branch information
Paul Coene committed Nov 20, 2015
1 parent ec36a37 commit f3120f2
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions zone/entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -468,17 +468,27 @@ void EntityList::CorpseProcess()

void EntityList::MobProcess()
{
#ifdef IDLE_WHEN_EMPTY
if (numclients < 1)
return;
#endif
bool mob_dead;

auto it = mob_list.begin();
while (it != mob_list.end()) {
uint16 id = it->first;
Mob *mob = it->second;

size_t sz = mob_list.size();
bool p_val = mob->Process();

#ifdef IDLE_WHEN_EMPTY
// spawn_events can cause spawns and deaths while zone empty.
// At the very least, process that.
if (numclients < 1) {
mob_dead = mob->CastToNPC()->GetDepop();
}
else {
mob_dead = !mob->Process();
}
#else
mob_dead = !mob->Process();
#endif
size_t a_sz = mob_list.size();

if(a_sz > sz) {
Expand All @@ -491,7 +501,7 @@ void EntityList::MobProcess()
++it;
}

if(!p_val) {
if(mob_dead) {
if(mob->IsNPC()) {
entity_list.RemoveNPC(id);
}
Expand Down

0 comments on commit f3120f2

Please sign in to comment.