From 5a5cb1a160d65b9b1d84a65bece4a7626daab3ec Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Sun, 17 Sep 2017 14:09:29 +0100 Subject: [PATCH 1/2] Check death counts are for valid actors before loading them --- apps/openmw/mwmechanics/actors.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index baa2470da..673304d30 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -1767,9 +1767,12 @@ namespace MWMechanics while (reader.isNextSub("ID__")) { std::string id = reader.getHString(); - int count; - reader.getHNT (count, "COUN"); - mDeathCount[id] = count; + if (MWBase::Environment::get().getWorld()->getStore().find(id)) + { + int count; + reader.getHNT(count, "COUN"); + mDeathCount[id] = count; + } } } } From 0be7e2a5a574354ebe7dc14c05ca22becf934315 Mon Sep 17 00:00:00 2001 From: AnyOldName3 Date: Sun, 17 Sep 2017 14:16:17 +0100 Subject: [PATCH 2/2] Fix really obvious flaw with ignored records not being skipped that I missed --- apps/openmw/mwmechanics/actors.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 673304d30..0cb7619db 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -1767,12 +1767,10 @@ namespace MWMechanics while (reader.isNextSub("ID__")) { std::string id = reader.getHString(); + int count; + reader.getHNT(count, "COUN"); if (MWBase::Environment::get().getWorld()->getStore().find(id)) - { - int count; - reader.getHNT(count, "COUN"); mDeathCount[id] = count; - } } } }