Don't let disposition at end of dialogue be below 0 (Fixes #3584)

coverity_scan^2
Allofich 8 years ago
parent 37bfa88b2d
commit 028db21c8a

@ -448,6 +448,12 @@ namespace MWDialogue
{ {
MWBase::Environment::get().getWindowManager()->removeGuiMode(MWGui::GM_Dialogue); 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 // Apply disposition change to NPC's base disposition
if (mActor.getClass().isNpc()) if (mActor.getClass().isNpc())
{ {

Loading…
Cancel
Save