From b56d50287ec1e372570b2a707443fc99892dc4c5 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sat, 11 May 2013 22:56:36 +0200 Subject: [PATCH] Barter mechanic fix --- apps/openmw/mwgui/tradewindow.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwgui/tradewindow.cpp b/apps/openmw/mwgui/tradewindow.cpp index 42e92ff0c5..6a46478afe 100644 --- a/apps/openmw/mwgui/tradewindow.cpp +++ b/apps/openmw/mwgui/tradewindow.cpp @@ -288,8 +288,10 @@ namespace MWGui int a = abs(mCurrentMerchantOffer); int b = abs(mCurrentBalance); int d = 0; - if (mCurrentMerchantOffer<0) d = int(100 * (a - b) / a); - else d = int(100 * (b - a) / a); + if (mCurrentBalance<0) + d = int(100 * (a - b) / a); + else + d = int(100 * (b - a) / a); float clampedDisposition = std::max(0,std::min(int(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mPtr) + MWBase::Environment::get().getDialogueManager()->getTemporaryDispositionChange()),100)); @@ -310,8 +312,10 @@ namespace MWGui float pcTerm = (clampedDisposition - 50 + a1 + b1 + c1) * playerStats.getFatigueTerm(); float npcTerm = (d1 + e1 + f1) * sellerStats.getFatigueTerm(); float x = gmst.find("fBargainOfferMulti")->getFloat() * d + gmst.find("fBargainOfferBase")->getFloat(); - if (mCurrentMerchantOffer<0) x += abs(int(pcTerm - npcTerm)); - else x += abs(int(npcTerm - pcTerm)); + if (mCurrentBalance<0) + x += abs(int(pcTerm - npcTerm)); + else + x += abs(int(npcTerm - pcTerm)); int roll = std::rand()%100 + 1; if(roll > x) //trade refused