diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-05 11:24:55 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-06 01:18:57 +0300 |
commit | 89c117a64240de90c19004c846edf7c524f6484d (patch) | |
tree | 5857766b21e849b94e81267a5054594bd5bf5f1d | |
parent | feeddcb6fe41864d862b9e36e503d3ace07eb76d (diff) | |
download | plus-89c117a64240de90c19004c846edf7c524f6484d.tar.gz plus-89c117a64240de90c19004c846edf7c524f6484d.tar.bz2 plus-89c117a64240de90c19004c846edf7c524f6484d.tar.xz plus-89c117a64240de90c19004c846edf7c524f6484d.zip |
For unknown skills use if possible server side skill name.
-rw-r--r-- | src/gui/windows/skilldialog.cpp | 17 | ||||
-rw-r--r-- | src/gui/windows/skilldialog.h | 5 | ||||
-rw-r--r-- | src/net/ea/skillhandler.cpp | 2 | ||||
-rw-r--r-- | src/net/eathena/skillhandler.cpp | 4 | ||||
-rw-r--r-- | src/net/tmwa/skillhandler.cpp | 2 |
5 files changed, 22 insertions, 8 deletions
diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 0babe5d38..63451d1a1 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -361,7 +361,10 @@ bool SkillDialog::updateSkill(const int id, const int range, return false; } -void SkillDialog::addSkill(const int id, const int level, const int range, +void SkillDialog::addSkill(const int id, + const std::string &name, + const int level, + const int range, const bool modifiable) { if (mDefaultModel) @@ -369,8 +372,16 @@ void SkillDialog::addSkill(const int id, const int level, const int range, SkillInfo *const skill = new SkillInfo; skill->id = static_cast<unsigned int>(id); SkillData *const data = skill->data; - data->name = "Unknown skill Id: " + toString(id); - data->dispName = data->name; + if (name.empty()) + { + data->name = "Unknown skill Id: " + toString(id); + data->dispName = data->name; + } + else + { + data->name = name; + data->dispName = strprintf("%s, %u", name.c_str(), skill->id); + } data->description.clear(); data->setIcon(""); skill->modifiable = modifiable; diff --git a/src/gui/windows/skilldialog.h b/src/gui/windows/skilldialog.h index 394679d1b..e82faef05 100644 --- a/src/gui/windows/skilldialog.h +++ b/src/gui/windows/skilldialog.h @@ -75,7 +75,10 @@ class SkillDialog final : public Window, bool updateSkill(const int id, const int range, const bool modifiable); - void addSkill(const int id, const int level, const int range, + void addSkill(const int id, + const std::string &name, + const int level, + const int range, const bool modifiable); SkillInfo* getSkill(const int id) const A_WARN_UNUSED; diff --git a/src/net/ea/skillhandler.cpp b/src/net/ea/skillhandler.cpp index ecf98952a..5197cff30 100644 --- a/src/net/ea/skillhandler.cpp +++ b/src/net/ea/skillhandler.cpp @@ -89,7 +89,7 @@ void SkillHandler::processPlayerSkillUp(Net::MessageIn &msg) if (skillDialog) { if (!skillDialog->updateSkill(skillId, range, up)) - skillDialog->addSkill(skillId, level, range, up); + skillDialog->addSkill(skillId, "", level, range, up); } } diff --git a/src/net/eathena/skillhandler.cpp b/src/net/eathena/skillhandler.cpp index afb766ac8..d9aedce2c 100644 --- a/src/net/eathena/skillhandler.cpp +++ b/src/net/eathena/skillhandler.cpp @@ -111,7 +111,7 @@ void SkillHandler::processPlayerSkills(Net::MessageIn &msg) const int level = msg.readInt16("skill level"); msg.readInt16("sp"); const int range = msg.readInt16("range"); - msg.readString(24, "skill name"); + const std::string name = msg.readString(24, "skill name"); const int up = msg.readUInt8("up flag"); const int oldLevel = PlayerInfo::getSkillLevel(skillId); if (oldLevel && oldLevel != level) @@ -120,7 +120,7 @@ void SkillHandler::processPlayerSkills(Net::MessageIn &msg) if (skillDialog) { if (!skillDialog->updateSkill(skillId, range, up)) - skillDialog->addSkill(skillId, level, range, up); + skillDialog->addSkill(skillId, name, level, range, up); } } if (updateSkill && skillDialog) diff --git a/src/net/tmwa/skillhandler.cpp b/src/net/tmwa/skillhandler.cpp index 33e06cd3c..b4a39d4e7 100644 --- a/src/net/tmwa/skillhandler.cpp +++ b/src/net/tmwa/skillhandler.cpp @@ -123,7 +123,7 @@ void SkillHandler::processPlayerSkills(Net::MessageIn &msg) if (skillDialog) { if (!skillDialog->updateSkill(skillId, range, up)) - skillDialog->addSkill(skillId, level, range, up); + skillDialog->addSkill(skillId, "", level, range, up); } } if (updateSkill && skillDialog) |