1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-03-25 16:43:33 +00:00

Merge branch 'racer_recursion_limited' into 'master'

Check if a leveled creature is in an unloaded cell before deciding it doesn't exist

Closes #4376

See merge request OpenMW/openmw!1420

(cherry picked from commit 782371cb2e7f6653d72305090033557b53bbcf3a)

6d945da7 Check if a leveled creature is in an unloaded cell before deciding it doesn't exist
This commit is contained in:
psi29a 2021-12-06 13:46:56 +00:00
parent 6c7dc2d72f
commit c844e5d045
4 changed files with 24 additions and 1 deletions

View File

@ -12,6 +12,7 @@
Bug #3855: AI sometimes spams defensive spells Bug #3855: AI sometimes spams defensive spells
Bug #3905: Great House Dagoth issues Bug #3905: Great House Dagoth issues
Bug #4203: Resurrecting an actor should close the loot GUI Bug #4203: Resurrecting an actor should close the loot GUI
Bug #4376: Moved actors don't respawn in their original cells
Bug #4389: NPC's lips do not move if his head model has the NiBSAnimationNode root node Bug #4389: NPC's lips do not move if his head model has the NiBSAnimationNode root node
Bug #4602: Robert's Bodies: crash inside createInstance() Bug #4602: Robert's Bodies: crash inside createInstance()
Bug #4700: Editor: Incorrect command implementation Bug #4700: Editor: Incorrect command implementation

View File

@ -64,7 +64,13 @@ namespace MWClass
if (customData.mSpawn) if (customData.mSpawn)
return; return;
MWWorld::Ptr creature = (customData.mSpawnActorId == -1) ? MWWorld::Ptr() : MWBase::Environment::get().getWorld()->searchPtrViaActorId(customData.mSpawnActorId); MWWorld::Ptr creature;
if(customData.mSpawnActorId != -1)
{
creature = MWBase::Environment::get().getWorld()->searchPtrViaActorId(customData.mSpawnActorId);
if(creature.isEmpty())
creature = ptr.getCell()->getMovedActor(customData.mSpawnActorId);
}
if (!creature.isEmpty()) if (!creature.isEmpty())
{ {
const MWMechanics::CreatureStats& creatureStats = creature.getClass().getCreatureStats(creature); const MWMechanics::CreatureStats& creatureStats = creature.getClass().getCreatureStats(creature);

View File

@ -1195,4 +1195,18 @@ namespace MWWorld
|| enchantment->mData.mType == ESM::Enchantment::WhenStrikes) || enchantment->mData.mType == ESM::Enchantment::WhenStrikes)
mRechargingItems.emplace_back(ptr.getBase(), static_cast<float>(enchantment->mData.mCharge)); mRechargingItems.emplace_back(ptr.getBase(), static_cast<float>(enchantment->mData.mCharge));
} }
Ptr MWWorld::CellStore::getMovedActor(int actorId) const
{
for(const auto& [cellRef, cell] : mMovedToAnotherCell)
{
if(cellRef->mClass->isActor() && cellRef->mData.getCustomData())
{
Ptr actor(cellRef, cell);
if(actor.getClass().getCreatureStats(actor).getActorId() == actorId)
return actor;
}
}
return {};
}
} }

View File

@ -397,6 +397,8 @@ namespace MWWorld
void respawn (); void respawn ();
///< Check mLastRespawn and respawn references if necessary. This is a no-op if the cell is not loaded. ///< Check mLastRespawn and respawn references if necessary. This is a no-op if the cell is not loaded.
Ptr getMovedActor(int actorId) const;
private: private:
/// Run through references and store IDs /// Run through references and store IDs