From 2821f46a181371d5fac71d235c60f6008fbfba24 Mon Sep 17 00:00:00 2001 From: scrawl Date: Tue, 1 Mar 2016 11:31:08 +0100 Subject: [PATCH] Corpse clearing fix --- apps/openmw/mwmechanics/creaturestats.cpp | 2 +- apps/openmw/mwworld/cellstore.cpp | 2 +- components/esm/creaturestats.cpp | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwmechanics/creaturestats.cpp b/apps/openmw/mwmechanics/creaturestats.cpp index 50b1a89b3..13396e3fa 100644 --- a/apps/openmw/mwmechanics/creaturestats.cpp +++ b/apps/openmw/mwmechanics/creaturestats.cpp @@ -22,7 +22,7 @@ namespace MWMechanics mKnockdown(false), mKnockdownOneFrame(false), mKnockdownOverOneFrame(false), mHitRecovery(false), mBlock(false), mMovementFlags(0), mFallHeight(0), mRecalcMagicka(false), mLastRestock(0,0), mGoldPool(0), mActorId(-1), - mDeathAnimation(0), mLevel (0) + mDeathAnimation(0), mTimeOfDeath(), mLevel (0) { for (int i=0; i<4; ++i) mAiSettings[i] = 0; diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index e4bfde04a..13f74e22b 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -893,7 +893,7 @@ namespace MWWorld { const MWMechanics::CreatureStats& creatureStats = ptr.getClass().getCreatureStats(ptr); static const float fCorpseClearDelay = MWBase::Environment::get().getWorld()->getStore().get().find("fCorpseClearDelay")->getFloat(); - if (!ptr.getClass().isPersistent(ptr) && creatureStats.getTimeOfDeath() + fCorpseClearDelay <= MWBase::Environment::get().getWorld()->getTimeStamp()) + if (creatureStats.isDead() && !ptr.getClass().isPersistent(ptr) && creatureStats.getTimeOfDeath() + fCorpseClearDelay <= MWBase::Environment::get().getWorld()->getTimeStamp()) MWBase::Environment::get().getWorld()->deleteObject(ptr); } diff --git a/components/esm/creaturestats.cpp b/components/esm/creaturestats.cpp index 2200297e2..9b60382e9 100644 --- a/components/esm/creaturestats.cpp +++ b/components/esm/creaturestats.cpp @@ -87,6 +87,8 @@ void ESM::CreatureStats::load (ESMReader &esm) mDeathAnimation = 0; esm.getHNOT (mDeathAnimation, "DANM"); + mTimeOfDeath.mDay = 0; + mTimeOfDeath.mHour = 0; esm.getHNOT (mTimeOfDeath, "DTIM"); mSpells.load(esm);