From 8703609649c3d87c5def0db6d427cb69df958655 Mon Sep 17 00:00:00 2001 From: Ben Shealy Date: Sat, 9 Apr 2016 17:49:21 -0400 Subject: [PATCH] Allow +/- buttons in trade window to decrease offer to 0 --- apps/openmw/mwgui/tradewindow.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/openmw/mwgui/tradewindow.cpp b/apps/openmw/mwgui/tradewindow.cpp index c084ec2439..ed81677e46 100644 --- a/apps/openmw/mwgui/tradewindow.cpp +++ b/apps/openmw/mwgui/tradewindow.cpp @@ -476,15 +476,15 @@ namespace MWGui // prevent overflows, and prevent entering INT_MIN since abs(INT_MIN) is undefined if (mCurrentBalance == INT_MAX || mCurrentBalance == INT_MIN+1) return; - if(mCurrentBalance<=-1) mCurrentBalance -= 1; - if(mCurrentBalance>=1) mCurrentBalance += 1; + if (mCurrentBalance < 0) mCurrentBalance -= 1; + else mCurrentBalance += 1; updateLabels(); } void TradeWindow::onDecreaseButtonTriggered() { - if(mCurrentBalance<-1) mCurrentBalance += 1; - if(mCurrentBalance>1) mCurrentBalance -= 1; + if (mCurrentBalance < 0) mCurrentBalance += 1; + else mCurrentBalance -= 1; updateLabels(); } @@ -495,13 +495,13 @@ namespace MWGui mPlayerGold->setCaptionWithReplacing("#{sYourGold} " + MyGUI::utility::toString(playerGold)); - if (mCurrentBalance > 0) + if (mCurrentBalance < 0) { - mTotalBalanceLabel->setCaptionWithReplacing("#{sTotalSold}"); + mTotalBalanceLabel->setCaptionWithReplacing("#{sTotalCost}"); } else { - mTotalBalanceLabel->setCaptionWithReplacing("#{sTotalCost}"); + mTotalBalanceLabel->setCaptionWithReplacing("#{sTotalSold}"); } mTotalBalance->setValue(std::abs(mCurrentBalance));