diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-08-03 00:46:38 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-08-03 13:17:37 +0300 |
commit | 8b2464a723f7039a3efbc0c7d2e883729b3fa7dd (patch) | |
tree | 0564c85d8f6301d8a0b916f37612e27788d82853 /src/gui/widgets/avatarlistbox.cpp | |
parent | 63054bddcc1a306787250209b03c04086b9b472f (diff) | |
download | manaverse-8b2464a723f7039a3efbc0c7d2e883729b3fa7dd.tar.gz manaverse-8b2464a723f7039a3efbc0c7d2e883729b3fa7dd.tar.bz2 manaverse-8b2464a723f7039a3efbc0c7d2e883729b3fa7dd.tar.xz manaverse-8b2464a723f7039a3efbc0c7d2e883729b3fa7dd.zip |
Fix some casts.
Diffstat (limited to 'src/gui/widgets/avatarlistbox.cpp')
-rw-r--r-- | src/gui/widgets/avatarlistbox.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index 6369efce8..36c6592fd 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -129,7 +129,9 @@ void AvatarListBox::draw(Graphics *graphics) if (!a) continue; - if (a->getType() != MapItemType::SEPARATOR) + const MapItemType::Type type = static_cast<MapItemType::Type>( + a->getType()); + if (type != MapItemType::SEPARATOR) { // Draw online status const Image *const icon = a->getOnline() @@ -165,6 +167,8 @@ void AvatarListBox::draw(Graphics *graphics) if (!a) continue; + const MapItemType::Type type = static_cast<MapItemType::Type>( + a->getType()); std::string text; if (a->getMaxHp() > 0) @@ -304,7 +308,7 @@ void AvatarListBox::draw(Graphics *graphics) // Draw Name if (a->getDisplayBold()) { - if (a->getType() == MapItemType::SEPARATOR) + if (type == MapItemType::SEPARATOR) { boldFont->drawString(graphics, text, mImagePadding + mPadding, y + mPadding); @@ -317,7 +321,7 @@ void AvatarListBox::draw(Graphics *graphics) } else { - if (a->getType() == MapItemType::SEPARATOR) + if (type == MapItemType::SEPARATOR) { font->drawString(graphics, text, mImagePadding + mPadding, y + mPadding); @@ -357,11 +361,14 @@ void AvatarListBox::mousePressed(MouseEvent &event) if (!ava) return; + const MapItemType::Type type = static_cast<MapItemType::Type>( + ava->getType()); + event.consume(); const unsigned int eventButton = event.getButton(); if (eventButton == MouseButton::LEFT) { - if (ava->getType() == AVATAR_PLAYER) + if (type == MapItemType::EMPTY) { const Being *const being = actorManager->findBeingByName( ava->getName(), ActorType::PLAYER); @@ -375,9 +382,8 @@ void AvatarListBox::mousePressed(MouseEvent &event) } else if (eventButton == MouseButton::RIGHT) { - switch (ava->getType()) + switch (type) { - // AVATAR_PLAYER case MapItemType::EMPTY: { const Avatar *const avatar = model->getAvatarAt(selected); @@ -403,7 +409,8 @@ void AvatarListBox::mousePressed(MouseEvent &event) name = model->getAvatarAt(selected)->getName(); popupManager->showAttackMonsterPopup(name, - model->getAvatarAt(selected)->getType()); + static_cast<ActorType::Type>(model->getAvatarAt( + selected)->getType())); break; } case MapItemType::PICKUP: @@ -434,7 +441,7 @@ void AvatarListBox::mousePressed(MouseEvent &event) } else if (eventButton == MouseButton::MIDDLE) { - if (ava->getType() == AVATAR_PLAYER && chatWindow) + if (type == MapItemType::EMPTY && chatWindow) { const WhisperTab *const tab = chatWindow->addWhisperTab( model->getAvatarAt(selected)->getName(), true); |