Skip to content

Commit

Permalink
Merge pull request LandSandBoat#3596 from Shozokui/lsb_base_ai
Browse files Browse the repository at this point in the history
Prevent pets from Ticking if they're marked for deletion
  • Loading branch information
zach2good authored Feb 15, 2023
2 parents fca53eb + c41c14f commit 8f46599
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/map/zone_entities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1434,15 +1434,11 @@ void CZoneEntities::ZoneServer(time_point tick, bool check_trigger_areas)
// : this way, but we need to do this to keep allies working (for now).
if (auto* PPet = static_cast<CPetEntity*>(it->second))
{
PPet->PRecastContainer->Check();
PPet->StatusEffectContainer->CheckEffectsExpiry(tick);
if (tick > m_EffectCheckTime)
{
PPet->StatusEffectContainer->TickRegen(tick);
PPet->StatusEffectContainer->TickEffects(tick);
}
PPet->PAI->Tick(tick);

/*
* Pets specifically need to be removed prior to evaluating their AI Tick
* to prevent a number of issues which can result as a Pet having a
* deleted/nullptr'd PMaster
*/
if (PPet->status == STATUS_TYPE::DISAPPEAR)
{
for (auto PMobIt : m_mobList)
Expand All @@ -1461,6 +1457,15 @@ void CZoneEntities::ZoneServer(time_point tick, bool check_trigger_areas)
m_petList.erase(it++);
continue;
}

PPet->PRecastContainer->Check();
PPet->StatusEffectContainer->CheckEffectsExpiry(tick);
if (tick > m_EffectCheckTime)
{
PPet->StatusEffectContainer->TickRegen(tick);
PPet->StatusEffectContainer->TickEffects(tick);
}
PPet->PAI->Tick(tick);
}
it++;
}
Expand Down

0 comments on commit 8f46599

Please sign in to comment.