diff options
-rw-r--r-- | src/gui/skilldialog.cpp | 9 | ||||
-rw-r--r-- | src/gui/skilldialog.h | 4 | ||||
-rw-r--r-- | src/net/ea/specialhandler.cpp | 12 |
3 files changed, 14 insertions, 11 deletions
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index 430705b1d..3cd3c7a16 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -79,11 +79,12 @@ struct SkillInfo std::string skillExp; float progress; gcn::Color color; + int range; SkillInfo() : id(0), name(""), dispName(""), icon(nullptr), modifiable(false), visible(false), model(nullptr), skillLevel(""), skillLevelWidth(0), - skillExp(""), progress(0.0f) + skillExp(""), progress(0.0f), range(0) { } @@ -467,7 +468,7 @@ void SkillDialog::loadSkills(const std::string &file) update(); } -bool SkillDialog::setModifiable(int id, bool modifiable) +bool SkillDialog::updateSkill(int id, int range, bool modifiable) { SkillMap::const_iterator it = mSkills.find(id); @@ -477,6 +478,7 @@ bool SkillDialog::setModifiable(int id, bool modifiable) if (info) { info->modifiable = modifiable; + info->range = range; info->update(); } return true; @@ -484,7 +486,7 @@ bool SkillDialog::setModifiable(int id, bool modifiable) return false; } -void SkillDialog::addSkill(int id, int level, bool modifiable) +void SkillDialog::addSkill(int id, int level, int range, bool modifiable) { if (mDefaultModel) { @@ -497,6 +499,7 @@ void SkillDialog::addSkill(int id, int level, bool modifiable) skill->visible = false; skill->model = mDefaultModel; skill->skillLevel = strprintf(_("Lvl: %d"), level); + skill->range = range; skill->update(); mDefaultModel->addSkill(skill); diff --git a/src/gui/skilldialog.h b/src/gui/skilldialog.h index 9032f82ef..1ef609f88 100644 --- a/src/gui/skilldialog.h +++ b/src/gui/skilldialog.h @@ -71,9 +71,9 @@ class SkillDialog : public Window, public gcn::ActionListener void loadSkills(const std::string &file); - bool setModifiable(int id, bool modifiable); + bool updateSkill(int id, int range, bool modifiable); - void addSkill(int id, int level, bool modifiable); + void addSkill(int id, int level, int range, bool modifiable); SkillInfo* getSkill(int id); diff --git a/src/net/ea/specialhandler.cpp b/src/net/ea/specialhandler.cpp index 7b2ef601a..dd0284ae8 100644 --- a/src/net/ea/specialhandler.cpp +++ b/src/net/ea/specialhandler.cpp @@ -90,15 +90,15 @@ void SpecialHandler::processPlayerSkills(Net::MessageIn &msg) msg.skip(2); // skill pool flags int level = msg.readInt16(); msg.readInt16(); // sp - msg.readInt16(); // range + int range = msg.readInt16(); msg.skip(24); // 0 unused int up = msg.readInt8(); PlayerInfo::setStatBase(skillId, level); if (skillDialog) { - if (!skillDialog->setModifiable(skillId, up)) - skillDialog->addSkill(skillId, level, up); + if (!skillDialog->updateSkill(skillId, range, up)) + skillDialog->addSkill(skillId, level, range, up); } } } @@ -108,14 +108,14 @@ void SpecialHandler::processPlayerSkillUp(Net::MessageIn &msg) const int skillId = msg.readInt16(); const int level = msg.readInt16(); msg.readInt16(); // sp - msg.readInt16(); // range + int range = msg.readInt16(); int up = msg.readInt8(); PlayerInfo::setStatBase(skillId, level); if (skillDialog) { - if (!skillDialog->setModifiable(skillId, up)) - skillDialog->addSkill(skillId, level, up); + if (!skillDialog->updateSkill(skillId, range, up)) + skillDialog->addSkill(skillId, level, range, up); } } |