summaryrefslogtreecommitdiff
path: root/src/player_relations.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-03-10 12:23:50 -0600
committerJared Adams <jaxad0127@gmail.com>2009-03-10 12:23:50 -0600
commit17f9d5abcb05da185486ccfba293f3a8c9eab437 (patch)
tree7545a7bdd3acefc1ff92f345416872c896b90ddb /src/player_relations.cpp
parent4a08d3b4bec3fa0fc1878140b0f14c8b38d6420b (diff)
downloadmana-17f9d5abcb05da185486ccfba293f3a8c9eab437.tar.gz
mana-17f9d5abcb05da185486ccfba293f3a8c9eab437.tar.bz2
mana-17f9d5abcb05da185486ccfba293f3a8c9eab437.tar.xz
mana-17f9d5abcb05da185486ccfba293f3a8c9eab437.zip
Fix some mem leaks
Diffstat (limited to 'src/player_relations.cpp')
-rw-r--r--src/player_relations.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/player_relations.cpp b/src/player_relations.cpp
index c82876e1..14df3f01 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,22 @@ 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,
+ mIgnoreStrategies.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,
+ mIgnoreStrategies.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_nothing());
+ mIgnoreStrategies.push_back(new PIS_dotdotdot());
+ mIgnoreStrategies.push_back(new PIS_blinkname());
}
- return &player_ignore_strategies;
+ return &mIgnoreStrategies;
}