From aadf40739c45c3396ace5766dd9c60db0c3b1ccc Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 30 May 2015 17:45:27 +0300 Subject: Move relation enum into separate file. --- src/being/playerrelations.cpp | 52 +++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'src/being/playerrelations.cpp') diff --git a/src/being/playerrelations.cpp b/src/being/playerrelations.cpp index 22f685044..20192be07 100644 --- a/src/being/playerrelations.cpp +++ b/src/being/playerrelations.cpp @@ -101,10 +101,10 @@ namespace if (!(*container)[name]) { const int v = cobj->getValueInt(RELATION, - static_cast(PlayerRelation::NEUTRAL)); + static_cast(Relation::NEUTRAL)); (*container)[name] = new PlayerRelation( - static_cast(v)); + static_cast(v)); } // otherwise ignore the duplicate entry @@ -271,19 +271,19 @@ unsigned int PlayerRelationsManager::checkPermissionSilently( switch (r->mRelation) { - case PlayerRelation::NEUTRAL: + case Relation::NEUTRAL: permissions = mDefaultPermissions; break; - case PlayerRelation::FRIEND: + case Relation::FRIEND: permissions |= mDefaultPermissions; // widen break; - case PlayerRelation::DISREGARDED: - case PlayerRelation::IGNORED: - case PlayerRelation::ERASED: - case PlayerRelation::BLACKLISTED: - case PlayerRelation::ENEMY2: + case Relation::DISREGARDED: + case Relation::IGNORED: + case Relation::ERASED: + case Relation::BLACKLISTED: + case Relation::ENEMY2: default: permissions &= mDefaultPermissions; // narrow } @@ -330,10 +330,10 @@ bool PlayerRelationsManager::hasPermission(const std::string &name, } void PlayerRelationsManager::setRelation(const std::string &player_name, - const PlayerRelation::Relation + const RelationT relation) { - if (!localPlayer || (relation != PlayerRelation::NEUTRAL + if (!localPlayer || (relation != Relation::NEUTRAL && localPlayer->getName() == player_name)) { return; @@ -365,7 +365,7 @@ StringVect *PlayerRelationsManager::getPlayers() const } StringVect *PlayerRelationsManager::getPlayersByRelation( - const PlayerRelation::Relation rel) const + const RelationT rel) const { StringVect *const retval = new StringVect(); @@ -388,7 +388,7 @@ void PlayerRelationsManager::removePlayer(const std::string &name) } -PlayerRelation::Relation PlayerRelationsManager::getRelation( +RelationT PlayerRelationsManager::getRelation( const std::string &name) const { const std::map::const_iterator @@ -396,7 +396,7 @@ PlayerRelation::Relation PlayerRelationsManager::getRelation( if (it != mRelations.end()) return (*it).second->mRelation; - return PlayerRelation::NEUTRAL; + return Relation::NEUTRAL; } //////////////////////////////////////// @@ -420,18 +420,18 @@ void PlayerRelationsManager::ignoreTrade(const std::string &name) const if (name.empty()) return; - const PlayerRelation::Relation relation = getRelation(name); + const RelationT relation = getRelation(name); - if (relation == PlayerRelation::IGNORED - || relation == PlayerRelation::DISREGARDED - || relation == PlayerRelation::BLACKLISTED - || relation == PlayerRelation::ERASED) + if (relation == Relation::IGNORED + || relation == Relation::DISREGARDED + || relation == Relation::BLACKLISTED + || relation == Relation::ERASED) { return; } else { - player_relations.setRelation(name, PlayerRelation::BLACKLISTED); + player_relations.setRelation(name, Relation::BLACKLISTED); } } @@ -440,13 +440,13 @@ bool PlayerRelationsManager::checkBadRelation(const std::string &name) const if (name.empty()) return true; - const PlayerRelation::Relation relation = getRelation(name); + const RelationT relation = getRelation(name); - if (relation == PlayerRelation::IGNORED - || relation == PlayerRelation::DISREGARDED - || relation == PlayerRelation::BLACKLISTED - || relation == PlayerRelation::ERASED - || relation == PlayerRelation::ENEMY2) + if (relation == Relation::IGNORED + || relation == Relation::DISREGARDED + || relation == Relation::BLACKLISTED + || relation == Relation::ERASED + || relation == Relation::ENEMY2) { return true; } -- cgit v1.2.3-60-g2f50