1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-08 09:37:53 +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;
runtime.pop();
ptr.getClass().getNpcStats (ptr).setBaseDisposition
(ptr.getClass().getNpcStats (ptr).getBaseDisposition() + value);
if (ptr.getClass().isNpc())
ptr.getClass().getNpcStats (ptr).setBaseDisposition
(ptr.getClass().getNpcStats (ptr).getBaseDisposition() + value);
// else: must not throw exception (used by an Almalexia dialogue script)
}
};
@ -707,7 +710,8 @@ namespace MWScript
Interpreter::Type_Integer value = runtime[0].mInteger;
runtime.pop();
ptr.getClass().getNpcStats (ptr).setBaseDisposition (value);
if (ptr.getClass().isNpc())
ptr.getClass().getNpcStats (ptr).setBaseDisposition (value);
}
};
@ -720,7 +724,10 @@ namespace MWScript
{
MWWorld::Ptr ptr = R()(runtime);
runtime.push (MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(ptr));
if (!ptr.getClass().isNpc())
runtime.push(0);
else
runtime.push (MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(ptr));
}
};