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 /src/actormanager.cpp | |
parent | 69022cd939e572feadaadf1041ae7dadad782ed6 (diff) | |
download | plus-0a39e956218ca15bf78803f89141c7c9dfcec0d9.tar.gz plus-0a39e956218ca15bf78803f89141c7c9dfcec0d9.tar.bz2 plus-0a39e956218ca15bf78803f89141c7c9dfcec0d9.tar.xz plus-0a39e956218ca15bf78803f89141c7c9dfcec0d9.zip |
Change format in ActorType enum.
Diffstat (limited to 'src/actormanager.cpp')
-rw-r--r-- | src/actormanager.cpp | 132 |
1 files changed, 66 insertions, 66 deletions
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; |