summaryrefslogtreecommitdiff
path: root/src/being/playerrelations.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-30 17:45:27 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-30 17:45:27 +0300
commitaadf40739c45c3396ace5766dd9c60db0c3b1ccc (patch)
treea6d2ca5fb86849ae18586b728bfcd9e716f5635f /src/being/playerrelations.cpp
parent2a33b736dc93251bf7a72364c5f818142362a3ce (diff)
downloadmv-aadf40739c45c3396ace5766dd9c60db0c3b1ccc.tar.gz
mv-aadf40739c45c3396ace5766dd9c60db0c3b1ccc.tar.bz2
mv-aadf40739c45c3396ace5766dd9c60db0c3b1ccc.tar.xz
mv-aadf40739c45c3396ace5766dd9c60db0c3b1ccc.zip
Move relation enum into separate file.
Diffstat (limited to 'src/being/playerrelations.cpp')
-rw-r--r--src/being/playerrelations.cpp52
1 files changed, 26 insertions, 26 deletions
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<int>(PlayerRelation::NEUTRAL));
+ static_cast<int>(Relation::NEUTRAL));
(*container)[name] = new PlayerRelation(
- static_cast<PlayerRelation::Relation>(v));
+ static_cast<RelationT>(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<std::string, PlayerRelation *>::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;
}