diff options
Diffstat (limited to 'src/gui/windows/ministatuswindow.cpp')
-rw-r--r-- | src/gui/windows/ministatuswindow.cpp | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index 4c2b2d376..8b5159333 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 @@ -50,6 +50,7 @@ #include "utils/dtor.h" #include "utils/foreach.h" #include "utils/gettext.h" +#include "utils/performance.h" #include "debug.h" @@ -275,8 +276,6 @@ void MiniStatusWindow::statChanged(const AttributesT id A_UNUSED, statusWindow->updateMPBar(mMpBar, false); } - StatusWindow::updateJobBar(mJobBar, - true); } void MiniStatusWindow::attributeChanged(const AttributesT id, @@ -302,6 +301,11 @@ void MiniStatusWindow::attributeChanged(const AttributesT id, StatusWindow::updateXPBar(mXpBar, true); break; + case Attributes::PLAYER_JOB_LEVEL: + case Attributes::PLAYER_JOB_EXP: + case Attributes::PLAYER_JOB_EXP_NEEDED: + StatusWindow::updateJobBar(mJobBar, true); + break; case Attributes::TOTAL_WEIGHT: case Attributes::MAX_WEIGHT: StatusWindow::updateWeightBar(mWeightBar); @@ -459,10 +463,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) |