diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-20 19:12:19 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-20 19:12:19 +0300 |
commit | ebd21ed95b475d7a411bc6d341fb287b0c125509 (patch) | |
tree | b5db0bb229e36866f0ea546f2f99527259205c9a /src/actormanager.cpp | |
parent | 709c0c8aa1cadef919a106f3c0b83a3b41f5ac1e (diff) | |
download | mv-ebd21ed95b475d7a411bc6d341fb287b0c125509.tar.gz mv-ebd21ed95b475d7a411bc6d341fb287b0c125509.tar.bz2 mv-ebd21ed95b475d7a411bc6d341fb287b0c125509.tar.xz mv-ebd21ed95b475d7a411bc6d341fb287b0c125509.zip |
Remove mercenary skills if mercenary was removed.
Diffstat (limited to 'src/actormanager.cpp')
-rw-r--r-- | src/actormanager.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp index 2b91a30df..c025d9f44 100644 --- a/src/actormanager.cpp +++ b/src/actormanager.cpp @@ -38,6 +38,7 @@ #include "gui/windows/botcheckerwindow.h" #include "gui/windows/chatwindow.h" #include "gui/windows/equipmentwindow.h" +#include "gui/windows/skilldialog.h" #include "gui/windows/socialwindow.h" #include "gui/windows/questswindow.h" @@ -800,21 +801,31 @@ void ActorManager::logic() BLOCK_START("ActorManager::logic 1") FOR_EACH (ActorSpritesConstIterator, it, mDeleteActors) { - if (!*it) + const ActorSprite *const actor = *it; + if (!actor) continue; - if ((*it) && (*it)->getType() == ActorType::Player) + const ActorType::Type &type = actor->getType(); + if (type == ActorType::Player) { - const Being *const being = static_cast<const Being*>(*it); + const Being *const being = static_cast<const Being*>(actor); being->addToCache(); if (beingEquipmentWindow) beingEquipmentWindow->resetBeing(being); } + else if (localPlayer && type == ActorType::Mercenary) + { + if (actor->getId() == localPlayer->getMercenary()) + { + localPlayer->setMercenary(0); + skillDialog->hideSkills(SkillOwner::Mercenary); + } + } if (localPlayer) { - if (localPlayer->getTarget() == *it) + if (localPlayer->getTarget() == actor) localPlayer->setTarget(nullptr); - if (localPlayer->getPickUpTarget() == *it) + if (localPlayer->getPickUpTarget() == actor) localPlayer->unSetPickUpTarget(); } if (viewport) |