Skip to content

Commit c33aaa5

Browse files
committed
Merge branch 'disabilitybenefits' into 'master'
Allow disabling objects that have no placed instances (#4289) Closes #4289 See merge request OpenMW/openmw!4498
2 parents 96a05cc + 24f1feb commit c33aaa5

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
Bug #4127: Weapon animation looks choppy
88
Bug #4204: Dead slaughterfish doesn't float to water surface after loading saved game
99
Bug #4207: RestoreHealth/Fatigue spells have a huge priority even if a success chance is near 0
10+
Bug #4289: Script compilation fails if an NPC deleted in a content file is disabled
1011
Bug #4382: Sound output device does not change when it should
1112
Bug #4508: Can't stack enchantment buffs from different instances of the same self-cast generic magic apparel
1213
Bug #4610: Casting a Bound Weapon spell cancels the casting animation by equipping the weapon prematurely

apps/openmw/mwscript/miscextensions.cpp

+20-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,26 @@ namespace MWScript
254254
public:
255255
void execute(Interpreter::Runtime& runtime) override
256256
{
257-
MWWorld::Ptr ptr = R()(runtime);
257+
MWWorld::Ptr ptr;
258+
if (!R::implicit)
259+
{
260+
ESM::RefId name = ESM::RefId::stringRefId(runtime.getStringLiteral(runtime[0].mInteger));
261+
runtime.pop();
262+
263+
ptr = MWBase::Environment::get().getWorld()->searchPtr(name, false);
264+
// We don't normally want to let this go, but some mods insist on trying this
265+
if (ptr.isEmpty())
266+
{
267+
const std::string error = "Failed to find an instance of object " + name.toDebugString();
268+
runtime.getContext().report(error);
269+
Log(Debug::Error) << error;
270+
return;
271+
}
272+
}
273+
else
274+
{
275+
ptr = R()(runtime);
276+
}
258277
MWBase::Environment::get().getWorld()->disable(ptr);
259278
}
260279
};

0 commit comments

Comments
 (0)