diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-11-24 14:41:09 -0700 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-11-24 14:41:09 -0700 |
commit | fcc940800c047322aea40da5a24d9d5c0fbd051e (patch) | |
tree | 8249555c102bf51af4f4996a9af4f22bbd65838a | |
parent | 1d5a5c6d4d1125a57c60058cf9c1e49633236f32 (diff) | |
download | mana-fcc940800c047322aea40da5a24d9d5c0fbd051e.tar.gz mana-fcc940800c047322aea40da5a24d9d5c0fbd051e.tar.bz2 mana-fcc940800c047322aea40da5a24d9d5c0fbd051e.tar.xz mana-fcc940800c047322aea40da5a24d9d5c0fbd051e.zip |
Fix increasing attributes that are at max
-rw-r--r-- | src/gui/statuswindow.cpp | 16 | ||||
-rw-r--r-- | src/net/ea/playerhandler.cpp | 60 |
2 files changed, 67 insertions, 9 deletions
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); |