1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 22:23:51 +00:00

Allow +/- buttons in trade window to decrease offer to 0

This commit is contained in:
Ben Shealy 2016-04-09 17:49:21 -04:00
parent f2b2a760b3
commit 8703609649

View file

@ -476,15 +476,15 @@ namespace MWGui
// prevent overflows, and prevent entering INT_MIN since abs(INT_MIN) is undefined // prevent overflows, and prevent entering INT_MIN since abs(INT_MIN) is undefined
if (mCurrentBalance == INT_MAX || mCurrentBalance == INT_MIN+1) if (mCurrentBalance == INT_MAX || mCurrentBalance == INT_MIN+1)
return; return;
if(mCurrentBalance<=-1) mCurrentBalance -= 1; if (mCurrentBalance < 0) mCurrentBalance -= 1;
if(mCurrentBalance>=1) mCurrentBalance += 1; else mCurrentBalance += 1;
updateLabels(); updateLabels();
} }
void TradeWindow::onDecreaseButtonTriggered() void TradeWindow::onDecreaseButtonTriggered()
{ {
if(mCurrentBalance<-1) mCurrentBalance += 1; if (mCurrentBalance < 0) mCurrentBalance += 1;
if(mCurrentBalance>1) mCurrentBalance -= 1; else mCurrentBalance -= 1;
updateLabels(); updateLabels();
} }
@ -495,13 +495,13 @@ namespace MWGui
mPlayerGold->setCaptionWithReplacing("#{sYourGold} " + MyGUI::utility::toString(playerGold)); mPlayerGold->setCaptionWithReplacing("#{sYourGold} " + MyGUI::utility::toString(playerGold));
if (mCurrentBalance > 0) if (mCurrentBalance < 0)
{ {
mTotalBalanceLabel->setCaptionWithReplacing("#{sTotalSold}"); mTotalBalanceLabel->setCaptionWithReplacing("#{sTotalCost}");
} }
else else
{ {
mTotalBalanceLabel->setCaptionWithReplacing("#{sTotalCost}"); mTotalBalanceLabel->setCaptionWithReplacing("#{sTotalSold}");
} }
mTotalBalance->setValue(std::abs(mCurrentBalance)); mTotalBalance->setValue(std::abs(mCurrentBalance));