From fcc940800c047322aea40da5a24d9d5c0fbd051e Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Tue, 24 Nov 2009 14:41:09 -0700 Subject: Fix increasing attributes that are at max --- src/gui/statuswindow.cpp | 16 +++++++++--- src/net/ea/playerhandler.cpp | 60 +++++++++++++++++++++++++++++++++++++++----- 2 files changed, 67 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 7d4a612d..c479fed7 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -473,7 +473,7 @@ DerDisplay::DerDisplay(int id, const std::string &name): ChangeDisplay::ChangeDisplay(int id, const std::string &name): AttrDisplay(id, name), mNeeded(1) { - mPoints = new Label("1 "); + mPoints = new Label(_("Max")); mInc = new Button(_("+"), "inc", this); // Do the layout @@ -501,11 +501,21 @@ ChangeDisplay::ChangeDisplay(int id, const std::string &name): std::string ChangeDisplay::update() { - mPoints->setCaption(toString(mNeeded)); + if (mNeeded > 0) + { + mPoints->setCaption(toString(mNeeded)); + } + else + { + mPoints->setCaption(_("Max")); + } if (mDec) + { mDec->setEnabled(player_node->getCorrectionPoints()); - mInc->setEnabled(player_node->getCharacterPoints() >= mNeeded); + } + mInc->setEnabled(player_node->getCharacterPoints() >= mNeeded && + mNeeded > 0); return AttrDisplay::update(); } diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 3055e934..dd0d099a 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -372,32 +372,80 @@ void PlayerHandler::handleMessage(Net::MessageIn &msg) int val = msg.readInt8(); player_node->setAttributeEffective(STR, val + ATTR_BONUS(STR)); player_node->setAttributeBase(STR, val); - statusWindow->setPointsNeeded(STR, msg.readInt8()); + if (val >= 99) + { + statusWindow->setPointsNeeded(STR, 0); + msg.readInt8(); + } + else + { + statusWindow->setPointsNeeded(STR, msg.readInt8()); + } val = msg.readInt8(); player_node->setAttributeEffective(AGI, val + ATTR_BONUS(AGI)); player_node->setAttributeBase(AGI, val); - statusWindow->setPointsNeeded(AGI, msg.readInt8()); + if (val >= 99) + { + statusWindow->setPointsNeeded(AGI, 0); + msg.readInt8(); + } + else + { + statusWindow->setPointsNeeded(AGI, msg.readInt8()); + } val = msg.readInt8(); player_node->setAttributeEffective(VIT, val + ATTR_BONUS(VIT)); player_node->setAttributeBase(VIT, val); - statusWindow->setPointsNeeded(VIT, msg.readInt8()); + if (val >= 99) + { + statusWindow->setPointsNeeded(VIT, 0); + msg.readInt8(); + } + else + { + statusWindow->setPointsNeeded(VIT, msg.readInt8()); + } val = msg.readInt8(); player_node->setAttributeEffective(INT, val + ATTR_BONUS(INT)); player_node->setAttributeBase(INT, val); - statusWindow->setPointsNeeded(INT, msg.readInt8()); + if (val >= 99) + { + statusWindow->setPointsNeeded(INT, 0); + msg.readInt8(); + } + else + { + statusWindow->setPointsNeeded(INT, msg.readInt8()); + } val = msg.readInt8(); player_node->setAttributeEffective(DEX, val + ATTR_BONUS(DEX)); player_node->setAttributeBase(DEX, val); - statusWindow->setPointsNeeded(DEX, msg.readInt8()); + if (val >= 99) + { + statusWindow->setPointsNeeded(DEX, 0); + msg.readInt8(); + } + else + { + statusWindow->setPointsNeeded(DEX, msg.readInt8()); + } val = msg.readInt8(); player_node->setAttributeEffective(LUK, val + ATTR_BONUS(LUK)); player_node->setAttributeBase(LUK, val); - statusWindow->setPointsNeeded(LUK, msg.readInt8()); + if (val >= 99) + { + statusWindow->setPointsNeeded(LUK, 0); + msg.readInt8(); + } + else + { + statusWindow->setPointsNeeded(LUK, msg.readInt8()); + } val = msg.readInt16(); // ATK player_node->setAttributeBase(ATK, val); -- cgit v1.2.3-60-g2f50