diff options
Diffstat (limited to 'src/gui/widgets/avatarlistbox.cpp')
-rw-r--r-- | src/gui/widgets/avatarlistbox.cpp | 65 |
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; } } } |