summaryrefslogtreecommitdiff
path: root/src/gui/widgets/avatarlistbox.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-04-26 21:56:11 +0300
committerAndrei Karas <akaras@inbox.ru>2011-04-26 21:56:11 +0300
commit8f10444e4ce4a4e25455f0a3857edc7ca74631e8 (patch)
tree7917730822f7bc090adc6af482eab843c79a389c /src/gui/widgets/avatarlistbox.cpp
parent110134603554e06adab93a132ef8f82e55db68ad (diff)
downloadmanaplus-8f10444e4ce4a4e25455f0a3857edc7ca74631e8.tar.gz
manaplus-8f10444e4ce4a4e25455f0a3857edc7ca74631e8.tar.bz2
manaplus-8f10444e4ce4a4e25455f0a3857edc7ca74631e8.tar.xz
manaplus-8f10444e4ce4a4e25455f0a3857edc7ca74631e8.zip
Impliment 3 attack lists. (priority, attack, ignore)
Diffstat (limited to 'src/gui/widgets/avatarlistbox.cpp')
-rw-r--r--src/gui/widgets/avatarlistbox.cpp65
1 files changed, 35 insertions, 30 deletions
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index f3bdb6a45..d16388837 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -308,42 +308,47 @@ void AvatarListBox::mousePressed(gcn::MouseEvent &event)
}
else if (event.getButton() == gcn::MouseEvent::RIGHT)
{
- if (ava->getType() == AVATAR_PLAYER)
+ switch (ava->getType())
{
- Being* being = actorSpriteManager->findBeingByName(
- model->getAvatarAt(selected)->getName(), Being::PLAYER);
- if (being)
- {
- viewport->showPopup(event.getX(), event.getY(), being);
- }
- else
+ case AVATAR_PLAYER:
{
- viewport->showPlayerPopup(
- model->getAvatarAt(selected)->getName());
- }
- }
- else if (ava->getType() == MapItem::MONSTER)
- {
- if (model->getAvatarAt(selected)->getLevel() == 0)
- {
- viewport->showAttackMonsterPopup("",
- model->getAvatarAt(selected)->getOnline());
+ Being* being = actorSpriteManager->findBeingByName(
+ model->getAvatarAt(selected)->getName(), Being::PLAYER);
+ if (being)
+ {
+ viewport->showPopup(event.getX(), event.getY(), being);
+ }
+ else
+ {
+ viewport->showPlayerPopup(
+ model->getAvatarAt(selected)->getName());
+ }
+ break;
}
- else
+ case MapItem::ATTACK:
+ case MapItem::PRIORITY:
+ case MapItem::IGNORE:
{
- viewport->showAttackMonsterPopup(
- model->getAvatarAt(selected)->getName(),
- model->getAvatarAt(selected)->getOnline());
+ std::string name;
+ if (model->getAvatarAt(selected)->getLevel() == 0)
+ name = "";
+ else
+ name = model->getAvatarAt(selected)->getName();
+
+ viewport->showAttackMonsterPopup(name,
+ model->getAvatarAt(selected)->getType());
+ break;
}
- }
- else
- {
- Map *map = viewport->getMap();
- Avatar *ava = model->getAvatarAt(selected);
- if (map && ava)
+ default:
{
- MapItem *mapItem = map->findPortalXY(ava->getX(), ava->getY());
- viewport->showPopup(mapItem);
+ Map *map = viewport->getMap();
+ Avatar *ava = model->getAvatarAt(selected);
+ if (map && ava)
+ {
+ MapItem *mapItem = map->findPortalXY(ava->getX(), ava->getY());
+ viewport->showPopup(mapItem);
+ }
+ break;
}
}
}