1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 21:42:13 +00:00

Don't throw exception when using ModDisposition on creatures (Fixes #1548)

This commit is contained in:
scrawl 2014-06-22 00:34:32 +02:00
parent 0bed6d9d56
commit e23a7694f3

View File

@ -690,8 +690,11 @@ namespace MWScript
Interpreter::Type_Integer value = runtime[0].mInteger; Interpreter::Type_Integer value = runtime[0].mInteger;
runtime.pop(); runtime.pop();
if (ptr.getClass().isNpc())
ptr.getClass().getNpcStats (ptr).setBaseDisposition ptr.getClass().getNpcStats (ptr).setBaseDisposition
(ptr.getClass().getNpcStats (ptr).getBaseDisposition() + value); (ptr.getClass().getNpcStats (ptr).getBaseDisposition() + value);
// else: must not throw exception (used by an Almalexia dialogue script)
} }
}; };
@ -707,6 +710,7 @@ namespace MWScript
Interpreter::Type_Integer value = runtime[0].mInteger; Interpreter::Type_Integer value = runtime[0].mInteger;
runtime.pop(); runtime.pop();
if (ptr.getClass().isNpc())
ptr.getClass().getNpcStats (ptr).setBaseDisposition (value); ptr.getClass().getNpcStats (ptr).setBaseDisposition (value);
} }
}; };
@ -720,6 +724,9 @@ namespace MWScript
{ {
MWWorld::Ptr ptr = R()(runtime); MWWorld::Ptr ptr = R()(runtime);
if (!ptr.getClass().isNpc())
runtime.push(0);
else
runtime.push (MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(ptr)); runtime.push (MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(ptr));
} }
}; };