summaryrefslogtreecommitdiff
path: root/src/player_relations.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/player_relations.cpp')
-rw-r--r--src/player_relations.cpp64
1 files changed, 23 insertions, 41 deletions
diff --git a/src/player_relations.cpp b/src/player_relations.cpp
index 09859c59..057eea94 100644
--- a/src/player_relations.cpp
+++ b/src/player_relations.cpp
@@ -19,12 +19,13 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#include <algorithm>
+
#include "beingmanager.h"
-#include "player_relations.h"
#include "graphics.h"
-#include "gui/gui.h"
+#include "player_relations.h"
-#include <algorithm>
+#include "gui/gui.h"
#define PLAYER_IGNORE_STRATEGY_NOP "nop"
#define PLAYER_IGNORE_STRATEGY_EMOTE0 "emote0"
@@ -90,8 +91,7 @@ PlayerRelationsManager::PlayerRelationsManager() :
{
}
-void
-PlayerRelationsManager::clear()
+void PlayerRelationsManager::clear()
{
std::vector<std::string> *names = getPlayers();
for (std::vector<std::string>::const_iterator
@@ -104,8 +104,7 @@ PlayerRelationsManager::clear()
#define PLAYER_IGNORE_STRATEGY "player-ignore-strategy"
#define DEFAULT_PERMISSIONS "default-player-permissions"
-int
-PlayerRelationsManager::getPlayerIgnoreStrategyIndex(const std::string &name)
+int PlayerRelationsManager::getPlayerIgnoreStrategyIndex(const std::string &name)
{
std::vector<PlayerIgnoreStrategy *> *strategies = getPlayerIgnoreStrategies();
for (unsigned int i = 0; i < strategies->size(); i++)
@@ -115,8 +114,7 @@ PlayerRelationsManager::getPlayerIgnoreStrategyIndex(const std::string &name)
return -1;
}
-void
-PlayerRelationsManager::load()
+void PlayerRelationsManager::load()
{
clear();
@@ -133,8 +131,7 @@ PlayerRelationsManager::load()
}
-void
-PlayerRelationsManager::init()
+void PlayerRelationsManager::init()
{
load();
@@ -142,8 +139,7 @@ PlayerRelationsManager::init()
clear(); // Yes, we still keep them around in the config file until the next update.
}
-void
-PlayerRelationsManager::store()
+void PlayerRelationsManager::store()
{
config.setList<std::map<std::string, PlayerRelation *>::const_iterator,
std::pair<std::string, PlayerRelation *>,
@@ -160,8 +156,7 @@ PlayerRelationsManager::store()
config.write();
}
-void
-PlayerRelationsManager::signalUpdate(const std::string &name)
+void PlayerRelationsManager::signalUpdate(const std::string &name)
{
store();
@@ -169,8 +164,7 @@ PlayerRelationsManager::signalUpdate(const std::string &name)
(*it)->updatedPlayer(name);
}
-unsigned int
-PlayerRelationsManager::checkPermissionSilently(const std::string &player_name, unsigned int flags)
+unsigned int PlayerRelationsManager::checkPermissionSilently(const std::string &player_name, unsigned int flags)
{
PlayerRelation *r = mRelations[player_name];
if (!r)
@@ -195,16 +189,14 @@ PlayerRelationsManager::checkPermissionSilently(const std::string &player_name,
}
}
-bool
-PlayerRelationsManager::hasPermission(Being *being, unsigned int flags)
+bool PlayerRelationsManager::hasPermission(Being *being, unsigned int flags)
{
if (being->getType() == Being::PLAYER)
return hasPermission(being->getName(), flags) == flags;
return true;
}
-bool
-PlayerRelationsManager::hasPermission(const std::string &name, unsigned int flags)
+bool PlayerRelationsManager::hasPermission(const std::string &name, unsigned int flags)
{
unsigned int rejections = flags & ~checkPermissionSilently(name, flags);
bool permitted = rejections == 0;
@@ -223,8 +215,7 @@ PlayerRelationsManager::hasPermission(const std::string &name, unsigned int flag
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)
@@ -235,8 +226,7 @@ PlayerRelationsManager::setRelation(const std::string &player_name, PlayerRelati
signalUpdate(player_name);
}
-std::vector<std::string> *
-PlayerRelationsManager::getPlayers()
+std::vector<std::string> * PlayerRelationsManager::getPlayers()
{
std::vector<std::string> *retval = new std::vector<std::string>();
@@ -249,8 +239,7 @@ PlayerRelationsManager::getPlayers()
return retval;
}
-void
-PlayerRelationsManager::removePlayer(const std::string &name)
+void PlayerRelationsManager::removePlayer(const std::string &name)
{
if (mRelations[name])
delete mRelations[name];
@@ -261,8 +250,7 @@ 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;
@@ -273,14 +261,12 @@ PlayerRelationsManager::getRelation(const std::string &name)
////////////////////////////////////////
// defaults
-unsigned int
-PlayerRelationsManager::getDefault() const
+unsigned int PlayerRelationsManager::getDefault() const
{
return mDefaultPermissions;
}
-void
-PlayerRelationsManager::setDefault(unsigned int permissions)
+void PlayerRelationsManager::setDefault(unsigned int permissions)
{
mDefaultPermissions = permissions;
@@ -302,8 +288,7 @@ public:
mShortName = PLAYER_IGNORE_STRATEGY_NOP;
}
- virtual void
- ignore(Player *player, unsigned int flags)
+ virtual void ignore(Player *player, unsigned int flags)
{
}
};
@@ -317,8 +302,7 @@ public:
mShortName = "dotdotdot";
}
- virtual void
- ignore(Player *player, unsigned int flags)
+ virtual void ignore(Player *player, unsigned int flags)
{
player->setSpeech("...", 5);
}
@@ -334,8 +318,7 @@ public:
mShortName = "blinkname";
}
- virtual void
- ignore(Player *player, unsigned int flags)
+ virtual void ignore(Player *player, unsigned int flags)
{
player->flash(200);
}
@@ -351,8 +334,7 @@ public:
mShortName = shortname;
}
- virtual void
- ignore(Player *player, unsigned int flags)
+ virtual void ignore(Player *player, unsigned int flags)
{
player->setEmote(mEmotion, IGNORE_EMOTE_TIME);
}