diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-04-17 20:24:14 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-04-17 20:24:14 +0300 |
commit | 39ab9ebf7464f77f079a8edecd3f43870245b8ee (patch) | |
tree | 73025204bf897590c802bbfb7f729f7e8595d30b /src | |
parent | e4abfb651d51670fcf85093b55189065c151cc14 (diff) | |
download | manaplus-39ab9ebf7464f77f079a8edecd3f43870245b8ee.tar.gz manaplus-39ab9ebf7464f77f079a8edecd3f43870245b8ee.tar.bz2 manaplus-39ab9ebf7464f77f079a8edecd3f43870245b8ee.tar.xz manaplus-39ab9ebf7464f77f079a8edecd3f43870245b8ee.zip |
Use ActorType for being type.
Diffstat (limited to 'src')
-rw-r--r-- | src/being/being.cpp | 3 | ||||
-rw-r--r-- | src/being/being.h | 2 | ||||
-rw-r--r-- | src/gui/popups/popupmenu.cpp | 24 | ||||
-rw-r--r-- | src/gui/popups/popupmenu.h | 2 | ||||
-rw-r--r-- | src/listeners/playerlistener.cpp | 2 | ||||
-rw-r--r-- | src/listeners/playerlistener.h | 6 |
6 files changed, 21 insertions, 18 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index 523d19331..4109e01a4 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -3084,7 +3084,8 @@ std::string Being::loadComment(const std::string &name, } void Being::saveComment(const std::string &restrict name, - const std::string &restrict comment, const int type) + const std::string &restrict comment, + const ActorType::Type &restrict type) { std::string dir; switch (type) diff --git a/src/being/being.h b/src/being/being.h index 52a2a5fc7..6364f8aed 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -755,7 +755,7 @@ class Being notfinal : public ActorSprite, static void saveComment(const std::string &restrict name, const std::string &restrict comment, - const int type); + const ActorType::Type &restrict type); bool isAdvanced() const A_WARN_UNUSED { return mAdvanced; } diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 9c808b40c..b16dd2ff4 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -112,7 +112,7 @@ PopupMenu::PopupMenu() : mButton(nullptr), mNick(), mTextField(nullptr), - mType(static_cast<int>(ActorType::Unknown)), + mType(ActorType::Unknown), mX(0), mY(0) { @@ -122,7 +122,7 @@ PopupMenu::PopupMenu() : mRenameListener.setDialog(nullptr); mPlayerListener.setNick(""); mPlayerListener.setDialog(nullptr); - mPlayerListener.setType(static_cast<int>(ActorType::Unknown)); + mPlayerListener.setType(ActorType::Unknown); mScrollArea = new ScrollArea(this, mBrowserBox, false); mScrollArea->setVerticalScrollPolicy(ScrollArea::SHOW_AUTO); } @@ -139,7 +139,7 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) mBeingId = being->getId(); mNick = being->getName(); - mType = static_cast<int>(being->getType()); + mType = being->getType(); mBrowserBox->clearRows(); mX = x; mY = y; @@ -451,7 +451,7 @@ void PopupMenu::showPlayerPopup(const std::string &nick) setMousePos(); mNick = nick; mBeingId = 0; - mType = static_cast<int>(ActorType::Player); + mType = ActorType::Player; mBrowserBox->clearRows(); const std::string &name = mNick; @@ -554,7 +554,7 @@ void PopupMenu::showPopup(const int x, const int y, mX = x; mY = y; mFloorItemId = floorItem->getId(); - mType = static_cast<int>(ActorType::FloorItem); + mType = ActorType::FloorItem; mBrowserBox->clearRows(); const std::string name = floorItem->getName(); mNick = name; @@ -794,7 +794,7 @@ void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab) { mBeingId = being->getId(); mNick = being->getName(); - mType = static_cast<int>(being->getType()); + mType = being->getType(); // TRANSLATORS: popup menu item // TRANSLATORS: trade with player @@ -862,7 +862,7 @@ void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab) else { mNick = name; - mType = static_cast<int>(ActorType::Player); + mType = ActorType::Player; addPlayerRelation(name); mBrowserBox->addRow("##3---"); addFollow(); @@ -930,7 +930,7 @@ void PopupMenu::showChangePos(const int x, const int y) mItem = nullptr; mMapItem = nullptr; mNick.clear(); - mType = static_cast<int>(ActorType::Unknown); + mType = ActorType::Unknown; mX = 0; mY = 0; setVisible(false); @@ -1546,7 +1546,7 @@ void PopupMenu::handleLink(const std::string &link, replaceAll(cmd, "'FLOORID'", toString(mFloorItemId)); replaceAll(cmd, "'ITEMID'", toString(mItemId)); replaceAll(cmd, "'ITEMCOLOR'", toString(mItemColor)); - replaceAll(cmd, "'BEINGTYPEID'", toString(mType)); + replaceAll(cmd, "'BEINGTYPEID'", toString(static_cast<int>(mType))); replaceAll(cmd, "'PLAYER'", localPlayer->getName()); if (mItem) replaceAll(cmd, "'INVINDEX'", toString(mItem->getInvIndex())); @@ -1590,7 +1590,7 @@ void PopupMenu::handleLink(const std::string &link, mButton = nullptr; mNick.clear(); mTextField = nullptr; - mType = static_cast<int>(ActorType::Unknown); + mType = ActorType::Unknown; mX = 0; mY = 0; } @@ -1981,7 +1981,7 @@ void PopupMenu::showAttackMonsterPopup(const int x, const int y, return; mNick = name; - mType = static_cast<int>(ActorType::Monster); + mType = ActorType::Monster; mX = x; mY = y; @@ -2059,7 +2059,7 @@ void PopupMenu::showPickupItemPopup(const int x, const int y, return; mNick = name; - mType = static_cast<int>(ActorType::FloorItem); + mType = ActorType::FloorItem; mX = x; mY = y; diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h index c6ca65f61..d523307bf 100644 --- a/src/gui/popups/popupmenu.h +++ b/src/gui/popups/popupmenu.h @@ -211,7 +211,7 @@ class PopupMenu final : public Popup, public LinkHandler Button *mButton; std::string mNick; TextField *mTextField; - int mType; + ActorType::Type mType; int mX; int mY; diff --git a/src/listeners/playerlistener.cpp b/src/listeners/playerlistener.cpp index d07f73515..ae0f3aca7 100644 --- a/src/listeners/playerlistener.cpp +++ b/src/listeners/playerlistener.cpp @@ -32,7 +32,7 @@ PlayerListener::PlayerListener() : ActionListener(), mNick(), mDialog(nullptr), - mType(static_cast<int>(ActorType::Unknown)) + mType(ActorType::Unknown) { } diff --git a/src/listeners/playerlistener.h b/src/listeners/playerlistener.h index 3364f44f5..52527fafc 100644 --- a/src/listeners/playerlistener.h +++ b/src/listeners/playerlistener.h @@ -21,6 +21,8 @@ #ifndef LISTENERS_PLAYERLISTENER_H #define LISTENERS_PLAYERLISTENER_H +#include "enums/being/actortype.h" + #include "listeners/actionlistener.h" #include "localconsts.h" @@ -42,13 +44,13 @@ class PlayerListener final : public ActionListener void setDialog(TextDialog *const dialog) { mDialog = dialog; } - void setType(const int type) + void setType(const ActorType::Type type) { mType = type; } private: std::string mNick; TextDialog *mDialog; - int mType; + ActorType::Type mType; }; #endif // LISTENERS_PLAYERLISTENER_H |