diff options
Diffstat (limited to 'src/gui/windows/ministatuswindow.cpp')
-rw-r--r-- | src/gui/windows/ministatuswindow.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index e52a1a8d7..7e12aac0c 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -1,11 +1,11 @@ /* - * The ManaPlus Client + * The ManaVerse Client * Copyright (C) 2004-2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers * Copyright (C) 2011-2020 The ManaPlus Developers - * Copyright (C) 2020-2023 The ManaVerse Developers + * Copyright (C) 2020-2025 The ManaVerse Developers * - * This file is part of The ManaPlus Client. + * This file is part of The ManaVerse Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -462,10 +462,20 @@ void MiniStatusWindow::mouseMoved(MouseEvent &event) } else if (event.getSource() == mWeightBar) { - textPopup->show(x + rect.x, y + rect.y, event.getSource()->getId(), - strprintf("%d/%d", PlayerInfo::getAttribute( - Attributes::TOTAL_WEIGHT), - PlayerInfo::getAttribute(Attributes::MAX_WEIGHT))); + const int totalWeight + = PlayerInfo::getAttribute(Attributes::TOTAL_WEIGHT); + const int maxWeight = PlayerInfo::getAttribute(Attributes::MAX_WEIGHT); + const int freeWeight = maxWeight - totalWeight; + // see maxWeight == 0 edge case in statuswindow for why: + const std::string freeWeightStr + = (freeWeight >= 0) + ? strprintf("Free: %d", freeWeight) + : ""; + + textPopup->show(x + rect.x, y + rect.y, + event.getSource()->getId(), + strprintf("%d/%d", totalWeight, maxWeight), + freeWeightStr); mStatusPopup->hide(); } else if (event.getSource() == mInvSlotsBar) |