summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-08-03 00:46:38 +0300
committerAndrei Karas <akaras@inbox.ru>2014-08-03 13:17:37 +0300
commit8b2464a723f7039a3efbc0c7d2e883729b3fa7dd (patch)
tree0564c85d8f6301d8a0b916f37612e27788d82853 /src/gui/widgets
parent63054bddcc1a306787250209b03c04086b9b472f (diff)
downloadmanaplus-8b2464a723f7039a3efbc0c7d2e883729b3fa7dd.tar.gz
manaplus-8b2464a723f7039a3efbc0c7d2e883729b3fa7dd.tar.bz2
manaplus-8b2464a723f7039a3efbc0c7d2e883729b3fa7dd.tar.xz
manaplus-8b2464a723f7039a3efbc0c7d2e883729b3fa7dd.zip
Fix some casts.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/avatarlistbox.cpp23
-rw-r--r--src/gui/widgets/dropdown.cpp2
-rw-r--r--src/gui/widgets/dropshortcutcontainer.cpp2
-rw-r--r--src/gui/widgets/itemcontainer.cpp2
-rw-r--r--src/gui/widgets/itemlinkhandler.cpp2
-rw-r--r--src/gui/widgets/scrollarea.cpp2
-rw-r--r--src/gui/widgets/spellshortcutcontainer.cpp4
-rw-r--r--src/gui/widgets/window.cpp2
8 files changed, 23 insertions, 16 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);
diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp
index 6647a768f..7957b0587 100644
--- a/src/gui/widgets/dropdown.cpp
+++ b/src/gui/widgets/dropdown.cpp
@@ -380,7 +380,7 @@ void DropDown::mouseReleased(MouseEvent &event)
if (mIsDragged)
mPushed = false;
- const int button = event.getButton();
+ const MouseButton::Type button = event.getButton();
const int x = event.getX();
const int y = event.getY();
// Released outside of widget. Can happen when we have modal
diff --git a/src/gui/widgets/dropshortcutcontainer.cpp b/src/gui/widgets/dropshortcutcontainer.cpp
index 5ec847922..b57c98273 100644
--- a/src/gui/widgets/dropshortcutcontainer.cpp
+++ b/src/gui/widgets/dropshortcutcontainer.cpp
@@ -189,7 +189,7 @@ void DropShortcutContainer::mousePressed(MouseEvent &event)
event.consume();
- const int eventButton = event.getButton();
+ const MouseButton::Type eventButton = event.getButton();
if (eventButton == MouseButton::LEFT)
{
if (dropShortcut->getItem(index) > 0)
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index ef00913e7..3842daf17 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -403,7 +403,7 @@ void ItemContainer::mousePressed(MouseEvent &event)
if (!mInventory)
return;
- const int button = event.getButton();
+ const MouseButton::Type button = event.getButton();
mClicks = event.getClickCount();
if (button == MouseButton::LEFT || button == MouseButton::RIGHT)
diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp
index e8976da67..2217b051f 100644
--- a/src/gui/widgets/itemlinkhandler.cpp
+++ b/src/gui/widgets/itemlinkhandler.cpp
@@ -68,7 +68,7 @@ void ItemLinkHandler::handleLink(const std::string &link, MouseEvent *event)
std::string url = link;
replaceAll(url, " ", "");
listener.url = url;
- const int button = event->getButton();
+ const MouseButton::Type button = event->getButton();
if (button == MouseButton::LEFT)
{
ConfirmDialog *const confirmDlg = new ConfirmDialog(
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp
index 028c2e7b1..12b9a8e7f 100644
--- a/src/gui/widgets/scrollarea.cpp
+++ b/src/gui/widgets/scrollarea.cpp
@@ -486,7 +486,7 @@ Image *ScrollArea::getImageByState(Rect &dim, const BUTTON_DIR dir)
+ toString(static_cast<unsigned>(dir)));
return nullptr;
}
- return buttons[dir][state];
+ return buttons[static_cast<size_t>(dir)][state];
}
void ScrollArea::drawButton(Graphics *const graphics,
diff --git a/src/gui/widgets/spellshortcutcontainer.cpp b/src/gui/widgets/spellshortcutcontainer.cpp
index 33579b5a9..8960725d5 100644
--- a/src/gui/widgets/spellshortcutcontainer.cpp
+++ b/src/gui/widgets/spellshortcutcontainer.cpp
@@ -164,7 +164,7 @@ void SpellShortcutContainer::mousePressed(MouseEvent &event)
if (index == -1)
return;
- const unsigned int eventButton = event.getButton();
+ const MouseButton::Type eventButton = event.getButton();
if (eventButton == MouseButton::LEFT)
{
const int itemId = getItemByIndex(index);
@@ -200,7 +200,7 @@ void SpellShortcutContainer::mouseReleased(MouseEvent &event)
}
const int itemId = getItemByIndex(index);
- const unsigned int eventButton = event.getButton();
+ const MouseButton::Type eventButton = event.getButton();
if (eventButton == MouseButton::LEFT)
{
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index a4fb2d57f..2078c4cef 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -727,7 +727,7 @@ void Window::mousePressed(MouseEvent &event)
mMoved = event.getY() <= static_cast<int>(mTitleBarHeight);
}
- const unsigned int button = event.getButton();
+ const MouseButton::Type button = event.getButton();
if (button == MouseButton::LEFT)
{
const int x = event.getX();