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.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/player_relations.cpp b/src/player_relations.cpp
index c82876e1..ef2ef1bc 100644
--- a/src/player_relations.cpp
+++ b/src/player_relations.cpp
@@ -28,6 +28,8 @@
#include "player.h"
#include "player_relations.h"
+#include "utils/dtor.h"
+
#define PLAYER_IGNORE_STRATEGY_NOP "nop"
#define PLAYER_IGNORE_STRATEGY_EMOTE0 "emote0"
#define DEFAULT_IGNORE_STRATEGY PLAYER_IGNORE_STRATEGY_EMOTE0
@@ -37,7 +39,6 @@
#define IGNORE_EMOTE_TIME 100
-
// (De)serialisation class
class PlayerConfSerialiser : public ConfigurationListManager<std::pair<std::string, PlayerRelation *>,
std::map<std::string, PlayerRelation *> *>
@@ -92,6 +93,11 @@ PlayerRelationsManager::PlayerRelationsManager() :
{
}
+PlayerRelationsManager::~PlayerRelationsManager()
+{
+ delete_all(mIgnoreStrategies);
+}
+
void PlayerRelationsManager::clear()
{
std::vector<std::string> *names = getPlayers();
@@ -345,24 +351,23 @@ private:
-static std::vector<PlayerIgnoreStrategy *> player_ignore_strategies;
-
std::vector<PlayerIgnoreStrategy *> *
PlayerRelationsManager::getPlayerIgnoreStrategies()
{
- if (player_ignore_strategies.size() == 0) {
+ if (mIgnoreStrategies.size() == 0)
+ {
// not initialised yet?
- player_ignore_strategies.push_back(new PIS_emote(FIRST_IGNORE_EMOTE,
- "floating '...' bubble",
- PLAYER_IGNORE_STRATEGY_EMOTE0));
- player_ignore_strategies.push_back(new PIS_emote(FIRST_IGNORE_EMOTE + 1,
- "floating bubble",
- "emote1"));
- player_ignore_strategies.push_back(new PIS_nothing());
- player_ignore_strategies.push_back(new PIS_dotdotdot());
- player_ignore_strategies.push_back(new PIS_blinkname());
+ mIgnoreStrategies.push_back(new PIS_emote(FIRST_IGNORE_EMOTE,
+ "floating '...' bubble",
+ PLAYER_IGNORE_STRATEGY_EMOTE0));
+ mIgnoreStrategies.push_back(new PIS_emote(FIRST_IGNORE_EMOTE + 1,
+ "floating bubble",
+ "emote1"));
+ mIgnoreStrategies.push_back(new PIS_nothing());
+ mIgnoreStrategies.push_back(new PIS_dotdotdot());
+ mIgnoreStrategies.push_back(new PIS_blinkname());
}
- return &player_ignore_strategies;
+ return &mIgnoreStrategies;
}