mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-29 09:32:45 +00:00
Minor summoned creature cleanup fixes
This commit is contained in:
parent
a1ed0144e1
commit
1097c2cfc4
@ -1884,6 +1884,13 @@ namespace MWMechanics
|
||||
if (fx)
|
||||
MWBase::Environment::get().getWorld()->spawnEffect("meshes\\" + fx->mModel,
|
||||
"", ptr.getRefData().getPosition().asVec3());
|
||||
|
||||
// Remove the summoned creature's summoned creatures as well
|
||||
MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats(ptr);
|
||||
std::map<CreatureStats::SummonKey, int>& creatureMap = stats.getSummonedCreatureMap();
|
||||
for (const auto& creature : creatureMap)
|
||||
cleanupSummonedCreature(stats, creature.second);
|
||||
creatureMap.clear();
|
||||
}
|
||||
else if (creatureActorId != -1)
|
||||
{
|
||||
|
@ -86,10 +86,9 @@ namespace MWMechanics
|
||||
}
|
||||
|
||||
// Update summon effects
|
||||
bool casterDead = creatureStats.isDead();
|
||||
for (std::map<CreatureStats::SummonKey, int>::iterator it = creatureMap.begin(); it != creatureMap.end(); )
|
||||
{
|
||||
bool found = !casterDead && mActiveEffects.find(it->first) != mActiveEffects.end();
|
||||
bool found = mActiveEffects.find(it->first) != mActiveEffects.end();
|
||||
if (!found)
|
||||
{
|
||||
// Effect has ended
|
||||
@ -100,25 +99,11 @@ namespace MWMechanics
|
||||
++it;
|
||||
}
|
||||
|
||||
std::vector<int>& graveyard = creatureStats.getSummonedCreatureGraveyard();
|
||||
for (std::vector<int>::iterator it = graveyard.begin(); it != graveyard.end(); )
|
||||
{
|
||||
MWWorld::Ptr ptr = MWBase::Environment::get().getWorld()->searchPtrViaActorId(*it);
|
||||
if (!ptr.isEmpty())
|
||||
{
|
||||
it = graveyard.erase(it);
|
||||
std::vector<int> graveyard = creatureStats.getSummonedCreatureGraveyard();
|
||||
creatureStats.getSummonedCreatureGraveyard().clear();
|
||||
|
||||
const ESM::Static* fx = MWBase::Environment::get().getWorld()->getStore().get<ESM::Static>()
|
||||
.search("VFX_Summon_End");
|
||||
if (fx)
|
||||
MWBase::Environment::get().getWorld()->spawnEffect("meshes\\" + fx->mModel,
|
||||
"", ptr.getRefData().getPosition().asVec3());
|
||||
|
||||
MWBase::Environment::get().getWorld()->deleteObject(ptr);
|
||||
}
|
||||
else
|
||||
++it;
|
||||
}
|
||||
for (const int creature : graveyard)
|
||||
MWBase::Environment::get().getMechanicsManager()->cleanupSummonedCreature(mActor, creature);
|
||||
|
||||
if (!cleanup)
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user