mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-19 20:53:52 +00:00
Merge branch 'stay_mad' into 'master'
Update a reference's base record pointer on resurrection Closes #7084 See merge request OpenMW/openmw!2527
This commit is contained in:
commit
f11d4b76d1
2 changed files with 16 additions and 0 deletions
|
@ -27,6 +27,7 @@
|
|||
Bug #7034: Misc items defined in one content file are not treated as keys if another content file uses them as such
|
||||
Bug #7042: Weapon follow animations that immediately follow the hit animations cause multiple hits
|
||||
Bug #7044: Changing a class' services does not affect autocalculated NPCs
|
||||
Bug #7084: Resurrecting an actor doesn't take into account base record changes
|
||||
Feature #6447: Add LOD support to Object Paging
|
||||
Feature #6933: Support high-resolution cursor textures
|
||||
Feature #6945: Support S3TC-compressed and BGR/BGRA NiPixelData
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <cmath>
|
||||
|
||||
#include <components/esm3/loadcrea.hpp>
|
||||
#include <components/esm3/loadnpc.hpp>
|
||||
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
@ -62,6 +63,14 @@ namespace
|
|||
stat.setBase(std::clamp(base + amount, 0.f, 100.f), true);
|
||||
stat.setModifier(newModified - stat.getBase());
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void updateBaseRecord(MWWorld::Ptr& ptr)
|
||||
{
|
||||
const auto& store = MWBase::Environment::get().getWorld()->getStore();
|
||||
const T* base = store.get<T>().find(ptr.getCellRef().getRefId());
|
||||
ptr.get<T>()->mBase = base;
|
||||
}
|
||||
}
|
||||
|
||||
namespace MWScript
|
||||
|
@ -1130,6 +1139,12 @@ namespace MWScript
|
|||
windowManager->onDeleteCustomData(ptr);
|
||||
// HACK: disable/enable object to re-add it to the scene properly (need a new Animation).
|
||||
MWBase::Environment::get().getWorld()->disable(ptr);
|
||||
// The actor's base record may have changed after this specific reference was created.
|
||||
// So we need to update to the current version
|
||||
if (ptr.getClass().isNpc())
|
||||
updateBaseRecord<ESM::NPC>(ptr);
|
||||
else
|
||||
updateBaseRecord<ESM::Creature>(ptr);
|
||||
if (wasOpen && !windowManager->containsMode(MWGui::GM_Container))
|
||||
{
|
||||
// Reopen the loot GUI if it was closed because we resurrected the actor we were looting
|
||||
|
|
Loading…
Reference in a new issue