From 644dacf6037629ddabcf82c5a02929bfd5652a0c Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 28 Nov 2012 01:30:18 +0100 Subject: [PATCH] suggestion by Zini for SetDelete --- apps/openmw/mwscript/miscextensions.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwscript/miscextensions.cpp b/apps/openmw/mwscript/miscextensions.cpp index b59916cd4..b687471aa 100644 --- a/apps/openmw/mwscript/miscextensions.cpp +++ b/apps/openmw/mwscript/miscextensions.cpp @@ -365,7 +365,16 @@ namespace MWScript virtual void execute (Interpreter::Runtime& runtime) { MWWorld::Ptr ptr = R()(runtime); - MWBase::Environment::get().getWorld()->deleteObject (ptr); + int parameter = runtime[0].mInteger; + runtime.pop(); + + if (parameter == 1) + { + if (ptr.isInCell()) + MWBase::Environment::get().getWorld()->deleteObject (ptr); + else + ptr.getRefData().setCount(0); + } } }; @@ -447,7 +456,7 @@ namespace MWScript extensions.registerFunction ("getweapondrawn", 'l', "", opcodeGetWeaponDrawn, opcodeGetWeaponDrawnExplicit); extensions.registerFunction ("getspelleffects", 'l', "c", opcodeGetSpellEffects, opcodeGetSpellEffectsExplicit); extensions.registerFunction ("getcurrenttime", 'f', "", opcodeGetCurrentTime); - extensions.registerInstruction ("setdelete", "", opcodeSetDelete, opcodeSetDeleteExplicit); + extensions.registerInstruction ("setdelete", "l", opcodeSetDelete, opcodeSetDeleteExplicit); extensions.registerFunction ("getsquareroot", 'f', "f", opcodeGetSquareRoot); }