summaryrefslogtreecommitdiff
path: root/src/player_relations.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-04-13 21:33:06 +0200
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-04-13 21:35:19 +0200
commit28bc8c0edb549cdbbe0832c4202630a039f738b1 (patch)
tree9989f31a5121f82af5aa264ebfe7096c5ea5030f /src/player_relations.cpp
parent627e1bc7eee5b821d29b2161dec4991cae7bf9c0 (diff)
downloadmana-28bc8c0edb549cdbbe0832c4202630a039f738b1.tar.gz
mana-28bc8c0edb549cdbbe0832c4202630a039f738b1.tar.bz2
mana-28bc8c0edb549cdbbe0832c4202630a039f738b1.tar.xz
mana-28bc8c0edb549cdbbe0832c4202630a039f738b1.zip
Some cleanup of the Configuration interface
Mainly avoid all the convertions from integer to float and then to string and also back from string to float and then to integer.
Diffstat (limited to 'src/player_relations.cpp')
-rw-r--r--src/player_relations.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/player_relations.cpp b/src/player_relations.cpp
index ef2ef1bc..898996fa 100644
--- a/src/player_relations.cpp
+++ b/src/player_relations.cpp
@@ -49,7 +49,7 @@ class PlayerConfSerialiser : public ConfigurationListManager<std::pair<std::stri
if (!value.second)
return NULL;
cobj->setValue(NAME, value.first);
- cobj->setValue(RELATION, value.second->mRelation);
+ cobj->setValue(RELATION, toString(value.second->mRelation));
return cobj;
}
@@ -64,7 +64,7 @@ class PlayerConfSerialiser : public ConfigurationListManager<std::pair<std::stri
if (!(*container)[name]) {
int v = (int)cobj->getValue(RELATION, PlayerRelation::NEUTRAL);
- (*container)[name] = new PlayerRelation(static_cast<PlayerRelation::relation>(v));
+ (*container)[name] = new PlayerRelation(static_cast<PlayerRelation::Relation>(v));
}
// otherwise ignore the duplicate entry
@@ -81,7 +81,7 @@ const unsigned int PlayerRelation::RELATION_PERMISSIONS[RELATIONS_NR] = {
/* IGNORED */ 0
};
-PlayerRelation::PlayerRelation(relation relation)
+PlayerRelation::PlayerRelation(Relation relation)
{
mRelation = relation;
}
@@ -126,7 +126,7 @@ void PlayerRelationsManager::load()
clear();
mPersistIgnores = config.getValue(PERSIST_IGNORE_LIST, 0);
- mDefaultPermissions = (int)config.getValue(DEFAULT_PERMISSIONS, mDefaultPermissions);
+ mDefaultPermissions = (int) config.getValue(DEFAULT_PERMISSIONS, mDefaultPermissions);
std::string ignore_strategy_name = config.getValue(PLAYER_IGNORE_STRATEGY, DEFAULT_IGNORE_STRATEGY);
int ignore_strategy_index = getPlayerIgnoreStrategyIndex(ignore_strategy_name);
if (ignore_strategy_index >= 0)
@@ -222,7 +222,8 @@ bool PlayerRelationsManager::hasPermission(const std::string &name, unsigned int
return permitted;
}
-void PlayerRelationsManager::setRelation(const std::string &player_name, PlayerRelation::relation relation)
+void PlayerRelationsManager::setRelation(const std::string &player_name,
+ PlayerRelation::Relation relation)
{
PlayerRelation *r = mRelations[player_name];
if (r == NULL)
@@ -257,7 +258,7 @@ void PlayerRelationsManager::removePlayer(const std::string &name)
}
-PlayerRelation::relation PlayerRelationsManager::getRelation(const std::string &name)
+PlayerRelation::Relation PlayerRelationsManager::getRelation(const std::string &name)
{
if (mRelations[name])
return mRelations[name]->mRelation;