diff --git a/CHANGELOG.md b/CHANGELOG.md index 0da3ba67d..41b57bf28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ Bug #4746: Non-solid player can't run or sneak Bug #4750: Sneaking doesn't work in first person view if the player is in attack ready state Bug #4768: Fallback numerical value recovery chokes on invalid arguments + Bug #4778: Interiors of Illusion puzzle in Sotha Sil Expanded mod is broken Feature #2229: Improve pathfinding AI Feature #3442: Default values for fallbacks from ini file Feature #3610: Option to invert X axis diff --git a/apps/openmw/mwscript/miscextensions.cpp b/apps/openmw/mwscript/miscextensions.cpp index 0cf2fc464..d3b49239c 100644 --- a/apps/openmw/mwscript/miscextensions.cpp +++ b/apps/openmw/mwscript/miscextensions.cpp @@ -431,6 +431,12 @@ namespace MWScript std::string effect = runtime.getStringLiteral(runtime[0].mInteger); runtime.pop(); + if (!ptr.getClass().isActor()) + { + runtime.push(0); + return; + } + char *end; long key = strtol(effect.c_str(), &end, 10); if(key < 0 || key > 32767 || *end != '\0') @@ -659,6 +665,12 @@ namespace MWScript std::string id = runtime.getStringLiteral(runtime[0].mInteger); runtime.pop(); + if (!ptr.getClass().isActor()) + { + runtime.push(0); + return; + } + const MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats(ptr); runtime.push(stats.getActiveSpells().isSpellActive(id) || stats.getSpells().isSpellActive(id)); } diff --git a/apps/openmw/mwscript/statsextensions.cpp b/apps/openmw/mwscript/statsextensions.cpp index 53316c44c..10d1252b9 100644 --- a/apps/openmw/mwscript/statsextensions.cpp +++ b/apps/openmw/mwscript/statsextensions.cpp @@ -536,7 +536,7 @@ namespace MWScript Interpreter::Type_Integer value = 0; - if (ptr.getClass().getCreatureStats(ptr).getSpells().hasSpell(id)) + if (ptr.getClass().isActor() && ptr.getClass().getCreatureStats(ptr).getSpells().hasSpell(id)) value = 1; runtime.push (value); diff --git a/components/esm/loadcrea.cpp b/components/esm/loadcrea.cpp index 83315a5b8..f04439041 100644 --- a/components/esm/loadcrea.cpp +++ b/components/esm/loadcrea.cpp @@ -23,6 +23,7 @@ namespace ESM { mScale = 1.f; mHasAI = false; + mAiData.blank(); bool hasName = false; bool hasNpdt = false; @@ -160,7 +161,6 @@ namespace ESM { mSpells.mList.clear(); mHasAI = false; mAiData.blank(); - mAiData.mServices = 0; mAiPackage.mList.clear(); mTransport.mList.clear(); } diff --git a/components/esm/loadnpc.cpp b/components/esm/loadnpc.cpp index dd34934ad..6e7ba66c5 100644 --- a/components/esm/loadnpc.cpp +++ b/components/esm/loadnpc.cpp @@ -18,6 +18,7 @@ namespace ESM mInventory.mList.clear(); mTransport.mList.clear(); mAiPackage.mList.clear(); + mAiData.blank(); mHasAI = false; bool hasName = false;