diff options
Diffstat (limited to 'src/gui/windows/statuswindow.cpp')
-rw-r--r-- | src/gui/windows/statuswindow.cpp | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/src/gui/windows/statuswindow.cpp b/src/gui/windows/statuswindow.cpp index b37896476..4cc02794c 100644 --- a/src/gui/windows/statuswindow.cpp +++ b/src/gui/windows/statuswindow.cpp @@ -45,6 +45,8 @@ #include "gui/widgets/vertcontainer.h" #include "gui/widgets/windowcontainer.h" +#include "gui/widgets/attrs/attrdisplay.h" + #include "net/inventoryhandler.h" #include "net/playerhandler.h" #include "net/serverfeatures.h" @@ -712,40 +714,6 @@ void StatusWindow::action(const ActionEvent &event) } } -AttrDisplay::AttrDisplay(const Widget2 *const widget, - const AttributesT id, - const std::string &restrict name, - const std::string &restrict shortName) : - Container(widget), - mId(id), - mName(name), - mShortName(shortName), - mLayout(new LayoutHelper(this)), - mLabel(new Label(this, name)), - mValue(new Label(this, "1 ")) -{ - setSize(100, 32); - - mLabel->setAlignment(Graphics::CENTER); - mValue->setAlignment(Graphics::CENTER); -} - -AttrDisplay::~AttrDisplay() -{ - delete2(mLayout); -} - -std::string AttrDisplay::update() -{ - const int base = PlayerInfo::getStatBase(mId); - const int bonus = PlayerInfo::getStatMod(mId); - std::string value = toString(base + bonus); - if (bonus) - value.append(strprintf("=%d%+d", base, bonus)); - mValue->setCaption(value); - return mName; -} - DerDisplay::DerDisplay(const Widget2 *const widget, const AttributesT id, const std::string &restrict name, |