summaryrefslogtreecommitdiffstats
path: root/src/game-server/mapmanager.cpp
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-07-07 18:06:29 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-07-07 18:06:29 +0000
commitd213cdea38ae5dda3c1cbdc6c85a2c5fe04e9399 (patch)
tree2ae7c7abd8fdedb2e6ec5610718834d9a92a467f /src/game-server/mapmanager.cpp
parent04e694b067a21dee8e13368c17d1815cc0624ce4 (diff)
downloadmanaserv-d213cdea38ae5dda3c1cbdc6c85a2c5fe04e9399.tar.gz
manaserv-d213cdea38ae5dda3c1cbdc6c85a2c5fe04e9399.tar.xz
manaserv-d213cdea38ae5dda3c1cbdc6c85a2c5fe04e9399.zip
Singleton managers do not need stateful classes. Changed them to namespace interfaces.
Diffstat (limited to 'src/game-server/mapmanager.cpp')
-rw-r--r--src/game-server/mapmanager.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/game-server/mapmanager.cpp b/src/game-server/mapmanager.cpp
index 7de489c..58aace1 100644
--- a/src/game-server/mapmanager.cpp
+++ b/src/game-server/mapmanager.cpp
@@ -31,7 +31,17 @@
#include "utils/logger.h"
#include "utils/xml.hpp"
-MapManager::MapManager(std::string const &mapReferenceFile)
+/**
+ * List of all the game maps, be they present or not on this server.
+ */
+static MapManager::Maps maps;
+
+MapManager::Maps const &MapManager::getMaps()
+{
+ return maps;
+}
+
+void MapManager::initialize(std::string const &mapReferenceFile)
{
ResourceManager *resman = ResourceManager::getInstance();
int size;
@@ -80,12 +90,13 @@ MapManager::MapManager(std::string const &mapReferenceFile)
xmlFreeDoc(doc);
}
-MapManager::~MapManager()
+void MapManager::deinitialize()
{
for (Maps::iterator i = maps.begin(), i_end = maps.end(); i != i_end; ++i)
{
delete i->second;
}
+ maps.clear();
}
MapComposite *MapManager::getMap(int mapId)