Merge branch 'openmw-tradeglitch' into master

pull/3174/head
Evil Eye 3 years ago
commit 6b482d0b52

@ -177,6 +177,7 @@ Programmers
PlutonicOverkill
Radu-Marius Popovici (rpopovici)
Rafael Moura (dhustkoder)
Randy Davin (Kindi)
rdimesio
rexelion
riothamus

@ -44,6 +44,7 @@
Bug #6174: Spellmaking and Enchanting sliders differences from vanilla
Bug #6184: Command and Calm and Demoralize and Frenzy and Rally magic effects inconsistencies with vanilla
Bug #6197: Infinite Casting Loop
Bug #6258: Barter menu glitches out when modifying prices
Bug #6273: Respawning NPCs rotation is inconsistent
Bug #6282: Laura craft doesn't follow the player character
Bug #6283: Avis Dorsey follows you after her death
@ -51,6 +52,7 @@
Bug #6291: Can't pickup the dead mage's journal from the mysterious hunter mod
Bug #6302: Teleporting disabled actor breaks its disabled state
Bug #6307: Pathfinding in Infidelities quest from Tribunal addon is broken
Bug #6322: Total sold/cost should reset to 0 when there are no items offered
Bug #6323: Wyrmhaven: Alboin doesn't follower the player character out of his house
Bug #6326: Detect Enchantment/Key should detect items in unresolved containers
Feature #890: OpenMW-CS: Column filtering

@ -265,6 +265,8 @@ namespace MWGui
const MWWorld::Store<ESM::GameSetting> &gmst =
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
if (mTotalBalance->getValue() == 0) mCurrentBalance = 0;
// were there any items traded at all?
const std::vector<ItemStack>& playerBought = playerItemModel->getItemsBorrowedToUs();
const std::vector<ItemStack>& merchantBought = mTradeModel->getItemsBorrowedToUs();
@ -405,10 +407,15 @@ namespace MWGui
void TradeWindow::onBalanceValueChanged(int value)
{
int previousBalance = mCurrentBalance;
// Entering a "-" sign inverts the buying/selling state
mCurrentBalance = (mCurrentBalance >= 0 ? 1 : -1) * value;
updateLabels();
if (mCurrentBalance == 0)
mCurrentBalance = previousBalance;
if (value != std::abs(value))
mTotalBalance->setValue(std::abs(value));
}
@ -418,6 +425,7 @@ namespace MWGui
// prevent overflows, and prevent entering INT_MIN since abs(INT_MIN) is undefined
if (mCurrentBalance == std::numeric_limits<int>::max() || mCurrentBalance == std::numeric_limits<int>::min()+1)
return;
if (mTotalBalance->getValue() == 0) mCurrentBalance = 0;
if (mCurrentBalance < 0) mCurrentBalance -= 1;
else mCurrentBalance += 1;
updateLabels();
@ -425,6 +433,7 @@ namespace MWGui
void TradeWindow::onDecreaseButtonTriggered()
{
if (mTotalBalance->getValue() == 0) mCurrentBalance = 0;
if (mCurrentBalance < 0) mCurrentBalance += 1;
else mCurrentBalance -= 1;
updateLabels();
@ -434,9 +443,17 @@ namespace MWGui
{
MWWorld::Ptr player = MWMechanics::getPlayer();
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
mPlayerGold->setCaptionWithReplacing("#{sYourGold} " + MyGUI::utility::toString(playerGold));
TradeItemModel* playerTradeModel = MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getTradeModel();
const std::vector<ItemStack>& playerBorrowed = playerTradeModel->getItemsBorrowedToUs();
const std::vector<ItemStack>& merchantBorrowed = mTradeModel->getItemsBorrowedToUs();
if (playerBorrowed.empty() && merchantBorrowed.empty())
{
mCurrentBalance = 0;
}
if (mCurrentBalance < 0)
{
mTotalBalanceLabel->setCaptionWithReplacing("#{sTotalCost}");

Loading…
Cancel
Save