summaryrefslogtreecommitdiff
path: root/src/gui/windows/buydialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/windows/buydialog.cpp')
-rw-r--r--src/gui/windows/buydialog.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp
index 2786671cd..f30fb92e4 100644
--- a/src/gui/windows/buydialog.cpp
+++ b/src/gui/windows/buydialog.cpp
@@ -762,14 +762,12 @@ void BuyDialog::updateButtonsAndLabels()
mMaxItems = 1;
// Calculate how many the player can carry
- using namespace PlayerInfo; // trick for line-length.
const int itemWeight = item->getInfo().getWeight();
- // Should be inside if, but line-length...
- const int myTotalWeight = getAttribute(Attributes::TOTAL_WEIGHT);
- const int myMaxWeight = getAttribute(Attributes::MAX_WEIGHT);
if (itemWeight != 0)
{
- const int myFreeWeight = myMaxWeight - myTotalWeight;
+ const int myFreeWeight
+ = PlayerInfo::getAttribute(Attributes::MAX_WEIGHT)
+ - PlayerInfo::getAttribute(Attributes::TOTAL_WEIGHT);
const int canCarry = myFreeWeight / itemWeight;
mMaxItems = std::min(mMaxItems, canCarry);
}