From 7b6b389fe156b8ff1fc1f35ee776a2e65f160921 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 19 May 2014 18:29:03 +0300 Subject: Move mapitemtype into separate file. --- src/gui/popups/popupmenu.cpp | 11 ++++++----- src/gui/viewport.cpp | 4 +++- src/gui/widgets/avatarlistbox.cpp | 19 ++++++++++--------- src/gui/widgets/tabs/socialtabbase.h | 6 ++++-- 4 files changed, 23 insertions(+), 17 deletions(-) (limited to 'src/gui') diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 7e9925039..00cae3ee3 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -76,6 +76,7 @@ #include "net/tradehandler.h" #include "resources/iteminfo.h" +#include "resources/mapitemtype.h" #include "resources/skillconsts.h" #include "resources/map/map.h" @@ -1356,11 +1357,11 @@ void PopupMenu::handleLink(const std::string &link, if (specialLayer) { const bool isHome = (mMapItem->getType() - == static_cast(MapItem::HOME)); + == static_cast(MapItemType::HOME)); const int x = static_cast(mMapItem->getX()); const int y = static_cast(mMapItem->getY()); specialLayer->setTile(x, y, - static_cast(MapItem::EMPTY)); + static_cast(MapItemType::EMPTY)); if (socialWindow) socialWindow->removePortal(x, y); if (isHome && player_node) @@ -2284,7 +2285,7 @@ void PopupMenu::showAttackMonsterPopup(const int x, const int y, } switch (type) { - case MapItem::ATTACK: + case MapItemType::ATTACK: { const int idx = actorManager->getAttackMobIndex(name); const int size = actorManager->getAttackMobsSize(); @@ -2302,7 +2303,7 @@ void PopupMenu::showAttackMonsterPopup(const int x, const int y, } break; } - case MapItem::PRIORITY: + case MapItemType::PRIORITY: { const int idx = actorManager-> getPriorityAttackMobIndex(name); @@ -2321,7 +2322,7 @@ void PopupMenu::showAttackMonsterPopup(const int x, const int y, } break; } - case MapItem::IGNORE_: + case MapItemType::IGNORE_: break; default: break; diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index b6d805b11..fbe056d2a 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -28,6 +28,8 @@ #include "sdlshared.h" #include "textmanager.h" +#include "resources/mapitemtype.h" + #include "resources/map/map.h" #include "resources/map/mapitem.h" #include "resources/map/maptype.h" @@ -928,7 +930,7 @@ void Viewport::mouseMoved(MouseEvent &event A_UNUSED) / mMap->getTileHeight(); mHoverSign = specialLayer->getTile(mouseTileX, mouseTileY); - if (mHoverSign && mHoverSign->getType() != MapItem::EMPTY) + if (mHoverSign && mHoverSign->getType() != MapItemType::EMPTY) { if (!mHoverSign->getComment().empty()) { diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index 4bbc85a94..41a190daa 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -38,6 +38,7 @@ #include "gui/windows/chatwindow.h" #include "resources/image.h" +#include "resources/mapitemtype.h" #include "resources/map/map.h" #include "resources/map/mapitem.h" @@ -128,7 +129,7 @@ void AvatarListBox::draw(Graphics *graphics) if (!a) continue; - if (a->getType() != MapItem::SEPARATOR) + if (a->getType() != MapItemType::SEPARATOR) { // Draw online status const Image *const icon = a->getOnline() @@ -286,7 +287,7 @@ void AvatarListBox::draw(Graphics *graphics) // Draw Name if (a->getDisplayBold()) { - if (a->getType() == MapItem::SEPARATOR) + if (a->getType() == MapItemType::SEPARATOR) { boldFont->drawString(graphics, text, mImagePadding + mPadding, y + mPadding); @@ -299,7 +300,7 @@ void AvatarListBox::draw(Graphics *graphics) } else { - if (a->getType() == MapItem::SEPARATOR) + if (a->getType() == MapItemType::SEPARATOR) { font->drawString(graphics, text, mImagePadding + mPadding, y + mPadding); @@ -363,7 +364,7 @@ void AvatarListBox::mousePressed(MouseEvent &event) switch (ava->getType()) { // AVATAR_PLAYER - case MapItem::EMPTY: + case MapItemType::EMPTY: { const Avatar *const avatar = model->getAvatarAt(selected); if (avatar) @@ -377,9 +378,9 @@ void AvatarListBox::mousePressed(MouseEvent &event) } break; } - case MapItem::ATTACK: - case MapItem::PRIORITY: - case MapItem::IGNORE_: + case MapItemType::ATTACK: + case MapItemType::PRIORITY: + case MapItemType::IGNORE_: { std::string name; if (model->getAvatarAt(selected)->getLevel() == 0) @@ -391,8 +392,8 @@ void AvatarListBox::mousePressed(MouseEvent &event) model->getAvatarAt(selected)->getType()); break; } - case MapItem::PICKUP: - case MapItem::NOPICKUP: + case MapItemType::PICKUP: + case MapItemType::NOPICKUP: { std::string name; if (model->getAvatarAt(selected)->getLevel() == 0) diff --git a/src/gui/widgets/tabs/socialtabbase.h b/src/gui/widgets/tabs/socialtabbase.h index 6a64ad9f0..d15f39a6c 100644 --- a/src/gui/widgets/tabs/socialtabbase.h +++ b/src/gui/widgets/tabs/socialtabbase.h @@ -23,6 +23,8 @@ #include "actormanager.h" +#include "resources/mapitemtype.h" + #include "resources/map/mapitem.h" #define addAvatars(mob, str, type) \ @@ -30,7 +32,7 @@ ava = new Avatar(str);\ ava->setOnline(false);\ ava->setLevel(-1);\ - ava->setType(MapItem::SEPARATOR);\ + ava->setType(MapItemType::SEPARATOR);\ ava->setX(0);\ ava->setY(0);\ avatars->push_back(ava);\ @@ -53,7 +55,7 @@ ava = new Avatar(name);\ ava->setOnline(true);\ ava->setLevel(level);\ - ava->setType(MapItem::type);\ + ava->setType(MapItemType::type);\ ava->setX(0);\ ava->setY(0);\ avatars->push_back(ava);\ -- cgit v1.2.3-70-g09d2