mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 09:23:53 +00:00
Fix attempting to access NPC stats on creatures
This commit is contained in:
parent
d18c86ec2d
commit
5e992a0342
1 changed files with 5 additions and 5 deletions
|
@ -448,14 +448,14 @@ namespace MWDialogue
|
|||
{
|
||||
MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Dialogue);
|
||||
|
||||
// Clamp permanent disposition change so that final disposition doesn't go below 0 (could happen with intimidate)
|
||||
float curDisp = static_cast<float>(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mActor, false));
|
||||
if (curDisp + mPermanentDispositionChange < 0)
|
||||
mPermanentDispositionChange = -curDisp;
|
||||
|
||||
// Apply disposition change to NPC's base disposition
|
||||
if (mActor.getClass().isNpc())
|
||||
{
|
||||
// Clamp permanent disposition change so that final disposition doesn't go below 0 (could happen with intimidate)
|
||||
float curDisp = static_cast<float>(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mActor, false));
|
||||
if (curDisp + mPermanentDispositionChange < 0)
|
||||
mPermanentDispositionChange = -curDisp;
|
||||
|
||||
MWMechanics::NpcStats& npcStats = mActor.getClass().getNpcStats(mActor);
|
||||
npcStats.setBaseDisposition(static_cast<int>(npcStats.getBaseDisposition() + mPermanentDispositionChange));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue