summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-21 13:01:00 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-21 13:01:00 +0300
commitba88670fe4b5f4606f80651f6433cc755ab6b6c1 (patch)
treeb0f8c94e63385df3fafaf8dfe70cc3d0357146a4 /src
parentebd21ed95b475d7a411bc6d341fb287b0c125509 (diff)
downloadmanaplus-ba88670fe4b5f4606f80651f6433cc755ab6b6c1.tar.gz
manaplus-ba88670fe4b5f4606f80651f6433cc755ab6b6c1.tar.bz2
manaplus-ba88670fe4b5f4606f80651f6433cc755ab6b6c1.tar.xz
manaplus-ba88670fe4b5f4606f80651f6433cc755ab6b6c1.zip
Fix updating skills window if some skills was removed.
Diffstat (limited to 'src')
-rw-r--r--src/actormanager.cpp6
-rw-r--r--src/gui/windows/skilldialog.cpp30
-rw-r--r--src/gui/windows/skilldialog.h2
-rw-r--r--src/net/eathena/mercenaryhandler.cpp2
-rw-r--r--src/net/eathena/skillhandler.cpp8
-rw-r--r--src/net/tmwa/skillhandler.cpp8
6 files changed, 49 insertions, 7 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp
index c025d9f44..7f4114c1c 100644
--- a/src/actormanager.cpp
+++ b/src/actormanager.cpp
@@ -818,7 +818,11 @@ void ActorManager::logic()
if (actor->getId() == localPlayer->getMercenary())
{
localPlayer->setMercenary(0);
- skillDialog->hideSkills(SkillOwner::Mercenary);
+ if (skillDialog)
+ {
+ skillDialog->hideSkills(SkillOwner::Mercenary);
+ skillDialog->updateModels();
+ }
}
}
if (localPlayer)
diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp
index feef1dba6..d08ee4d1a 100644
--- a/src/gui/windows/skilldialog.cpp
+++ b/src/gui/windows/skilldialog.cpp
@@ -196,8 +196,31 @@ void SkillDialog::update()
FOR_EACH (SkillMap::const_iterator, it, mSkills)
{
- if ((*it).second && (*it).second->modifiable)
- (*it).second->update();
+ SkillInfo *const info = (*it).second;
+ if (info && info->modifiable)
+ info->update();
+ }
+}
+
+void SkillDialog::updateModels()
+{
+ std::set<SkillModel*> models;
+
+ FOR_EACH (SkillMap::const_iterator, it, mSkills)
+ {
+ SkillInfo *const info = (*it).second;
+ if (info)
+ {
+ SkillModel *const model = info->model;
+ if (model)
+ models.insert(model);
+ }
+ }
+ FOR_EACH (std::set<SkillModel*>::iterator, it, models)
+ {
+ SkillModel *const model = *it;
+ if (model)
+ model->updateVisibilities();
}
}
@@ -218,7 +241,10 @@ void SkillDialog::hideSkills(const SkillOwner::Type owner)
{
SkillInfo *const info = (*it).second;
if (info && info->owner == owner)
+ {
+ PlayerInfo::setSkillLevel(info->id, 0);
info->visible = false;
+ }
}
}
diff --git a/src/gui/windows/skilldialog.h b/src/gui/windows/skilldialog.h
index ddeea2cc7..1a24d4e93 100644
--- a/src/gui/windows/skilldialog.h
+++ b/src/gui/windows/skilldialog.h
@@ -70,6 +70,8 @@ class SkillDialog final : public Window,
*/
void update();
+ void updateModels();
+
void loadXmlFile(const std::string &fileName);
void clearSkills();
diff --git a/src/net/eathena/mercenaryhandler.cpp b/src/net/eathena/mercenaryhandler.cpp
index 63c43f093..424bc337c 100644
--- a/src/net/eathena/mercenaryhandler.cpp
+++ b/src/net/eathena/mercenaryhandler.cpp
@@ -141,6 +141,8 @@ void MercenaryHandler::processMercenarySkills(Net::MessageIn &msg)
}
}
}
+ if (skillDialog)
+ skillDialog->update();
}
} // namespace EAthena
diff --git a/src/net/eathena/skillhandler.cpp b/src/net/eathena/skillhandler.cpp
index bcd90b6e0..a23700df4 100644
--- a/src/net/eathena/skillhandler.cpp
+++ b/src/net/eathena/skillhandler.cpp
@@ -151,8 +151,12 @@ void SkillHandler::processPlayerSkills(Net::MessageIn &msg)
}
}
}
- if (updateSkill && skillDialog)
- skillDialog->playUpdateEffect(updateSkill);
+ if (skillDialog)
+ {
+ skillDialog->update();
+ if (updateSkill)
+ skillDialog->playUpdateEffect(updateSkill);
+ }
}
void SkillHandler::processSkillCoolDown(Net::MessageIn &msg)
diff --git a/src/net/tmwa/skillhandler.cpp b/src/net/tmwa/skillhandler.cpp
index bfedcf927..e6d6115eb 100644
--- a/src/net/tmwa/skillhandler.cpp
+++ b/src/net/tmwa/skillhandler.cpp
@@ -142,8 +142,12 @@ void SkillHandler::processPlayerSkills(Net::MessageIn &msg)
}
}
}
- if (updateSkill && skillDialog)
- skillDialog->playUpdateEffect(updateSkill);
+ if (skillDialog)
+ {
+ skillDialog->update();
+ if (updateSkill)
+ skillDialog->playUpdateEffect(updateSkill);
+ }
}
} // namespace TmwAthena