From 74aa7cdd487dcc9cbd5e4b8e0bebec06654075bb Mon Sep 17 00:00:00 2001 From: psi29a Date: Mon, 5 Jul 2021 08:17:46 +0000 Subject: [PATCH] Merge branch 'fix_door_freeze' into 'master' Fix slow AiPackage::getTarget calls (#6136) Closes #6136 See merge request OpenMW/openmw!990 (cherry picked from commit 6a4eeeb39bbe025625273dffc9754d29733e570a) 8d1eb7e2 Fix slow AiPackage::getTarget calls --- CHANGELOG.md | 1 + apps/openmw/mwmechanics/aipackage.cpp | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ce01b7293..88d6049f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -130,6 +130,7 @@ Bug #6036: OpenMW-CS: Terrain selection at the border of cells omits certain corner vertices Bug #6043: Actor can have torch missing when torch animation is played Bug #6047: Mouse bindings can be triggered during save loading + Bug #6136: Game freezes when NPCs try to open doors that are about to be closed Feature #390: 3rd person look "over the shoulder" Feature #832: OpenMW-CS: Handle deleted references Feature #1536: Show more information about level on menu diff --git a/apps/openmw/mwmechanics/aipackage.cpp b/apps/openmw/mwmechanics/aipackage.cpp index 523949179..8ad944751 100644 --- a/apps/openmw/mwmechanics/aipackage.cpp +++ b/apps/openmw/mwmechanics/aipackage.cpp @@ -55,6 +55,11 @@ MWWorld::Ptr MWMechanics::AiPackage::getTarget() const if (mTargetActorId == -1) { + if (mTargetActorRefId.empty()) + { + mTargetActorId = -2; + return MWWorld::Ptr(); + } MWWorld::Ptr target = MWBase::Environment::get().getWorld()->searchPtr(mTargetActorRefId, false); if (target.isEmpty()) {