diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-09-10 23:58:39 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-09-10 23:58:39 +0300 |
commit | 0a39e956218ca15bf78803f89141c7c9dfcec0d9 (patch) | |
tree | adfc0fcd42792ddad6b3cb8843d6fe0c22170580 | |
parent | 69022cd939e572feadaadf1041ae7dadad782ed6 (diff) | |
download | manaverse-0a39e956218ca15bf78803f89141c7c9dfcec0d9.tar.gz manaverse-0a39e956218ca15bf78803f89141c7c9dfcec0d9.tar.bz2 manaverse-0a39e956218ca15bf78803f89141c7c9dfcec0d9.tar.xz manaverse-0a39e956218ca15bf78803f89141c7c9dfcec0d9.zip |
Change format in ActorType enum.
41 files changed, 324 insertions, 324 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index 190258cc2..250e43227 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -313,7 +313,7 @@ impHandler(heal) if (!event.args.empty()) { const Being *const being = actorManager->findBeingByName( - event.args, ActorType::PLAYER); + event.args, ActorType::Player); if (being) actorManager->heal(being); } @@ -322,10 +322,10 @@ impHandler(heal) Being *target = localPlayer->getTarget(); if (inputManager.isActionActive(InputAction::STOP_ATTACK)) { - if (!target || target->getType() != ActorType::PLAYER) + if (!target || target->getType() != ActorType::Player) { target = actorManager->findNearestLivingBeing( - localPlayer, 10, ActorType::PLAYER, true); + localPlayer, 10, ActorType::Player, true); } } else @@ -434,7 +434,7 @@ impHandler0(talk) if (!target && actorManager) { target = actorManager->findNearestLivingBeing( - localPlayer, 1, ActorType::NPC, true); + localPlayer, 1, ActorType::Npc, true); // ignore closest target if distance in each direction more than 1 if (target) { @@ -449,7 +449,7 @@ impHandler0(talk) { if (target->canTalk()) target->talkTo(); - else if (target->getType() == ActorType::PLAYER) + else if (target->getType() == ActorType::Player) new BuySellDialog(target->getName()); } return true; @@ -510,7 +510,7 @@ impHandler0(targetAttack) { // Only auto target Monsters target = actorManager->findNearestLivingBeing( - localPlayer, 90, ActorType::MONSTER, true); + localPlayer, 90, ActorType::Monster, true); } else { @@ -529,7 +529,7 @@ impHandler0(attackHuman) return false; Being *const target = actorManager->findNearestLivingBeing( - localPlayer, 10, ActorType::PLAYER, true); + localPlayer, 10, ActorType::Player, true); if (target) { if (localPlayer->checAttackPermissions(target)) @@ -597,7 +597,7 @@ impHandler0(showWindows) impHandler0(openTrade) { const Being *const being = localPlayer->getTarget(); - if (being && being->getType() == ActorType::PLAYER) + if (being && being->getType() == ActorType::Player) { Net::getTradeHandler()->request(being); tradePartnerName = being->getName(); @@ -683,7 +683,7 @@ impHandler(trade) return false; const Being *being = actorManager->findBeingByName( - event.args, ActorType::PLAYER); + event.args, ActorType::Player); if (!being) being = localPlayer->getTarget(); if (being) diff --git a/src/actions/target.cpp b/src/actions/target.cpp index c5772c1b5..c4c314ddb 100644 --- a/src/actions/target.cpp +++ b/src/actions/target.cpp @@ -48,22 +48,22 @@ static bool setTarget(const ActorType::Type type, const bool allowSort) impHandler0(targetPlayer) { - return setTarget(ActorType::PLAYER, true); + return setTarget(ActorType::Player, true); } impHandler0(targetMonster) { - return setTarget(ActorType::MONSTER, true); + return setTarget(ActorType::Monster, true); } impHandler0(targetClosestMonster) { - return setTarget(ActorType::MONSTER, false); + return setTarget(ActorType::Monster, false); } impHandler0(targetNPC) { - return setTarget(ActorType::NPC, true); + return setTarget(ActorType::Npc, true); } } // namespace Actions diff --git a/src/actormanager.cpp b/src/actormanager.cpp index 56230bdf5..8c83ebce4 100644 --- a/src/actormanager.cpp +++ b/src/actormanager.cpp @@ -74,20 +74,20 @@ class FindBeingFunctor final public: bool operator() (const ActorSprite *const actor) const { - if (!actor || actor->getType() == ActorType::FLOOR_ITEM - || actor->getType() == ActorType::PORTAL) + if (!actor || actor->getType() == ActorType::FloorItem + || actor->getType() == ActorType::Portal) { return false; } const Being *const b = static_cast<const Being* const>(actor); const unsigned other_y = y + ((b->getType() - == ActorType::NPC) ? 1 : 0); + == ActorType::Npc) ? 1 : 0); const Vector &pos = b->getPosition(); return (static_cast<unsigned>(pos.x) / mapTileSize == x && (static_cast<unsigned>(pos.y) / mapTileSize == y || static_cast<unsigned>(pos.y) / mapTileSize == other_y) && - b->isAlive() && (type == ActorType::UNKNOWN + b->isAlive() && (type == ActorType::Unknown || b->getType() == type)); } @@ -244,21 +244,21 @@ Being *ActorManager::createBeing(const int id, Being *const being = new Being(id, type, subtype, mMap); mActors.insert(being); - if (type == ActorType::PLAYER || type == ActorType::NPC) + if (type == ActorType::Player || type == ActorType::Npc) { being->updateFromCache(); Net::getBeingHandler()->requestNameById(id); if (localPlayer) localPlayer->checkNewName(being); } - if (type == ActorType::PLAYER) + if (type == ActorType::Player) { if (botCheckerWindow) botCheckerWindow->updateList(); if (socialWindow) socialWindow->updateActiveList(); } - else if (type == ActorType::NPC) + else if (type == ActorType::Npc) { if (questsWindow) questsWindow->addEffect(being); @@ -319,7 +319,7 @@ Being *ActorManager::findBeing(const int id) const { ActorSprite *const actor = *it; if (actor->getId() == id && - actor->getType() != ActorType::FLOOR_ITEM) + actor->getType() != ActorType::FloorItem) { return static_cast<Being*>(actor); } @@ -361,10 +361,10 @@ Being *ActorManager::findBeingByPixel(const int x, const int y, if (!*it) continue; - if ((*it)->getType() == ActorType::PORTAL) + if ((*it)->getType() == ActorType::Portal) continue; - if ((*it)->getType() == ActorType::FLOOR_ITEM) + if ((*it)->getType() == ActorType::FloorItem) { if (!noBeing) { @@ -390,7 +390,7 @@ Being *ActorManager::findBeingByPixel(const int x, const int y, } if ((being->isAlive() - || (targetDead && being->getType() == ActorType::PLAYER)) + || (targetDead && being->getType() == ActorType::Player)) && (allPlayers || being != localPlayer)) { if ((being->getPixelX() - mapTileSize / 2 <= x) && @@ -424,8 +424,8 @@ Being *ActorManager::findBeingByPixel(const int x, const int y, if (!*it) continue; - if ((*it)->getType() == ActorType::PORTAL || - (*it)->getType() == ActorType::FLOOR_ITEM) + if ((*it)->getType() == ActorType::Portal || + (*it)->getType() == ActorType::FloorItem) { continue; } @@ -467,7 +467,7 @@ void ActorManager::findBeingsByPixel(std::vector<ActorSprite*> &beings, if (!*it) continue; - if ((*it)->getType() == ActorType::PORTAL) + if ((*it)->getType() == ActorType::Portal) continue; const Being *const being = dynamic_cast<const Being*>(*it); @@ -481,9 +481,9 @@ void ActorManager::findBeingsByPixel(std::vector<ActorSprite*> &beings, ActorSprite *const actor = *it; if ((being && (being->isAlive() - || (mTargetDeadPlayers && being->getType() == ActorType::PLAYER)) + || (mTargetDeadPlayers && being->getType() == ActorType::Player)) && (allPlayers || being != localPlayer)) - || actor->getType() == ActorType::FLOOR_ITEM) + || actor->getType() == ActorType::FloorItem) { if ((actor->getPixelX() - xtol <= x) && (actor->getPixelX() + xtol > x) && @@ -506,7 +506,7 @@ Being *ActorManager::findPortalByTile(const int x, const int y) const if (!*it) continue; - if ((*it)->getType() != ActorType::PORTAL) + if ((*it)->getType() != ActorType::Portal) continue; Being *const being = static_cast<Being*>(*it); @@ -526,7 +526,7 @@ FloorItem *ActorManager::findItem(const int id) const continue; if ((*it)->getId() == id && - (*it)->getType() == ActorType::FLOOR_ITEM) + (*it)->getType() == ActorType::FloorItem) { return static_cast<FloorItem*>(*it); } @@ -543,7 +543,7 @@ FloorItem *ActorManager::findItem(const int x, const int y) const continue; if ((*it)->getTileX() == x && (*it)->getTileY() == y && - (*it)->getType() == ActorType::FLOOR_ITEM) + (*it)->getType() == ActorType::FloorItem) { return static_cast<FloorItem*>(*it); } @@ -568,7 +568,7 @@ bool ActorManager::pickUpAll(const int x1, const int y1, if (!*it) continue; - if ((*it)->getType() == ActorType::FLOOR_ITEM + if ((*it)->getType() == ActorType::FloorItem && ((*it)->getTileX() >= x1 && (*it)->getTileX() <= x2) && ((*it)->getTileY() >= y1 && (*it)->getTileY() <= y2)) { @@ -603,7 +603,7 @@ bool ActorManager::pickUpAll(const int x1, const int y1, if (!*it) continue; - if ((*it)->getType() == ActorType::FLOOR_ITEM + if ((*it)->getType() == ActorType::FloorItem && ((*it)->getTileX() >= x1 && (*it)->getTileX() <= x2) && ((*it)->getTileY() >= y1 && (*it)->getTileY() <= y2)) { @@ -665,7 +665,7 @@ bool ActorManager::pickUpNearest(const int x, const int y, if (!*it) continue; - if ((*it)->getType() == ActorType::FLOOR_ITEM) + if ((*it)->getType() == ActorType::FloorItem) { FloorItem *const item = static_cast<FloorItem*>(*it); @@ -711,15 +711,15 @@ Being *ActorManager::findBeingByName(const std::string &name, if (!*it) continue; - if ((*it)->getType() == ActorType::FLOOR_ITEM - || (*it)->getType() == ActorType::PORTAL) + if ((*it)->getType() == ActorType::FloorItem + || (*it)->getType() == ActorType::Portal) { continue; } Being *const being = static_cast<Being*>(*it); if (being->getName() == name && - (type == ActorType::UNKNOWN || type == being->getType())) + (type == ActorType::Unknown || type == being->getType())) { return being; } @@ -745,8 +745,8 @@ Being *ActorManager::findNearestByName(const std::string &name, if (reportTrue(!*it)) continue; - if ((*it)->getType() == ActorType::FLOOR_ITEM - || (*it)->getType() == ActorType::PORTAL) + if ((*it)->getType() == ActorType::FloorItem + || (*it)->getType() == ActorType::Portal) { continue; } @@ -754,9 +754,9 @@ Being *ActorManager::findNearestByName(const std::string &name, Being *const being = static_cast<Being*>(*it); if (being && being->getName() == name && - (type == ActorType::UNKNOWN || type == being->getType())) + (type == ActorType::Unknown || type == being->getType())) { - if (being->getType() == ActorType::PLAYER) + if (being->getType() == ActorType::Player) { return being; } @@ -803,7 +803,7 @@ void ActorManager::logic() if (!*it) continue; - if ((*it) && (*it)->getType() == ActorType::PLAYER) + if ((*it) && (*it)->getType() == ActorType::Player) { const Being *const being = static_cast<const Being*>(*it); being->addToCache(); @@ -914,13 +914,13 @@ Being *ActorManager::findNearestLivingBeing(const Being *const aroundBeing, maxDist = maxDist * maxDist; const bool cycleSelect = allowSort - && ((mCyclePlayers && type == ActorType::PLAYER) - || (mCycleMonsters && type == ActorType::MONSTER) - || (mCycleNPC && type == ActorType::NPC)); + && ((mCyclePlayers && type == ActorType::Player) + || (mCycleMonsters && type == ActorType::Monster) + || (mCycleNPC && type == ActorType::Npc)); const bool filtered = allowSort && config.getBoolValue("enableAttackFilter") - && type == ActorType::MONSTER; + && type == ActorType::Monster; const bool modActive = inputManager.isActionActive( InputAction::STOP_ATTACK); @@ -956,8 +956,8 @@ Being *ActorManager::findNearestLivingBeing(const Being *const aroundBeing, if (!*i) continue; - if ((*i)->getType() == ActorType::FLOOR_ITEM - || (*i)->getType() == ActorType::PORTAL) + if ((*i)->getType() == ActorType::FloorItem + || (*i)->getType() == ActorType::Portal) { continue; } @@ -1021,7 +1021,7 @@ Being *ActorManager::findNearestLivingBeing(const Being *const aroundBeing, { Being *const target = sortedBeings.at(0); - if (specialDistance && target->getType() == ActorType::MONSTER + if (specialDistance && target->getType() == ActorType::Monster && target->getDistance() <= 2) { return nullptr; @@ -1054,8 +1054,8 @@ Being *ActorManager::findNearestLivingBeing(const Being *const aroundBeing, if (!*i) continue; - if ((*i)->getType() == ActorType::FLOOR_ITEM - || (*i)->getType() == ActorType::PORTAL) + if ((*i)->getType() == ActorType::FloorItem + || (*i)->getType() == ActorType::Portal) { continue; } @@ -1085,7 +1085,7 @@ Being *ActorManager::findNearestLivingBeing(const Being *const aroundBeing, const bool valid = validateBeing(aroundBeing, being, type, excluded, 50); int d = being->getDistance(); - if (being->getType() != ActorType::MONSTER + if (being->getType() != ActorType::Monster || !mTargetOnlyReachable) { // if distance not calculated, use old distance d = (being->getTileX() - x) * (being->getTileX() - x) @@ -1162,10 +1162,10 @@ bool ActorManager::validateBeing(const Being *const aroundBeing, if (!localPlayer) return false; return being && ((being->getType() == type - || type == ActorType::UNKNOWN) && (being->isAlive() - || (mTargetDeadPlayers && type == ActorType::PLAYER)) + || type == ActorType::Unknown) && (being->isAlive() + || (mTargetDeadPlayers && type == ActorType::Player)) && being != aroundBeing) && being != excluded - && (type != ActorType::MONSTER || !mTargetOnlyReachable + && (type != ActorType::Monster || !mTargetOnlyReachable || localPlayer->isReachable(being, maxCost)); } @@ -1203,7 +1203,7 @@ void ActorManager::heal(const Being *const target) const { if (PlayerInfo::getAttribute(Attributes::MP) >= 6) { - if (target && target->getType() != ActorType::MONSTER) + if (target && target->getType() != ActorType::Monster) { if (!PacketLimiter::limitPackets(PACKET_CHAT)) return; @@ -1224,7 +1224,7 @@ void ActorManager::heal(const Being *const target) const { // mp > 10 and target not monster if (PlayerInfo::getAttribute(Attributes::MP) >= 10 && target - && target->getType() != ActorType::MONSTER) + && target->getType() != ActorType::Monster) { // target not enemy if (player_relations.getRelation(target->getName()) != @@ -1244,7 +1244,7 @@ void ActorManager::heal(const Being *const target) const } } // heal self if selected monster or selection empty - else if ((!target || target->getType() == ActorType::MONSTER) + else if ((!target || target->getType() == ActorType::Monster) && PlayerInfo::getAttribute(Attributes::MP) >= 6 && PlayerInfo::getAttribute(Attributes::HP) != PlayerInfo::getAttribute(Attributes::MAX_HP)) @@ -1315,7 +1315,7 @@ void ActorManager::printBeingsToChat(const ActorSprites &beings, if (!*it) continue; - if ((*it)->getType() == ActorType::FLOOR_ITEM) + if ((*it)->getType() == ActorType::FloorItem) continue; const Being *const being = static_cast<const Being*>(*it); @@ -1360,15 +1360,15 @@ void ActorManager::getPlayerNames(StringVect &names, if (!*it) continue; - if ((*it)->getType() == ActorType::FLOOR_ITEM - || (*it)->getType() == ActorType::PORTAL) + if ((*it)->getType() == ActorType::FloorItem + || (*it)->getType() == ActorType::Portal) { continue; } const Being *const being = static_cast<const Being*>(*it); - if ((being->getType() == ActorType::PLAYER - || (being->getType() == ActorType::NPC && npcNames)) + if ((being->getType() == ActorType::Player + || (being->getType() == ActorType::Npc && npcNames)) && being->getName() != "") { names.push_back(being->getName()); @@ -1385,14 +1385,14 @@ void ActorManager::getMobNames(StringVect &names) const if (!*it) continue; - if ((*it)->getType() == ActorType::FLOOR_ITEM - || (*it)->getType() == ActorType::PORTAL) + if ((*it)->getType() == ActorType::FloorItem + || (*it)->getType() == ActorType::Portal) { continue; } const Being *const being = static_cast<const Being*>(*it); - if (being->getType() == ActorType::MONSTER && being->getName() != "") + if (being->getType() == ActorType::Monster && being->getName() != "") names.push_back(being->getName()); } } @@ -1404,15 +1404,15 @@ void ActorManager::updatePlayerNames() const if (!*it) continue; - if ((*it)->getType() == ActorType::FLOOR_ITEM - || (*it)->getType() == ActorType::PORTAL) + if ((*it)->getType() == ActorType::FloorItem + || (*it)->getType() == ActorType::Portal) { continue; } Being *const being = static_cast<Being*>(*it); being->setGoodStatus(-1); - if (being->getType() == ActorType::PLAYER && being->getName() != "") + if (being->getType() == ActorType::Player && being->getName() != "") being->updateName(); } } @@ -1424,14 +1424,14 @@ void ActorManager::updatePlayerColors() const if (!*it) continue; - if ((*it)->getType() == ActorType::FLOOR_ITEM - || (*it)->getType() == ActorType::PORTAL) + if ((*it)->getType() == ActorType::FloorItem + || (*it)->getType() == ActorType::Portal) { continue; } Being *const being = static_cast<Being*>(*it); - if (being->getType() == ActorType::PLAYER && being->getName() != "") + if (being->getType() == ActorType::Player && being->getName() != "") being->updateColors(); } } @@ -1443,14 +1443,14 @@ void ActorManager::updatePlayerGuild() const if (!*it) continue; - if ((*it)->getType() == ActorType::FLOOR_ITEM - || (*it)->getType() == ActorType::PORTAL) + if ((*it)->getType() == ActorType::FloorItem + || (*it)->getType() == ActorType::Portal) { continue; } Being *const being = static_cast<Being*>(*it); - if (being->getType() == ActorType::PLAYER && being->getName() != "") + if (being->getType() == ActorType::Player && being->getName() != "") being->updateGuild(); } } @@ -1471,7 +1471,7 @@ void ActorManager::parseLevels(std::string levels) const if (bktPos != std::string::npos) { Being *const being = findBeingByName(part.substr(0, bktPos), - ActorType::PLAYER); + ActorType::Player); if (being) { being->setLevel(atoi(part.substr(bktPos + 1).c_str())); @@ -1710,7 +1710,7 @@ void ActorManager::updateEffects(const std::map<int, int> &addEffects, { for_actorsm { - if (!*it || (*it)->getType() != ActorType::NPC) + if (!*it || (*it)->getType() != ActorType::Npc) continue; Being *const being = static_cast<Being*>(*it); const int type = being->getSubType(); @@ -1727,7 +1727,7 @@ Being *ActorManager::cloneBeing(const Being *const srcBeing, const int id) { Being *const dstBeing = actorManager->createBeing(srcBeing->getId() + id, - ActorType::PLAYER, + ActorType::Player, srcBeing->getSubType()); if (!dstBeing) return nullptr; diff --git a/src/actormanager.h b/src/actormanager.h index 48a80b213..687ca4042 100644 --- a/src/actormanager.h +++ b/src/actormanager.h @@ -96,7 +96,7 @@ class ActorManager final: public ConfigListener * Returns a being at specific coordinates. */ Being *findBeing(const int x, const int y, const ActorType::Type - type = ActorType::UNKNOWN) const A_WARN_UNUSED; + type = ActorType::Unknown) const A_WARN_UNUSED; /** * Returns a being at the specific pixel. @@ -161,7 +161,7 @@ class ActorManager final: public ConfigListener */ Being *findBeingByName(const std::string &name, const ActorType::Type - type = ActorType::UNKNOWN) + type = ActorType::Unknown) const A_WARN_UNUSED; /** @@ -169,7 +169,7 @@ class ActorManager final: public ConfigListener */ Being *findNearestByName(const std::string &name, const ActorType::Type &type - = ActorType::UNKNOWN) const A_WARN_UNUSED; + = ActorType::Unknown) const A_WARN_UNUSED; /** * Heal all players in distance. diff --git a/src/being/actorsprite.cpp b/src/being/actorsprite.cpp index 24c8779c0..bf3709089 100644 --- a/src/being/actorsprite.cpp +++ b/src/being/actorsprite.cpp @@ -217,7 +217,7 @@ void ActorSprite::updateStatusEffect(const int index, const bool newStatus) index, newStatus); if (!effect) return; - if (effect->isPoison() && getType() == ActorType::PLAYER) + if (effect->isPoison() && getType() == ActorType::Player) setPoison(newStatus); handleStatusEffect(effect, index); } diff --git a/src/being/actorsprite.h b/src/being/actorsprite.h index b4b6d8433..79c00060b 100644 --- a/src/being/actorsprite.h +++ b/src/being/actorsprite.h @@ -64,7 +64,7 @@ class ActorSprite notfinal : public CompoundSprite, public Actor * Returns the type of the ActorSprite. */ virtual ActorType::Type getType() const A_WARN_UNUSED - { return ActorType::UNKNOWN; } + { return ActorType::Unknown; } void draw1(Graphics *const graphics, const int offsetX, diff --git a/src/being/actortype.h b/src/being/actortype.h index 7603616ce..b45961c8a 100644 --- a/src/being/actortype.h +++ b/src/being/actortype.h @@ -26,14 +26,14 @@ namespace ActorType { enum Type { - UNKNOWN = 0, - PLAYER, - NPC, - MONSTER, - FLOOR_ITEM, - PORTAL, - LOCAL_PET, - AVATAR + Unknown = 0, + Player, + Npc, + Monster, + FloorItem, + Portal, + LocalPet, + Avatar }; } // namespace ActorType diff --git a/src/being/being.cpp b/src/being/being.cpp index b69ceaa4a..57e212b6a 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -218,16 +218,16 @@ Being::Being(const int id, setMap(map); setSubtype(subtype, 0); - if (mType == ActorType::PLAYER) + if (mType == ActorType::Player) mShowName = config.getBoolValue("visiblenames"); - else if (mType != ActorType::NPC) + else if (mType != ActorType::Npc) mGotComment = true; config.addListener("visiblenames", this); reReadConfig(); - if (mType == ActorType::NPC) + if (mType == ActorType::Npc) setShowName(true); else setShowName(mShowName); @@ -288,7 +288,7 @@ void Being::setSubtype(const uint16_t subtype, const uint8_t look) mSubType = subtype; mLook = look; - if (mType == ActorType::MONSTER) + if (mType == ActorType::Monster) { mInfo = MonsterDB::get(mSubType); if (mInfo) @@ -299,7 +299,7 @@ void Being::setSubtype(const uint16_t subtype, const uint8_t look) mYDiff = mInfo->getSortOffsetY(); } } - else if (mType == ActorType::NPC) + else if (mType == ActorType::Npc) { mInfo = NPCDB::get(mSubType); if (mInfo) @@ -308,13 +308,13 @@ void Being::setSubtype(const uint16_t subtype, const uint8_t look) mYDiff = mInfo->getSortOffsetY(); } } - else if (mType == ActorType::AVATAR) + else if (mType == ActorType::Avatar) { mInfo = AvatarDB::get(mSubType); if (mInfo) setupSpriteDisplay(mInfo->getDisplay(), false); } - else if (mType == ActorType::LOCAL_PET) + else if (mType == ActorType::LocalPet) { mInfo = PETDB::get(mId); if (mInfo) @@ -334,7 +334,7 @@ void Being::setSubtype(const uint16_t subtype, const uint8_t look) } } } - else if (mType == ActorType::PLAYER) + else if (mType == ActorType::Player) { int id = -100 - subtype; @@ -545,7 +545,7 @@ void Being::takeDamage(Being *const attacker, const int amount, color = &userPalette->getColor(UserPalette::MISS); } } - else if (mType == ActorType::MONSTER) + else if (mType == ActorType::Monster) { if (attacker == localPlayer) { @@ -558,7 +558,7 @@ void Being::takeDamage(Being *const attacker, const int amount, UserPalette::HIT_PLAYER_MONSTER); } } - else if (mType == ActorType::PLAYER && attacker != localPlayer + else if (mType == ActorType::Player && attacker != localPlayer && this == localPlayer) { // here player was attacked by other player. mark him as enemy. @@ -575,7 +575,7 @@ void Being::takeDamage(Being *const attacker, const int amount, { if (this == localPlayer) { - if (attacker->mType == ActorType::PLAYER || amount) + if (attacker->mType == ActorType::Player || amount) { chatWindow->battleChatLog(strprintf("%s : Hit you -%d", attacker->getName().c_str(), amount), @@ -626,12 +626,12 @@ void Being::takeDamage(Being *const attacker, const int amount, mHP = 0; } - if (mType == ActorType::MONSTER) + if (mType == ActorType::Monster) { updatePercentHP(); updateName(); } - else if (mType == ActorType::PLAYER && socialWindow && getName() != "") + else if (mType == ActorType::Player && socialWindow && getName() != "") { socialWindow->updateAvatar(getName()); } @@ -670,7 +670,7 @@ int Being::getHitEffect(const Being *const attacker, { const ItemInfo *const attackerWeapon = attacker->getEquippedWeapon(); - if (attackerWeapon && attacker->getType() == ActorType::PLAYER) + if (attackerWeapon && attacker->getType() == ActorType::Player) { if (type == MISS) hitEffectId = attackerWeapon->getMissEffectId(); @@ -679,7 +679,7 @@ int Being::getHitEffect(const Being *const attacker, else hitEffectId = attackerWeapon->getCriticalHitEffectId(); } - else if (attacker->getType() == ActorType::MONSTER) + else if (attacker->getType() == ActorType::Monster) { const BeingInfo *const info = attacker->getInfo(); if (info) @@ -740,7 +740,7 @@ void Being::handleAttack(Being *const victim, const int damage, mLastAttackX = victim->getTileX(); mLastAttackY = victim->getTileY(); - if (mType == ActorType::PLAYER && mEquippedWeapon) + if (mType == ActorType::Player && mEquippedWeapon) fireMissile(victim, mEquippedWeapon->getMissileParticleFile()); else if (mInfo->getAttack(attackId)) fireMissile(victim, mInfo->getAttack(attackId)->mMissileParticle); @@ -755,13 +755,13 @@ void Being::handleAttack(Being *const victim, const int damage, if (dir) setDirection(dir); } - if (damage && victim->mType == ActorType::PLAYER + if (damage && victim->mType == ActorType::Player && victim->mAction == BeingAction::SIT) { victim->setAction(BeingAction::STAND, 0); } - if (mType == ActorType::PLAYER) + if (mType == ActorType::Player) { if (mSpriteIDs.size() >= 10) { @@ -809,7 +809,7 @@ void Being::handleSkill(Being *const victim, const int damage, if (dir) setDirection(dir); } - if (damage && victim->mType == ActorType::PLAYER + if (damage && victim->mType == ActorType::Player && victim->mAction == BeingAction::SIT) { victim->setAction(BeingAction::STAND, 0); @@ -830,7 +830,7 @@ void Being::handleSkill(Being *const victim, const int damage, void Being::setName(const std::string &name) { - if (mType == ActorType::NPC) + if (mType == ActorType::Npc) { mName = name.substr(0, name.find('#', 0)); showName(); @@ -839,7 +839,7 @@ void Being::setName(const std::string &name) { mName = name; - if (mType == ActorType::PLAYER && getShowName()) + if (mType == ActorType::Player && getShowName()) showName(); } } @@ -1202,7 +1202,7 @@ void Being::setAction(const BeingAction::Action &action, const int attackId) this, false, mX, mY); - if (mType == ActorType::MONSTER || mType == ActorType::NPC) + if (mType == ActorType::Monster || mType == ActorType::Npc) mYDiff = mInfo->getDeadSortOffsetY(); } break; @@ -1343,7 +1343,7 @@ void Being::nextTile() } mActionTime += static_cast<int>(mSpeed / 10); - if ((mType != ActorType::PLAYER || mUseDiagonal) + if ((mType != ActorType::Player || mUseDiagonal) && mX != pos.x && mY != pos.y) { mSpeed = static_cast<float>(mWalkSpeed.x * 1.4F); @@ -1472,7 +1472,7 @@ void Being::logic() && static_cast<int> ((static_cast<float>(get_elapsed_time(mActionTime)) / mSpeed)) >= frameCount) { - if (mType != ActorType::PLAYER && actorManager) + if (mType != ActorType::Player && actorManager) actorManager->destroy(this); } @@ -1779,7 +1779,7 @@ void Being::updateCoords() offsetY += mInfo->getNameOffsetY(); } // Monster names show above the sprite instead of below it - if (mType == ActorType::MONSTER) + if (mType == ActorType::Monster) offsetY += - getHeight() - mDispName->getHeight(); mDispName->adviseXY(offsetX, offsetY, mMoveNames); @@ -1787,7 +1787,7 @@ void Being::updateCoords() void Being::optionChanged(const std::string &value) { - if (mType == ActorType::PLAYER && value == "visiblenames") + if (mType == ActorType::Player && value == "visiblenames") setShowName(config.getBoolValue("visiblenames")); } @@ -1849,7 +1849,7 @@ void Being::showName() std::string displayName(mName); - if (mType != ActorType::MONSTER && (mShowGender || mShowLevel)) + if (mType != ActorType::Monster && (mShowGender || mShowLevel)) { displayName.append(" "); if (mShowLevel && getLevel() != 0) @@ -1858,7 +1858,7 @@ void Being::showName() displayName.append(getGenderSign()); } - if (mType == ActorType::MONSTER) + if (mType == ActorType::Monster) { if (config.getBoolValue("showMonstersTakedDamage")) displayName.append(", ").append(toString(getDamageTaken())); @@ -1866,11 +1866,11 @@ void Being::showName() Font *font = nullptr; if (localPlayer && localPlayer->getTarget() == this - && mType != ActorType::MONSTER) + && mType != ActorType::Monster) { font = boldFont; } - else if (mType == ActorType::PLAYER + else if (mType == ActorType::Player && !player_relations.isGoodName(this) && gui) { font = gui->getSecureFont(); @@ -1896,12 +1896,12 @@ void Being::updateColors() { if (userPalette) { - if (mType == ActorType::MONSTER) + if (mType == ActorType::Monster) { mNameColor = &userPalette->getColor(UserPalette::MONSTER); mTextColor = &userPalette->getColor(UserPalette::MONSTER); } - else if (mType == ActorType::NPC) + else if (mType == ActorType::Npc) { mNameColor = &userPalette->getColor(UserPalette::NPC); mTextColor = &userPalette->getColor(UserPalette::NPC); @@ -2024,7 +2024,7 @@ void Being::setSprite(const unsigned int slot, const int id, if (id1) { const ItemInfo &info = ItemDB::get(id1); - if (!isTempSprite && mMap && mType == ActorType::PLAYER) + if (!isTempSprite && mMap && mType == ActorType::Player) { const int pet = info.getPet(); if (pet) @@ -2039,7 +2039,7 @@ void Being::setSprite(const unsigned int slot, const int id, const std::string &filename = info.getSprite(mGender, mSubType); AnimatedSprite *equipmentSprite = nullptr; - if (!isTempSprite && mType == ActorType::PLAYER) + if (!isTempSprite && mType == ActorType::Player) { const int pet = info.getPet(); if (pet) @@ -2211,7 +2211,7 @@ bool Being::updateFromCache() } updateAwayEffect(); - if (mType == ActorType::PLAYER) + if (mType == ActorType::Player) updateColors(); return true; } @@ -2393,7 +2393,7 @@ void Being::drawSpriteAt(Graphics *const graphics, } } - if (mHighlightMonsterAttackRange && mType == ActorType::MONSTER + if (mHighlightMonsterAttackRange && mType == ActorType::Monster && isAlive()) { int attackRange; @@ -2411,7 +2411,7 @@ void Being::drawSpriteAt(Graphics *const graphics, } if (mShowMobHP && mInfo && localPlayer && localPlayer->getTarget() == this - && mType == ActorType::MONSTER) + && mType == ActorType::Monster) { // show hp bar here int maxHP = mMaxHP; @@ -2516,7 +2516,7 @@ void Being::setHP(const int hp) mHP = hp; if (mMaxHP < mHP) mMaxHP = mHP; - if (mType == ActorType::MONSTER) + if (mType == ActorType::Monster) updatePercentHP(); } @@ -2905,18 +2905,18 @@ std::string Being::loadComment(const std::string &name, std::string str; switch (type) { - case ActorType::PLAYER: + case ActorType::Player: str = settings.usersDir; break; - case ActorType::NPC: + case ActorType::Npc: str = settings.npcsDir; break; - case ActorType::UNKNOWN: - case ActorType::MONSTER: - case ActorType::FLOOR_ITEM: - case ActorType::PORTAL: - case ActorType::LOCAL_PET: - case ActorType::AVATAR: + case ActorType::Unknown: + case ActorType::Monster: + case ActorType::FloorItem: + case ActorType::Portal: + case ActorType::LocalPet: + case ActorType::Avatar: default: return ""; } @@ -2938,10 +2938,10 @@ void Being::saveComment(const std::string &restrict name, std::string dir; switch (type) { - case ActorType::PLAYER: + case ActorType::Player: dir = settings.usersDir; break; - case ActorType::NPC: + case ActorType::Npc: dir = settings.npcsDir; break; default: @@ -3134,7 +3134,7 @@ void Being::addPet(const int id) } Being *const being = actorManager->createBeing( - id, ActorType::LOCAL_PET, 0); + id, ActorType::LocalPet, 0); if (being) { being->setOwner(this); @@ -3326,7 +3326,7 @@ void Being::playSfx(const SoundInfo &sound, Being *const being, void Being::setLook(const uint8_t look) { - if (mType == ActorType::PLAYER) + if (mType == ActorType::Player) setSubtype(mSubType, look); } diff --git a/src/being/being.h b/src/being/being.h index c50cdf871..ed1127844 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -634,7 +634,7 @@ class Being notfinal : public ActorSprite, void setGM(const bool gm); bool canTalk() const A_WARN_UNUSED - { return mType == ActorType::NPC; } + { return mType == ActorType::Npc; } void talkTo() const; diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 70600ff2c..237f21dc2 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -110,7 +110,7 @@ extern MiniStatusWindow *miniStatusWindow; extern SkillDialog *skillDialog; LocalPlayer::LocalPlayer(const int id, const uint16_t subtype) : - Being(id, ActorType::PLAYER, subtype, nullptr), + Being(id, ActorType::Player, subtype, nullptr), AttributeListener(), StatListener(), mGMLevel(0), @@ -289,7 +289,7 @@ void LocalPlayer::logic() if (mTarget) { - if (mTarget->getType() == ActorType::NPC) + if (mTarget->getType() == ActorType::Npc) { // NPCs are always in range mTarget->setTargetType(TargetCursorType::IN_RANGE); @@ -308,7 +308,7 @@ void LocalPlayer::logic() mTarget->setTargetType(targetType); if (!mTarget->isAlive() && (!mTargetDeadPlayers - || mTarget->getType() != ActorType::PLAYER)) + || mTarget->getType() != ActorType::Player)) { stopAttack(true); } @@ -527,7 +527,7 @@ void LocalPlayer::setTarget(Being *const target) oldTarget = mTarget; } - if (mTarget && mTarget->getType() == ActorType::MONSTER) + if (mTarget && mTarget->getType() == ActorType::Monster) mTarget->setShowName(false); mTarget = target; @@ -542,7 +542,7 @@ void LocalPlayer::setTarget(Being *const target) mTarget->updateName(); } - if (target && target->getType() == ActorType::MONSTER) + if (target && target->getType() == ActorType::Monster) target->setShowName(true); } @@ -725,7 +725,7 @@ void LocalPlayer::attack(Being *const target, const bool keep, { mKeepAttacking = keep; - if (!target || target->getType() == ActorType::NPC) + if (!target || target->getType() == ActorType::Npc) return; if (mTarget != target) @@ -755,7 +755,7 @@ void LocalPlayer::attack(Being *const target, const bool keep, mActionTime = tick_time; - if (target->getType() != ActorType::PLAYER + if (target->getType() != ActorType::Player || checAttackPermissions(target)) { setAction(BeingAction::ATTACK); @@ -2771,7 +2771,7 @@ void LocalPlayer::attack2(Being *const target, const bool keep, return; } setTarget(target); - if (target->getType() != ActorType::NPC) + if (target->getType() != ActorType::Npc) { mKeepAttacking = true; moveToTarget(); @@ -2984,7 +2984,7 @@ void LocalPlayer::followMoveTo(const Being *const being, if (actorManager) { Being *const b = actorManager->findBeingByName( - mPlayerFollowed, ActorType::PLAYER); + mPlayerFollowed, ActorType::Player); setTarget(b); } } @@ -3144,7 +3144,7 @@ void LocalPlayer::checkNewName(Being *const being) return; const std::string &nick = being->getName(); - if (being->getType() == ActorType::PLAYER) + if (being->getType() == ActorType::Player) { const Guild *const guild = getGuild(); if (guild) diff --git a/src/being/playerrelations.cpp b/src/being/playerrelations.cpp index 656e59088..e592b9e8e 100644 --- a/src/being/playerrelations.cpp +++ b/src/being/playerrelations.cpp @@ -249,9 +249,9 @@ void PlayerRelationsManager::signalUpdate(const std::string &name) if (actorManager) { Being *const being = actorManager->findBeingByName( - name, ActorType::PLAYER); + name, ActorType::Player); - if (being && being->getType() == ActorType::PLAYER) + if (being && being->getType() == ActorType::Player) being->updateColors(); } } @@ -300,7 +300,7 @@ bool PlayerRelationsManager::hasPermission(const Being *const being, if (!being) return false; - if (being->getType() == ActorType::PLAYER) + if (being->getType() == ActorType::Player) return hasPermission(being->getName(), flags) == flags; return true; } @@ -321,9 +321,9 @@ bool PlayerRelationsManager::hasPermission(const std::string &name, if (mIgnoreStrategy) { Being *const b = actorManager->findBeingByName( - name, ActorType::PLAYER); + name, ActorType::Player); - if (b && b->getType() == ActorType::PLAYER) + if (b && b->getType() == ActorType::Player) mIgnoreStrategy->ignore(b, rejections); } } diff --git a/src/flooritem.h b/src/flooritem.h index 846a27802..fa02a7e32 100644 --- a/src/flooritem.h +++ b/src/flooritem.h @@ -53,7 +53,7 @@ class FloorItem final : public ActorSprite void postInit(Map *const map, int subX, int subY); ActorType::Type getType() const override final A_WARN_UNUSED - { return ActorType::FLOOR_ITEM; } + { return ActorType::FloorItem; } void draw(Graphics *const graphics, const int offsetX, const int offsetY) const override final; diff --git a/src/gui/models/userstablemodel.h b/src/gui/models/userstablemodel.h index e84333087..45fb8b0bd 100644 --- a/src/gui/models/userstablemodel.h +++ b/src/gui/models/userstablemodel.h @@ -107,7 +107,7 @@ class UsersTableModel final : public TableModel, { Being *const being = dynamic_cast<Being*>(*i); - if (being && being->getType() == ActorType::PLAYER + if (being && being->getType() == ActorType::Player && being != localPlayer && !being->getName().empty()) { mPlayers.push_back(being); diff --git a/src/gui/popups/beingpopup.cpp b/src/gui/popups/beingpopup.cpp index 089e51ea0..01051a9e8 100644 --- a/src/gui/popups/beingpopup.cpp +++ b/src/gui/popups/beingpopup.cpp @@ -97,7 +97,7 @@ void BeingPopup::show(const int x, const int y, Being *const b) b->updateComment(); - if (b->getType() == ActorType::NPC && b->getComment().empty()) + if (b->getType() == ActorType::Npc && b->getComment().empty()) { setVisible(false); return; diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index d478719b2..bcc0b92ef 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -118,7 +118,7 @@ PopupMenu::PopupMenu() : mButton(nullptr), mNick(), mTextField(nullptr), - mType(static_cast<int>(ActorType::UNKNOWN)), + mType(static_cast<int>(ActorType::Unknown)), mX(0), mY(0) { @@ -128,7 +128,7 @@ PopupMenu::PopupMenu() : mRenameListener.setDialog(nullptr); mPlayerListener.setNick(""); mPlayerListener.setDialog(nullptr); - mPlayerListener.setType(static_cast<int>(ActorType::UNKNOWN)); + mPlayerListener.setType(static_cast<int>(ActorType::Unknown)); mScrollArea = new ScrollArea(this, mBrowserBox, false); mScrollArea->setVerticalScrollPolicy(ScrollArea::SHOW_AUTO); } @@ -155,7 +155,7 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) switch (being->getType()) { - case ActorType::PLAYER: + case ActorType::Player: { // TRANSLATORS: popup menu item // TRANSLATORS: trade with player @@ -240,7 +240,7 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) break; } - case ActorType::NPC: + case ActorType::Npc: // NPCs can be talked to (single option, candidate for removal // unless more options would be added) // TRANSLATORS: popup menu item @@ -261,7 +261,7 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) mBrowserBox->addRow("addcomment", _("Add comment")); break; - case ActorType::MONSTER: + case ActorType::Monster: { // Monsters can be attacked // TRANSLATORS: popup menu item @@ -299,11 +299,11 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) break; } - case ActorType::AVATAR: - case ActorType::UNKNOWN: - case ActorType::FLOOR_ITEM: - case ActorType::PORTAL: - case ActorType::LOCAL_PET: + case ActorType::Avatar: + case ActorType::Unknown: + case ActorType::FloorItem: + case ActorType::Portal: + case ActorType::LocalPet: default: break; } @@ -350,7 +350,7 @@ void PopupMenu::showPopup(const int x, const int y, static_cast<unsigned>(being->getId()), (being->getName() + being->getGenderSignWithSpace()).c_str())); } - else if (actor->getType() == ActorType::FLOOR_ITEM) + else if (actor->getType() == ActorType::FloorItem) { const FloorItem *const floorItem = static_cast<const FloorItem*>(actor); @@ -374,7 +374,7 @@ void PopupMenu::showPlayerPopup(const std::string &nick) setMousePos(); mNick = nick; mBeingId = 0; - mType = static_cast<int>(ActorType::PLAYER); + mType = static_cast<int>(ActorType::Player); mBrowserBox->clearRows(); const std::string &name = mNick; @@ -472,7 +472,7 @@ void PopupMenu::showPopup(const int x, const int y, mX = x; mY = y; mFloorItemId = floorItem->getId(); - mType = static_cast<int>(ActorType::FLOOR_ITEM); + mType = static_cast<int>(ActorType::FloorItem); mBrowserBox->clearRows(); const std::string name = floorItem->getName(); mNick = name; @@ -705,7 +705,7 @@ void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab) std::string name = wTab->getNick(); const Being* const being = actorManager->findBeingByName( - name, ActorType::PLAYER); + name, ActorType::Player); if (being) { @@ -774,7 +774,7 @@ void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab) else { mNick = name; - mType = static_cast<int>(ActorType::PLAYER); + mType = static_cast<int>(ActorType::Player); addPlayerRelation(name); mBrowserBox->addRow("##3---"); addFollow(); @@ -841,7 +841,7 @@ void PopupMenu::showChangePos(const int x, const int y) mItem = nullptr; mMapItem = nullptr; mNick.clear(); - mType = static_cast<int>(ActorType::UNKNOWN); + mType = static_cast<int>(ActorType::Unknown); mX = 0; mY = 0; setVisible(false); @@ -908,7 +908,7 @@ void PopupMenu::handleLink(const std::string &link, } // Trade action else if (link == "trade" && being && - being->getType() == ActorType::PLAYER) + being->getType() == ActorType::Player) { Net::getTradeHandler()->request(being); tradePartnerName = being->getName(); @@ -917,9 +917,9 @@ void PopupMenu::handleLink(const std::string &link, } else if (link == "buy" && being && mBeingId != 0) { - if (being->getType() == ActorType::NPC) + if (being->getType() == ActorType::Npc) Net::getNpcHandler()->buy(mBeingId); - else if (being->getType() == ActorType::PLAYER) + else if (being->getType() == ActorType::Player) Net::getBuySellHandler()->requestSellList(being->getName()); } else if (link == "buy" && !mNick.empty()) @@ -928,9 +928,9 @@ void PopupMenu::handleLink(const std::string &link, } else if (link == "sell" && being && mBeingId != 0) { - if (being->getType() == ActorType::NPC) + if (being->getType() == ActorType::Npc) Net::getNpcHandler()->sell(mBeingId); - else if (being->getType() == ActorType::PLAYER) + else if (being->getType() == ActorType::Player) Net::getBuySellHandler()->requestBuyList(being->getName()); } else if (link == "sell" && !mNick.empty()) @@ -942,13 +942,13 @@ void PopupMenu::handleLink(const std::string &link, if (localPlayer) localPlayer->attack(being, true); } - else if (link == "heal" && being && being->getType() != ActorType::MONSTER) + else if (link == "heal" && being && being->getType() != ActorType::Monster) { if (actorManager) actorManager->heal(being); } else if (link == "unignore" && being && - being->getType() == ActorType::PLAYER) + being->getType() == ActorType::Player) { player_relations.setRelation(being->getName(), PlayerRelation::NEUTRAL); @@ -958,7 +958,7 @@ void PopupMenu::handleLink(const std::string &link, player_relations.setRelation(mNick, PlayerRelation::NEUTRAL); } else if (link == "ignore" && being && - being->getType() == ActorType::PLAYER) + being->getType() == ActorType::Player) { player_relations.setRelation(being->getName(), PlayerRelation::IGNORED); @@ -969,7 +969,7 @@ void PopupMenu::handleLink(const std::string &link, } else if (link == "blacklist" && being && - being->getType() == ActorType::PLAYER) + being->getType() == ActorType::Player) { player_relations.setRelation(being->getName(), PlayerRelation::BLACKLISTED); @@ -979,7 +979,7 @@ void PopupMenu::handleLink(const std::string &link, player_relations.setRelation(mNick, PlayerRelation::BLACKLISTED); } else if (link == "enemy" && being && - being->getType() == ActorType::PLAYER) + being->getType() == ActorType::Player) { player_relations.setRelation(being->getName(), PlayerRelation::ENEMY2); @@ -989,7 +989,7 @@ void PopupMenu::handleLink(const std::string &link, player_relations.setRelation(mNick, PlayerRelation::ENEMY2); } else if (link == "erase" && being && - being->getType() == ActorType::PLAYER) + being->getType() == ActorType::Player) { player_relations.setRelation(being->getName(), PlayerRelation::ERASED); being->updateName(); @@ -999,7 +999,7 @@ void PopupMenu::handleLink(const std::string &link, player_relations.setRelation(mNick, PlayerRelation::ERASED); } else if (link == "disregard" && being && - being->getType() == ActorType::PLAYER) + being->getType() == ActorType::Player) { player_relations.setRelation(being->getName(), PlayerRelation::DISREGARDED); @@ -1009,7 +1009,7 @@ void PopupMenu::handleLink(const std::string &link, player_relations.setRelation(mNick, PlayerRelation::DISREGARDED); } else if (link == "friend" && being && - being->getType() == ActorType::PLAYER) + being->getType() == ActorType::Player) { player_relations.setRelation(being->getName(), PlayerRelation::FRIEND); } @@ -1292,12 +1292,12 @@ void PopupMenu::handleLink(const std::string &link, PlayerInfo::unprotectItem(mItemId); } else if (link == "party" && being && - being->getType() == ActorType::PLAYER) + being->getType() == ActorType::Player) { Net::getPartyHandler()->invite(being->getName()); } else if (link == "kick party" && being - && being->getType() == ActorType::PLAYER) + && being->getType() == ActorType::Player) { Net::getPartyHandler()->kick(being); } @@ -1318,8 +1318,8 @@ void PopupMenu::handleLink(const std::string &link, chatWindow->addInputText(name); } else if (link == "admin-kick" && being && - (being->getType() == ActorType::PLAYER || - being->getType() == ActorType::MONSTER)) + (being->getType() == ActorType::Player || + being->getType() == ActorType::Monster)) { Net::getAdminHandler()->kick(being->getId()); } @@ -1486,7 +1486,7 @@ void PopupMenu::handleLink(const std::string &link, } else if (link == "remove attack" && being) { - if (actorManager && being->getType() == ActorType::MONSTER) + if (actorManager && being->getType() == ActorType::Monster) { actorManager->removeAttackMob(being->getName()); if (socialWindow) @@ -1495,7 +1495,7 @@ void PopupMenu::handleLink(const std::string &link, } else if (link == "add attack" && being) { - if (actorManager && being->getType() == ActorType::MONSTER) + if (actorManager && being->getType() == ActorType::Monster) { actorManager->addAttackMob(being->getName()); if (socialWindow) @@ -1504,7 +1504,7 @@ void PopupMenu::handleLink(const std::string &link, } else if (link == "add attack priority" && being) { - if (actorManager && being->getType() == ActorType::MONSTER) + if (actorManager && being->getType() == ActorType::Monster) { actorManager->addPriorityAttackMob(being->getName()); if (socialWindow) @@ -1513,7 +1513,7 @@ void PopupMenu::handleLink(const std::string &link, } else if (link == "add attack ignore" && being) { - if (actorManager && being->getType() == ActorType::MONSTER) + if (actorManager && being->getType() == ActorType::Monster) { actorManager->addIgnoreAttackMob(being->getName()); if (socialWindow) @@ -1910,7 +1910,7 @@ void PopupMenu::handleLink(const std::string &link, mButton = nullptr; mNick.clear(); mTextField = nullptr; - mType = static_cast<int>(ActorType::UNKNOWN); + mType = static_cast<int>(ActorType::Unknown); mX = 0; mY = 0; } @@ -2275,7 +2275,7 @@ void PopupMenu::showAttackMonsterPopup(const int x, const int y, return; mNick = name; - mType = static_cast<int>(ActorType::MONSTER); + mType = static_cast<int>(ActorType::Monster); mX = x; mY = y; @@ -2353,7 +2353,7 @@ void PopupMenu::showPickupItemPopup(const int x, const int y, return; mNick = name; - mType = static_cast<int>(ActorType::FLOOR_ITEM); + mType = static_cast<int>(ActorType::FloorItem); mX = x; mY = y; diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 8d9fcd958..73cb5b884 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -254,7 +254,7 @@ void Viewport::draw(Graphics *graphics) const ActorSprites &actors = actorManager->getAll(); FOR_EACH (ActorSpritesIterator, it, actors) { - if ((*it)->getType() == ActorType::FLOOR_ITEM) + if ((*it)->getType() == ActorType::FloorItem) continue; Being *const b = static_cast<Being*>(*it); b->drawSpeech(mPixelViewX, mPixelViewY); @@ -428,7 +428,7 @@ bool Viewport::leftMouseAction() else { const ActorType::Type type = mHoverBeing->getType(); - if (type == ActorType::PLAYER) + if (type == ActorType::Player) { validateSpeed(); if (actorManager) @@ -440,7 +440,7 @@ bool Viewport::leftMouseAction() return true; } } - else if (type == ActorType::MONSTER || type == ActorType::NPC) + else if (type == ActorType::Monster || type == ActorType::Npc) { if (localPlayer->withinAttackRange(mHoverBeing) || inputManager.isActionActive(static_cast<int>( @@ -542,7 +542,7 @@ void Viewport::mousePressed(MouseEvent &event) if (actorManager) { Being *const target = actorManager->findNearestLivingBeing( - pixelX, pixelY, 20, ActorType::MONSTER, nullptr); + pixelX, pixelY, 20, ActorType::Monster, nullptr); if (target) localPlayer->setTarget(target); @@ -755,14 +755,14 @@ void Viewport::mouseMoved(MouseEvent &event A_UNUSED) const int x = mMouseX + mPixelViewX; const int y = mMouseY + mPixelViewY; - ActorType::Type type = ActorType::UNKNOWN; + ActorType::Type type = ActorType::Unknown; mHoverBeing = actorManager->findBeingByPixel(x, y, true); if (mHoverBeing) type = mHoverBeing->getType(); if (mHoverBeing - && (type == ActorType::PLAYER - || type == ActorType::NPC - || type == ActorType::LOCAL_PET)) + && (type == ActorType::Player + || type == ActorType::Npc + || type == ActorType::LocalPet)) { popupManager->hideTextPopup(); if (mShowBeingPopup && beingPopup) @@ -815,23 +815,23 @@ void Viewport::mouseMoved(MouseEvent &event A_UNUSED) { switch (type) { - case ActorType::NPC: + case ActorType::Npc: gui->setCursorType(mHoverBeing->getHoverCursor()); break; - case ActorType::MONSTER: + case ActorType::Monster: gui->setCursorType(mHoverBeing->getHoverCursor()); break; - case ActorType::PORTAL: + case ActorType::Portal: gui->setCursorType(mHoverBeing->getHoverCursor()); break; - case ActorType::AVATAR: - case ActorType::FLOOR_ITEM: - case ActorType::UNKNOWN: - case ActorType::PLAYER: - case ActorType::LOCAL_PET: + case ActorType::Avatar: + case ActorType::FloorItem: + case ActorType::Unknown: + case ActorType::Player: + case ActorType::LocalPet: default: gui->setCursorType(Cursor::CURSOR_POINTER); break; diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp index e0fbc4d4b..a351c7199 100644 --- a/src/gui/widgets/avatarlistbox.cpp +++ b/src/gui/widgets/avatarlistbox.cpp @@ -373,7 +373,7 @@ void AvatarListBox::mousePressed(MouseEvent &event) if (type == MapItemType::EMPTY) { const Being *const being = actorManager->findBeingByName( - ava->getName(), ActorType::PLAYER); + ava->getName(), ActorType::Player); if (being) actorManager->heal(being); } @@ -392,7 +392,7 @@ void AvatarListBox::mousePressed(MouseEvent &event) if (avatar) { const Being *const being = actorManager->findBeingByName( - avatar->getName(), ActorType::PLAYER); + avatar->getName(), ActorType::Player); if (being) { popupMenu->showPopup(viewport->mMouseX, diff --git a/src/gui/widgets/tabs/socialfriendstab.h b/src/gui/widgets/tabs/socialfriendstab.h index f483a73ca..baaa57595 100644 --- a/src/gui/widgets/tabs/socialfriendstab.h +++ b/src/gui/widgets/tabs/socialfriendstab.h @@ -103,7 +103,7 @@ class SocialFriendsTab final : public SocialTab FOR_EACHP (StringVectCIter, it, players) { Avatar *const ava = new Avatar(*it); - if (actorManager->findBeingByName(*it, ActorType::PLAYER) + if (actorManager->findBeingByName(*it, ActorType::Player) || players2.find(*it) != players2.end()) { ava->setOnline(true); diff --git a/src/gui/widgets/tabs/socialplayerstab.h b/src/gui/widgets/tabs/socialplayerstab.h index 78c03feb4..56580300b 100644 --- a/src/gui/widgets/tabs/socialplayerstab.h +++ b/src/gui/widgets/tabs/socialplayerstab.h @@ -87,7 +87,7 @@ class SocialPlayersTab final : public SocialTab } } const Being *const being = actorManager->findBeingByName( - name, ActorType::PLAYER); + name, ActorType::Player); if (being) { avatar->setDamageHp(being->getDamageTaken()); @@ -108,7 +108,7 @@ class SocialPlayersTab final : public SocialTab return; avatar->setDamageHp(0); Being *const being = actorManager->findBeingByName( - name, ActorType::PLAYER); + name, ActorType::Player); if (being) being->setDamageTaken(0); diff --git a/src/gui/windows/botcheckerwindow.cpp b/src/gui/windows/botcheckerwindow.cpp index d0130ed7a..25df25a69 100644 --- a/src/gui/windows/botcheckerwindow.cpp +++ b/src/gui/windows/botcheckerwindow.cpp @@ -193,7 +193,7 @@ void BotCheckerWindow::reset() { Being *const being = dynamic_cast<Being*>(*i); - if (being && being->getType() == ActorType::PLAYER + if (being && being->getType() == ActorType::Player && being != localPlayer && being->getName() != "") { being->resetCounters(); diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp index e1c1cd7ed..890abfe22 100644 --- a/src/gui/windows/charcreatedialog.cpp +++ b/src/gui/windows/charcreatedialog.cpp @@ -128,7 +128,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *const parent, mCreateButton(new Button(this, _("Create"), "create", this)), // TRANSLATORS: char create dialog button mCancelButton(new Button(this, _("Cancel"), "cancel", this)), - mPlayer(new Being(0, ActorType::PLAYER, static_cast<uint16_t>(0U), + mPlayer(new Being(0, ActorType::Player, static_cast<uint16_t>(0U), nullptr)), mPlayerBox(new PlayerBox(this, mPlayer, "charcreate_playerbox.xml", "charcreate_selectedplayerbox.xml")), diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 0efa9c08d..9644b5a7c 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -623,7 +623,7 @@ void ChatWindow::doPresent() const FOR_EACH (ActorSpritesIterator, it, actors) { - if ((*it)->getType() == ActorType::PLAYER) + if ((*it)->getType() == ActorType::Player) { if (!response.empty()) response.append(", "); @@ -1508,7 +1508,7 @@ void ChatWindow::battleChatLog(const std::string &line, ChatMsgType::Type own, void ChatWindow::localPetSay(const std::string &nick, const std::string &text) { Being *const being = actorManager->findBeingByName( - nick, ActorType::PLAYER); + nick, ActorType::Player); Being *pet = nullptr; if (being) { @@ -1533,7 +1533,7 @@ void ChatWindow::localPetSay(const std::string &nick, const std::string &text) void ChatWindow::localPetEmote(const std::string &nick, const uint8_t emoteId) { Being *const being = actorManager->findBeingByName( - nick, ActorType::PLAYER); + nick, ActorType::Player); if (being) { Being *const pet = being->getFirstPet(); @@ -1595,7 +1595,7 @@ void ChatWindow::updateOnline(const std::set<std::string> &onlinePlayers) const if (actorManager) { const Being *const being = actorManager->findBeingByName( - nick, ActorType::PLAYER); + nick, ActorType::Player); if (being) { tab->setWhisperTabColors(); diff --git a/src/gui/windows/killstats.cpp b/src/gui/windows/killstats.cpp index 6ec3df5a0..677023c8b 100644 --- a/src/gui/windows/killstats.cpp +++ b/src/gui/windows/killstats.cpp @@ -484,7 +484,7 @@ void KillStats::validateJacko() { const Being *const dstBeing = actorManager->findBeingByName( - "Jack O", ActorType::MONSTER); + "Jack O", ActorType::Monster); if (mIsJackoAlive && !dstBeing) { mIsJackoAlive = false; diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp index 048b4350e..e242b7401 100644 --- a/src/gui/windows/minimap.cpp +++ b/src/gui/windows/minimap.cpp @@ -291,7 +291,7 @@ void Minimap::draw(Graphics *graphics) const ActorSprites &actors = actorManager->getAll(); FOR_EACH (ActorSpritesConstIterator, it, actors) { - if (!(*it) || (*it)->getType() == ActorType::FLOOR_ITEM) + if (!(*it) || (*it)->getType() == ActorType::FloorItem) continue; const Being *const being = static_cast<const Being *const>(*it); @@ -319,20 +319,20 @@ void Minimap::draw(Graphics *graphics) { switch (being->getType()) { - case ActorType::MONSTER: + case ActorType::Monster: type = UserPalette::MONSTER; break; - case ActorType::NPC: + case ActorType::Npc: type = UserPalette::NPC; break; - case ActorType::AVATAR: - case ActorType::UNKNOWN: - case ActorType::PLAYER: - case ActorType::FLOOR_ITEM: - case ActorType::PORTAL: - case ActorType::LOCAL_PET: + case ActorType::Avatar: + case ActorType::Unknown: + case ActorType::Player: + case ActorType::FloorItem: + case ActorType::Portal: + case ActorType::LocalPet: default: continue; } diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index ef6a1b1ad..d528e22aa 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -852,7 +852,7 @@ void NpcDialog::showAvatar(const uint16_t avatarId) if (needShow) { delete mAvatarBeing; - mAvatarBeing = new Being(0, ActorType::AVATAR, avatarId, nullptr); + mAvatarBeing = new Being(0, ActorType::Avatar, avatarId, nullptr); mPlayerBox->setPlayer(mAvatarBeing); if (!mAvatarBeing->empty()) { diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp index 96ac002fa..3645ccc9b 100644 --- a/src/gui/windows/shopwindow.cpp +++ b/src/gui/windows/shopwindow.cpp @@ -299,7 +299,7 @@ void ShopWindow::startTrade() return; const Being *const being = actorManager->findBeingByName( - mTradeNick, ActorType::PLAYER); + mTradeNick, ActorType::Player); tradeWindow->clear(); if (mTradeMoney) { @@ -703,7 +703,7 @@ void ShopWindow::processRequest(const std::string &nick, std::string data, { if (!localPlayer || !mTradeNick.empty() || PlayerInfo::isTrading() || !actorManager - || !actorManager->findBeingByName(nick, ActorType::PLAYER)) + || !actorManager->findBeingByName(nick, ActorType::Player)) { return; } diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp index 2b5210775..eb44a0081 100644 --- a/src/gui/windows/whoisonline.cpp +++ b/src/gui/windows/whoisonline.cpp @@ -206,7 +206,7 @@ void WhoIsOnline::handleLink(const std::string& link, MouseEvent *event) { const std::string text = decodeLinkText(link); Being *const being = actorManager->findBeingByName( - text, ActorType::PLAYER); + text, ActorType::Player); if (being && popupManager) { @@ -430,7 +430,7 @@ void WhoIsOnline::loadWebList() if (actorManager) { Being *const being = actorManager->findBeingByName( - nick, ActorType::PLAYER); + nick, ActorType::Player); if (being) { if (level > 0) @@ -824,7 +824,7 @@ void OnlinePlayer::setText(std::string color) if (mStatus != 255 && actorManager) { Being *const being = actorManager->findBeingByName( - mNick, ActorType::PLAYER); + mNick, ActorType::Player); if (being) { being->setState(mStatus); diff --git a/src/guildmanager.cpp b/src/guildmanager.cpp index 69d5dfc9d..152b2b168 100644 --- a/src/guildmanager.cpp +++ b/src/guildmanager.cpp @@ -413,7 +413,7 @@ bool GuildManager::process(std::string msg) if (actorManager) { Being *const b = actorManager->findBeingByName( - msg, ActorType::PLAYER); + msg, ActorType::Player); if (b) { diff --git a/src/listeners/playerlistener.cpp b/src/listeners/playerlistener.cpp index d50aa20d9..067528924 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(static_cast<int>(ActorType::Unknown)) { } diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index 8bb5ec20f..a94f686da 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -59,15 +59,15 @@ Being *BeingHandler::createBeing(const int id, const int16_t job) const if (!actorManager) return nullptr; - ActorType::Type type = ActorType::UNKNOWN; + ActorType::Type type = ActorType::Unknown; if (job <= 25 || (job >= 4001 && job <= 4049)) - type = ActorType::PLAYER; + type = ActorType::Player; else if (job >= 46 && job <= 1000) - type = ActorType::NPC; + type = ActorType::Npc; else if (job > 1000 && job <= 2000) - type = ActorType::MONSTER; + type = ActorType::Monster; else if (job == 45) - type = ActorType::PORTAL; + type = ActorType::Portal; Being *const being = actorManager->createBeing(id, type, job); return being; @@ -123,7 +123,7 @@ void BeingHandler::processBeingRemove(Net::MessageIn &msg) const } else { - if (dstBeing->getType() == ActorType::PLAYER) + if (dstBeing->getType() == ActorType::Player) { if (botCheckerWindow) botCheckerWindow->updateList(); @@ -222,11 +222,11 @@ void BeingHandler::processBeingAction(Net::MessageIn &msg) const case Being::FLEE: // Lucky Dodge if (srcBeing) { - if (srcSpeed && srcBeing->getType() == ActorType::PLAYER) + if (srcSpeed && srcBeing->getType() == ActorType::Player) srcBeing->setAttackDelay(srcSpeed); // attackid=1, type srcBeing->handleAttack(dstBeing, param1, 1); - if (srcBeing->getType() == ActorType::PLAYER) + if (srcBeing->getType() == ActorType::Player) srcBeing->setAttackTime(); } if (dstBeing) @@ -246,7 +246,7 @@ void BeingHandler::processBeingAction(Net::MessageIn &msg) const if (srcBeing) { srcBeing->setAction(BeingAction::SIT, 0); - if (srcBeing->getType() == ActorType::PLAYER) + if (srcBeing->getType() == ActorType::Player) { srcBeing->setMoveTime(); if (localPlayer) @@ -259,7 +259,7 @@ void BeingHandler::processBeingAction(Net::MessageIn &msg) const if (srcBeing) { srcBeing->setAction(BeingAction::STAND, 0); - if (srcBeing->getType() == ActorType::PLAYER) + if (srcBeing->getType() == ActorType::Player) { srcBeing->setMoveTime(); if (localPlayer) @@ -305,7 +305,7 @@ void BeingHandler::processBeingSelfEffect(Net::MessageIn &msg) const effectManager->trigger(effectType, being); // +++ need dehard code effectType == 3 - if (effectType == 3 && being->getType() == ActorType::PLAYER + if (effectType == 3 && being->getType() == ActorType::Player && socialWindow) { // reset received damage socialWindow->resetDamage(being->getName()); @@ -338,7 +338,7 @@ void BeingHandler::processBeingEmotion(Net::MessageIn &msg) const localPlayer->imitateEmote(dstBeing, emote); } } - if (dstBeing->getType() == ActorType::PLAYER) + if (dstBeing->getType() == ActorType::Player) dstBeing->setOtherTime(); BLOCK_END("BeingHandler::processBeingEmotion") } @@ -367,7 +367,7 @@ void BeingHandler::processNameResponse(Net::MessageIn &msg) const dstBeing->updateGuild(); dstBeing->addToCache(); - if (dstBeing->getType() == ActorType::PLAYER) + if (dstBeing->getType() == ActorType::Player) dstBeing->updateColors(); if (localPlayer) diff --git a/src/net/ea/chathandler.cpp b/src/net/ea/chathandler.cpp index 4bec39513..62c6b17f8 100644 --- a/src/net/ea/chathandler.cpp +++ b/src/net/ea/chathandler.cpp @@ -295,7 +295,7 @@ void ChatHandler::processBeingChat(Net::MessageIn &msg) const std::string chatMsg = msg.readRawString(chatMsgLength, "message"); - if (being->getType() == ActorType::PLAYER) + if (being->getType() == ActorType::Player) being->setTalkTime(); const size_t pos = chatMsg.find(" : ", 0); @@ -310,7 +310,7 @@ void ChatHandler::processBeingChat(Net::MessageIn &msg) const sender_name = "?"; } else if (sender_name != being->getName() - && being->getType() == ActorType::PLAYER) + && being->getType() == ActorType::Player) { if (!being->getName().empty()) sender_name = being->getName(); diff --git a/src/net/ea/guildhandler.cpp b/src/net/ea/guildhandler.cpp index de1d2763c..598811fdd 100644 --- a/src/net/ea/guildhandler.cpp +++ b/src/net/ea/guildhandler.cpp @@ -279,7 +279,7 @@ void GuildHandler::processGuildMemberList(Net::MessageIn &msg) const if (actorManager) { Being *const being = actorManager->findBeingByName( - name, ActorType::PLAYER); + name, ActorType::Player); if (being) { being->setGuildName(taGuild->getName()); @@ -481,7 +481,7 @@ void GuildHandler::processGuildLeave(Net::MessageIn &msg) const if (actorManager) { Being *const b = actorManager->findBeingByName( - nick, ActorType::PLAYER); + nick, ActorType::Player); if (b) b->clearGuilds(); @@ -524,7 +524,7 @@ void GuildHandler::processGuildExpulsion(Net::MessageIn &msg) const if (actorManager) { Being *const b = actorManager->findBeingByName( - nick, ActorType::PLAYER); + nick, ActorType::Player); if (b) b->clearGuilds(); diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp index c048178f8..b1d6845f5 100644 --- a/src/net/ea/partyhandler.cpp +++ b/src/net/ea/partyhandler.cpp @@ -92,7 +92,7 @@ void PartyHandler::processPartyInvited(Net::MessageIn &msg) const const Being *const being = actorManager->findBeing(id); if (being) { - if (being->getType() == ActorType::PLAYER) + if (being->getType() == ActorType::Player) nick = being->getName(); } } @@ -214,7 +214,7 @@ void PartyHandler::processPartyLeave(Net::MessageIn &msg) const if (actorManager) { Being *const b = actorManager->findBeing(id); - if (b && b->getType() == ActorType::PLAYER) + if (b && b->getType() == ActorType::Player) { b->setParty(nullptr); b->setPartyName(""); diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp index fb0a94f64..7f00dc9de 100644 --- a/src/net/eathena/beinghandler.cpp +++ b/src/net/eathena/beinghandler.cpp @@ -319,7 +319,7 @@ void BeingHandler::processBeingChangeLookContinue(Being *const dstBeing, const int id, const int id2) const { - if (dstBeing->getType() == ActorType::PLAYER) + if (dstBeing->getType() == ActorType::Player) dstBeing->setOtherTime(); const std::string color; @@ -432,7 +432,7 @@ void BeingHandler::processNameResponse2(Net::MessageIn &msg) dstBeing->updateGuild(); dstBeing->addToCache(); - if (dstBeing->getType() == ActorType::PLAYER) + if (dstBeing->getType() == ActorType::Player) dstBeing->updateColors(); if (localPlayer) @@ -841,7 +841,7 @@ void BeingHandler::processPlayerMove(Net::MessageIn &msg) const msg.readUInt8("unknown"); - if (dstBeing->getType() != ActorType::PLAYER) + if (dstBeing->getType() != ActorType::Player) dstBeing->setActionTime(tick_time); dstBeing->setStunMode(stunMode); @@ -850,7 +850,7 @@ void BeingHandler::processPlayerMove(Net::MessageIn &msg) const dstBeing->setStatusEffectBlock(16, static_cast<uint16_t>( statusEffects & 0xffffU)); - if (dstBeing->getType() == ActorType::PLAYER) + if (dstBeing->getType() == ActorType::Player) dstBeing->setMoveTime(); } @@ -881,7 +881,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg) Being *dstBeing = actorManager->findBeing(id); - if (dstBeing && dstBeing->getType() == ActorType::MONSTER + if (dstBeing && dstBeing->getType() == ActorType::Monster && !dstBeing->isAlive()) { actorManager->destroy(dstBeing); @@ -910,11 +910,11 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg) else { // undeleting marked for deletion being - if (dstBeing->getType() == ActorType::NPC) + if (dstBeing->getType() == ActorType::Npc) actorManager->undelete(dstBeing); } - if (dstBeing->getType() == ActorType::PLAYER) + if (dstBeing->getType() == ActorType::Player) dstBeing->setMoveTime(); if (spawnId) @@ -934,7 +934,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg) dstBeing->setWalkSpeed(Vector(speed, speed, 0)); dstBeing->setSubtype(job, 0); - if (dstBeing->getType() == ActorType::MONSTER && localPlayer) + if (dstBeing->getType() == ActorType::Monster && localPlayer) localPlayer->checkNewName(dstBeing); const int hairStyle = msg.readInt16("hair style"); @@ -956,7 +956,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg) msg.readUInt8("karma"); uint8_t gender = msg.readUInt8("gender"); - if (dstBeing->getType() == ActorType::PLAYER) + if (dstBeing->getType() == ActorType::Player) { gender &= 3; dstBeing->setGender(Being::intToGender(gender)); @@ -972,7 +972,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg) // if (!mHideShield) // setSprite(dstBeing, SPRITE_SHIELD, shield); } - else if (dstBeing->getType() == ActorType::NPC) + else if (dstBeing->getType() == ActorType::Npc) { setServerGender(dstBeing, gender); } @@ -1050,7 +1050,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg) Being *dstBeing = actorManager->findBeing(id); - if (dstBeing && dstBeing->getType() == ActorType::MONSTER + if (dstBeing && dstBeing->getType() == ActorType::Monster && !dstBeing->isAlive()) { actorManager->destroy(dstBeing); @@ -1079,11 +1079,11 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg) else { // undeleting marked for deletion being - if (dstBeing->getType() == ActorType::NPC) + if (dstBeing->getType() == ActorType::Npc) actorManager->undelete(dstBeing); } - if (dstBeing->getType() == ActorType::PLAYER) + if (dstBeing->getType() == ActorType::Player) dstBeing->setMoveTime(); if (spawnId) @@ -1095,7 +1095,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg) dstBeing->setWalkSpeed(Vector(speed, speed, 0)); dstBeing->setSubtype(job, 0); - if (dstBeing->getType() == ActorType::MONSTER && localPlayer) + if (dstBeing->getType() == ActorType::Monster && localPlayer) localPlayer->checkNewName(dstBeing); const int hairStyle = msg.readInt16("hair style"); @@ -1119,7 +1119,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg) msg.readUInt8("karma"); uint8_t gender = msg.readUInt8("gender"); - if (dstBeing->getType() == ActorType::PLAYER) + if (dstBeing->getType() == ActorType::Player) { gender &= 3; dstBeing->setGender(Being::intToGender(gender)); @@ -1135,7 +1135,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg) // if (!mHideShield) // setSprite(dstBeing, SPRITE_SHIELD, shield); } - else if (dstBeing->getType() == ActorType::NPC) + else if (dstBeing->getType() == ActorType::Npc) { setServerGender(dstBeing, gender); } @@ -1215,7 +1215,7 @@ void BeingHandler::processBeingSpawn(Net::MessageIn &msg) Being *dstBeing = actorManager->findBeing(id); - if (dstBeing && dstBeing->getType() == ActorType::MONSTER + if (dstBeing && dstBeing->getType() == ActorType::Monster && !dstBeing->isAlive()) { actorManager->destroy(dstBeing); @@ -1244,11 +1244,11 @@ void BeingHandler::processBeingSpawn(Net::MessageIn &msg) else { // undeleting marked for deletion being - if (dstBeing->getType() == ActorType::NPC) + if (dstBeing->getType() == ActorType::Npc) actorManager->undelete(dstBeing); } - if (dstBeing->getType() == ActorType::PLAYER) + if (dstBeing->getType() == ActorType::Player) dstBeing->setMoveTime(); if (spawnId) @@ -1262,7 +1262,7 @@ void BeingHandler::processBeingSpawn(Net::MessageIn &msg) dstBeing->setWalkSpeed(Vector(speed, speed, 0)); dstBeing->setSubtype(job, 0); - if (dstBeing->getType() == ActorType::MONSTER && localPlayer) + if (dstBeing->getType() == ActorType::Monster && localPlayer) localPlayer->checkNewName(dstBeing); const int hairStyle = msg.readInt16("hair style"); @@ -1284,7 +1284,7 @@ void BeingHandler::processBeingSpawn(Net::MessageIn &msg) msg.readUInt8("karma"); uint8_t gender = msg.readUInt8("gender"); - if (dstBeing->getType() == ActorType::PLAYER) + if (dstBeing->getType() == ActorType::Player) { gender &= 3; dstBeing->setGender(Being::intToGender(gender)); @@ -1300,7 +1300,7 @@ void BeingHandler::processBeingSpawn(Net::MessageIn &msg) // if (!mHideShield) // setSprite(dstBeing, SPRITE_SHIELD, shield); } - else if (dstBeing->getType() == ActorType::NPC) + else if (dstBeing->getType() == ActorType::Npc) { setServerGender(dstBeing, gender); } @@ -1425,7 +1425,7 @@ void BeingHandler::processBeingMove2(Net::MessageIn &msg) const dstBeing->setAction(BeingAction::STAND, 0); dstBeing->setTileCoords(srcX, srcY); dstBeing->setDestination(dstX, dstY); - if (dstBeing->getType() == ActorType::PLAYER) + if (dstBeing->getType() == ActorType::Player) dstBeing->setMoveTime(); BLOCK_END("BeingHandler::processBeingMove2") } @@ -1461,11 +1461,11 @@ void BeingHandler::processBeingAction2(Net::MessageIn &msg) const case Being::FLEE: // Lucky Dodge if (srcBeing) { - if (srcSpeed && srcBeing->getType() == ActorType::PLAYER) + if (srcSpeed && srcBeing->getType() == ActorType::Player) srcBeing->setAttackDelay(srcSpeed); // attackid=1, type srcBeing->handleAttack(dstBeing, param1, 1); - if (srcBeing->getType() == ActorType::PLAYER) + if (srcBeing->getType() == ActorType::Player) srcBeing->setAttackTime(); } if (dstBeing) @@ -1485,7 +1485,7 @@ void BeingHandler::processBeingAction2(Net::MessageIn &msg) const if (srcBeing) { srcBeing->setAction(BeingAction::SIT, 0); - if (srcBeing->getType() == ActorType::PLAYER) + if (srcBeing->getType() == ActorType::Player) { srcBeing->setMoveTime(); if (localPlayer) @@ -1498,7 +1498,7 @@ void BeingHandler::processBeingAction2(Net::MessageIn &msg) const if (srcBeing) { srcBeing->setAction(BeingAction::STAND, 0); - if (srcBeing->getType() == ActorType::PLAYER) + if (srcBeing->getType() == ActorType::Player) { srcBeing->setMoveTime(); if (localPlayer) diff --git a/src/net/eathena/guildhandler.cpp b/src/net/eathena/guildhandler.cpp index a4e604803..10fba3be8 100644 --- a/src/net/eathena/guildhandler.cpp +++ b/src/net/eathena/guildhandler.cpp @@ -206,7 +206,7 @@ void GuildHandler::invite(const int guildId A_UNUSED, return; const Being *const being = actorManager->findBeingByName( - name, ActorType::PLAYER); + name, ActorType::Player); if (being) { MessageOut msg(CMSG_GUILD_INVITE); diff --git a/src/net/eathena/partyhandler.cpp b/src/net/eathena/partyhandler.cpp index 182ea4957..5ef628744 100644 --- a/src/net/eathena/partyhandler.cpp +++ b/src/net/eathena/partyhandler.cpp @@ -130,7 +130,7 @@ void PartyHandler::invite(const std::string &name) const return; const Being *const being = actorManager->findBeingByName( - name, ActorType::PLAYER); + name, ActorType::Player); if (being) { MessageOut outMsg(CMSG_PARTY_INVITE); @@ -448,7 +448,7 @@ void PartyHandler::processPartyInviteResponse(Net::MessageIn &msg) const void PartyHandler::changeLeader(const std::string &name) const { const Being *const being = actorManager->findBeingByName( - name, ActorType::PLAYER); + name, ActorType::Player); if (!being) return; MessageOut outMsg(CMSG_PARTY_CHANGE_LEADER); diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index ee431acbe..195579946 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -319,7 +319,7 @@ void BeingHandler::processBeingChangeLookContinue(Being *const dstBeing, const int id, const int id2) const { - if (dstBeing->getType() == ActorType::PLAYER) + if (dstBeing->getType() == ActorType::Player) dstBeing->setOtherTime(); const std::string color; @@ -444,7 +444,7 @@ void BeingHandler::processNameResponse2(Net::MessageIn &msg) dstBeing->updateGuild(); dstBeing->addToCache(); - if (dstBeing->getType() == ActorType::PLAYER) + if (dstBeing->getType() == ActorType::Player) dstBeing->updateColors(); if (localPlayer) @@ -929,7 +929,7 @@ void BeingHandler::processPlayerMove(Net::MessageIn &msg) const msg.readUInt8("unused"); - if (dstBeing->getType() != ActorType::PLAYER) + if (dstBeing->getType() != ActorType::Player) dstBeing->setActionTime(tick_time); dstBeing->setStunMode(stunMode); @@ -938,7 +938,7 @@ void BeingHandler::processPlayerMove(Net::MessageIn &msg) const dstBeing->setStatusEffectBlock(16, static_cast<uint16_t>( statusEffects & 0xffff)); - if (dstBeing->getType() == ActorType::PLAYER) + if (dstBeing->getType() == ActorType::Player) dstBeing->setMoveTime(); BLOCK_END("BeingHandler::processPlayerMoveUpdate") } @@ -1020,7 +1020,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg) Being *dstBeing = actorManager->findBeing(id); - if (dstBeing && dstBeing->getType() == ActorType::MONSTER + if (dstBeing && dstBeing->getType() == ActorType::Monster && !dstBeing->isAlive()) { actorManager->destroy(dstBeing); @@ -1057,7 +1057,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg) } else { - if (dstBeing->getType() == ActorType::NPC) + if (dstBeing->getType() == ActorType::Npc) { actorManager->undelete(dstBeing); if (serverVersion < 1) @@ -1065,7 +1065,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg) } } - if (dstBeing->getType() == ActorType::PLAYER) + if (dstBeing->getType() == ActorType::Player) dstBeing->setMoveTime(); if (spawnId) @@ -1086,7 +1086,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg) const uint8_t hairStyle = msg.readUInt8("hair style"); const uint8_t look = msg.readUInt8("look"); dstBeing->setSubtype(job, look); - if (dstBeing->getType() == ActorType::MONSTER && localPlayer) + if (dstBeing->getType() == ActorType::Monster && localPlayer) localPlayer->checkNewName(dstBeing); dstBeing->setWalkSpeed(Vector(speed, speed, 0)); const uint16_t weapon = msg.readInt16("weapon"); @@ -1100,7 +1100,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg) const uint16_t shoes = msg.readInt16("shoes / clothes color"); uint16_t gloves; - if (dstBeing->getType() == ActorType::MONSTER) + if (dstBeing->getType() == ActorType::Monster) { if (serverVersion > 0 || tmwServerVersion >= 0x0E0701) { @@ -1130,7 +1130,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg) msg.readInt16("manner"); dstBeing->setStatusEffectBlock(32, msg.readInt16("opt3")); - if (serverVersion > 0 && dstBeing->getType() == ActorType::MONSTER) + if (serverVersion > 0 && dstBeing->getType() == ActorType::Monster) { const int attackRange = static_cast<int>( msg.readUInt8("attack range (was karma)")); @@ -1142,7 +1142,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg) } uint8_t gender = msg.readUInt8("gender"); - if (!disguiseId && dstBeing->getType() == ActorType::PLAYER) + if (!disguiseId && dstBeing->getType() == ActorType::Player) { // reserving bits for future usage gender &= 3; @@ -1160,7 +1160,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg) if (!mHideShield) setSprite(dstBeing, SPRITE_SHIELD, shield); } - else if (dstBeing->getType() == ActorType::NPC) + else if (dstBeing->getType() == ActorType::Npc) { setServerGender(dstBeing, gender); } @@ -1229,7 +1229,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg) Being *dstBeing = actorManager->findBeing(id); - if (dstBeing && dstBeing->getType() == ActorType::MONSTER + if (dstBeing && dstBeing->getType() == ActorType::Monster && !dstBeing->isAlive()) { actorManager->destroy(dstBeing); @@ -1266,7 +1266,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg) } else { - if (dstBeing->getType() == ActorType::NPC) + if (dstBeing->getType() == ActorType::Npc) { actorManager->undelete(dstBeing); if (serverVersion < 1) @@ -1274,7 +1274,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg) } } - if (dstBeing->getType() == ActorType::PLAYER) + if (dstBeing->getType() == ActorType::Player) dstBeing->setMoveTime(); if (spawnId) @@ -1287,7 +1287,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg) const uint8_t hairStyle = msg.readUInt8("hair style"); const uint8_t look = msg.readUInt8("look"); dstBeing->setSubtype(job, look); - if (dstBeing->getType() == ActorType::MONSTER && localPlayer) + if (dstBeing->getType() == ActorType::Monster && localPlayer) localPlayer->checkNewName(dstBeing); dstBeing->setWalkSpeed(Vector(speed, speed, 0)); const uint16_t weapon = msg.readInt16("weapon"); @@ -1303,7 +1303,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg) const uint16_t shoes = msg.readInt16("shoes / clothes color"); uint16_t gloves; - if (dstBeing->getType() == ActorType::MONSTER) + if (dstBeing->getType() == ActorType::Monster) { if (serverVersion > 0 || tmwServerVersion >= 0x0E0701) { @@ -1333,7 +1333,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg) msg.readInt16("manner"); dstBeing->setStatusEffectBlock(32, msg.readInt16("opt3")); - if (serverVersion > 0 && dstBeing->getType() == ActorType::MONSTER) + if (serverVersion > 0 && dstBeing->getType() == ActorType::Monster) { const int attackRange = static_cast<int>( msg.readUInt8("attack range (was karma)")); @@ -1345,7 +1345,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg) } uint8_t gender = msg.readUInt8("gender"); - if (!disguiseId && dstBeing->getType() == ActorType::PLAYER) + if (!disguiseId && dstBeing->getType() == ActorType::Player) { // reserving bits for future usage gender &= 3; @@ -1363,7 +1363,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg) if (!mHideShield) setSprite(dstBeing, SPRITE_SHIELD, shield); } - else if (dstBeing->getType() == ActorType::NPC) + else if (dstBeing->getType() == ActorType::Npc) { setServerGender(dstBeing, gender); } @@ -1472,7 +1472,7 @@ void BeingHandler::processBeingMove2(Net::MessageIn &msg) const dstBeing->setAction(BeingAction::STAND, 0); dstBeing->setTileCoords(srcX, srcY); dstBeing->setDestination(dstX, dstY); - if (dstBeing->getType() == ActorType::PLAYER) + if (dstBeing->getType() == ActorType::Player) dstBeing->setMoveTime(); BLOCK_END("BeingHandler::processBeingMove2") } diff --git a/src/net/tmwa/guildhandler.cpp b/src/net/tmwa/guildhandler.cpp index 5aa272475..852dfa135 100644 --- a/src/net/tmwa/guildhandler.cpp +++ b/src/net/tmwa/guildhandler.cpp @@ -212,7 +212,7 @@ void GuildHandler::invite(const int guildId A_UNUSED, return; const Being *const being = actorManager->findBeingByName( - name, ActorType::PLAYER); + name, ActorType::Player); if (being) { MessageOut msg(CMSG_GUILD_INVITE); diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp index ba3a4d26c..0ae327edb 100644 --- a/src/net/tmwa/partyhandler.cpp +++ b/src/net/tmwa/partyhandler.cpp @@ -124,7 +124,7 @@ void PartyHandler::invite(const std::string &name) const return; const Being *const being = actorManager->findBeingByName( - name, ActorType::PLAYER); + name, ActorType::Player); if (being) { MessageOut outMsg(CMSG_PARTY_INVITE); diff --git a/src/spellmanager.cpp b/src/spellmanager.cpp index ca164717b..e5d8166ce 100644 --- a/src/spellmanager.cpp +++ b/src/spellmanager.cpp @@ -154,7 +154,7 @@ void SpellManager::invoke(const int spellId) const { invokeSpell(spell); } - if ((target && (target->getType() != ActorType::MONSTER + if ((target && (target->getType() != ActorType::Monster || spell->getCommandType() == TEXT_COMMAND_TEXT)) && (spell->getTargetType() == ALLOWTARGET || spell->getTargetType() == NEEDTARGET)) diff --git a/src/utils/chatutils.cpp b/src/utils/chatutils.cpp index ea37b7fd2..f3c9076be 100644 --- a/src/utils/chatutils.cpp +++ b/src/utils/chatutils.cpp @@ -100,10 +100,10 @@ void replaceVars(std::string &str) if (str.find("<PLAYER>") != std::string::npos) { const Being *target = localPlayer->getTarget(); - if (!target || target->getType() != ActorType::PLAYER) + if (!target || target->getType() != ActorType::Player) { target = actorManager->findNearestLivingBeing( - localPlayer, 20, ActorType::PLAYER, true); + localPlayer, 20, ActorType::Player, true); } if (target) replaceAll(str, "<PLAYER>", target->getName()); @@ -113,10 +113,10 @@ void replaceVars(std::string &str) if (str.find("<MONSTER>") != std::string::npos) { const Being *target = localPlayer->getTarget(); - if (!target || target->getType() != ActorType::MONSTER) + if (!target || target->getType() != ActorType::Monster) { target = actorManager->findNearestLivingBeing( - localPlayer, 20, ActorType::MONSTER, true); + localPlayer, 20, ActorType::Monster, true); } if (target) replaceAll(str, "<MONSTER>", target->getName()); |