summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-09-22 18:45:57 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-09-22 18:45:57 +0000
commitac5375e554e882e0b56eeed9b6e51c06c8d37656 (patch)
tree8c0095d23e880ab112dacc7e94505aac86d04dd7
parent88e3d219588052a8ab222ab4f6f2b27c9c29c1b2 (diff)
downloadmanaserv-ac5375e554e882e0b56eeed9b6e51c06c8d37656.tar.gz
manaserv-ac5375e554e882e0b56eeed9b6e51c06c8d37656.tar.bz2
manaserv-ac5375e554e882e0b56eeed9b6e51c06c8d37656.tar.xz
manaserv-ac5375e554e882e0b56eeed9b6e51c06c8d37656.zip
Cleaned both configuration and resource managers.
-rw-r--r--ChangeLog17
-rw-r--r--src/Makefile.am18
-rw-r--r--src/account-server/accounthandler.cpp23
-rw-r--r--src/account-server/dalstorage.cpp4
-rw-r--r--src/account-server/main-account.cpp23
-rw-r--r--src/chat-server/chatchannelmanager.hpp1
-rw-r--r--src/chat-server/chathandler.hpp1
-rw-r--r--src/common/configuration.cpp122
-rw-r--r--src/common/configuration.hpp74
-rw-r--r--src/configuration.cpp193
-rw-r--r--src/configuration.h124
-rw-r--r--src/game-server/accountconnection.cpp11
-rw-r--r--src/game-server/itemmanager.cpp5
-rw-r--r--src/game-server/main-game.cpp25
-rw-r--r--src/game-server/mapmanager.cpp11
-rw-r--r--src/game-server/mapreader.cpp9
-rw-r--r--src/game-server/monstermanager.cpp5
-rw-r--r--src/game-server/resourcemanager.cpp (renamed from src/resourcemanager.cpp)97
-rw-r--r--src/game-server/resourcemanager.hpp55
-rw-r--r--src/resourcemanager.h93
-rw-r--r--src/scripting/script.cpp5
-rw-r--r--src/utils/stringfilter.cpp16
-rw-r--r--src/utils/stringfilter.h5
23 files changed, 365 insertions, 572 deletions
diff --git a/ChangeLog b/ChangeLog
index 22f48f60..0e6f2fbc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2007-09-22 Guillaume Melquiond <guillaume.melquiond@gmail.com>
+
+ * src/chat-server/chatchannelmanager.hpp,
+ src/chat-server/chathandler.hpp: Fixed header dependencies.
+ * src/configuration.cpp, src/configuration.h: Changed to namespace.
+ Removed listeners. Simplified property handling. Moved to common/.
+ * src/resourcemanager.cpp, src/resourcemanager.h: Changed to namespace.
+ Removed dead code. Moved to game-server/.
+ * src/account-server/dalstorage.cpp, src/utils/stringfilter.cpp,
+ src/account-server/accounthandler.cpp, src/utils/stringfilter.h,
+ src/game-server/accountconnection.cpp: Updated to new configuration.
+ * src/scripting/script.cpp, src/game-server/mapreader.cpp,
+ src/game-server/mapmanager.cpp, src/game-server/monstermanager.cpp,
+ src/game-server/itemmanager.cpp: Updated to new resource manager.
+ * src/Makefile.am, src/account-server/main-account.cpp,
+ src/game-server/main-game.cpp: Updated.
+
2007-09-16 Guillaume Melquiond <guillaume.melquiond@gmail.com>
* src/game-server/command.cpp: Removed unused argument name.
diff --git a/src/Makefile.am b/src/Makefile.am
index 7f2dcba7..71bfd97a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -6,12 +6,8 @@ bin_PROGRAMS = tmwserv-account tmwserv-game
tmwserv_account_SOURCES = \
account-server/main-account.cpp \
- configuration.h \
- configuration.cpp \
defines.h \
point.h \
- resourcemanager.h \
- resourcemanager.cpp \
account-server/account.hpp \
account-server/account.cpp \
account-server/accountclient.hpp \
@@ -36,6 +32,8 @@ tmwserv_account_SOURCES = \
chat-server/chatchannel.cpp \
chat-server/chatchannelmanager.hpp \
chat-server/chatchannelmanager.cpp \
+ common/configuration.hpp \
+ common/configuration.cpp \
common/inventorydata.hpp \
dal/dalexcept.h \
dal/dataprovider.h \
@@ -64,16 +62,16 @@ tmwserv_account_SOURCES = \
utils/tokencollector.hpp \
utils/tokencollector.cpp \
utils/tokendispenser.hpp \
- utils/tokendispenser.cpp
+ utils/tokendispenser.cpp \
+ utils/xml.hpp \
+ utils/xml.cpp
tmwserv_game_SOURCES = \
game-server/main-game.cpp \
- configuration.h \
- configuration.cpp \
defines.h \
point.h \
- resourcemanager.h \
- resourcemanager.cpp \
+ common/configuration.hpp \
+ common/configuration.cpp \
common/inventorydata.hpp \
game-server/accountconnection.hpp \
game-server/accountconnection.cpp \
@@ -114,6 +112,8 @@ tmwserv_game_SOURCES = \
game-server/object.hpp \
game-server/quest.hpp \
game-server/quest.cpp \
+ game-server/resourcemanager.hpp \
+ game-server/resourcemanager.cpp \
game-server/spawnarea.hpp \
game-server/spawnarea.cpp \
game-server/state.hpp \
diff --git a/src/account-server/accounthandler.cpp b/src/account-server/accounthandler.cpp
index 9eb6264e..77e66660 100644
--- a/src/account-server/accounthandler.cpp
+++ b/src/account-server/accounthandler.cpp
@@ -24,7 +24,6 @@
#include "account-server/accounthandler.hpp"
#include "defines.h"
-#include "configuration.h"
#include "point.h"
#include "account-server/account.hpp"
#include "account-server/accountclient.hpp"
@@ -34,6 +33,7 @@
#include "account-server/guildmanager.hpp"
#include "account-server/serverhandler.hpp"
#include "chat-server/chathandler.hpp"
+#include "common/configuration.hpp"
#include "net/connectionhandler.hpp"
#include "net/messagein.hpp"
#include "net/messageout.hpp"
@@ -182,7 +182,7 @@ AccountHandler::handleLoginMessage(AccountClient &computer, MessageIn &msg)
int clientVersion = msg.readLong();
- if (clientVersion < config.getValue("clientVersion", 0))
+ if (clientVersion < Configuration::getValue("clientVersion", 0))
{
reply.writeByte(LOGIN_INVALID_VERSION);
computer.send(reply);
@@ -296,7 +296,7 @@ AccountHandler::handleRegisterMessage(AccountClient &computer, MessageIn &msg)
{
reply.writeByte(ERRMSG_FAILURE);
}
- else if (clientVersion < config.getValue("clientVersion", 0))
+ else if (clientVersion < Configuration::getValue("clientVersion", 0))
{
reply.writeByte(REGISTER_INVALID_VERSION);
}
@@ -392,8 +392,8 @@ AccountHandler::handleUnregisterMessage(AccountClient &computer,
}
// Delete account and associated characters
- LOG_DEBUG("Unregistered \"" << username
- << "\", AccountID: " << acc->getID());
+ LOG_INFO("Unregistered \"" << username
+ << "\", AccountID: " << acc->getID());
storage->delAccount(acc);
reply.writeByte(ERRMSG_OK);
@@ -589,9 +589,9 @@ AccountHandler::handleCharacterCreateMessage(AccountClient &computer,
newCharacter->setGender(gender);
newCharacter->setHairStyle(hairStyle);
newCharacter->setHairColor(hairColor);
- newCharacter->setMapId((int) config.getValue("defaultMap", 1));
- Point startingPos((int) config.getValue("startX", 512),
- (int) config.getValue("startY", 512));
+ newCharacter->setMapId(Configuration::getValue("defaultMap", 1));
+ Point startingPos(Configuration::getValue("startX", 512),
+ Configuration::getValue("startY", 512));
newCharacter->setPosition(startingPos);
acc->addCharacter(newCharacter);
@@ -660,9 +660,10 @@ handleCharacterSelectMessage(AccountClient &computer, MessageIn &msg)
reply.writeShort(port);
// TODO: get correct address and port for the chat server
- reply.writeString(config.getValue("accountServerAddress", "localhost"));
- reply.writeShort(int(config.getValue("accountServerPort",
- DEFAULT_SERVER_PORT)) + 2);
+ reply.writeString(Configuration::getValue("accountServerAddress",
+ "localhost"));
+ reply.writeShort(Configuration::getValue("accountServerPort",
+ DEFAULT_SERVER_PORT) + 2);
serverHandler->registerGameClient(magic_token, selectedChar);
registerChatClient(magic_token, selectedChar->getName(), AL_NORMAL);
diff --git a/src/account-server/dalstorage.cpp b/src/account-server/dalstorage.cpp
index 08b149e2..2fe9c697 100644
--- a/src/account-server/dalstorage.cpp
+++ b/src/account-server/dalstorage.cpp
@@ -25,13 +25,13 @@
#include "account-server/dalstorage.hpp"
-#include "configuration.h"
#include "point.h"
#include "account-server/account.hpp"
#include "account-server/guild.hpp"
#include "account-server/guildmanager.hpp"
#include "account-server/dalstoragesql.hpp"
#include "chat-server/chatchannel.hpp"
+#include "common/configuration.hpp"
#include "dal/dalexcept.h"
#include "dal/dataproviderfactory.h"
#include "utils/functors.h"
@@ -297,7 +297,7 @@ Character *DALStorage::getCharacterBySQL(std::string const &query, Account *owne
{
// Set character to default map and one of the default location
// Default map is to be 1, as not found return value will be 0.
- character->setMapId((int)config.getValue("defaultMap", 1));
+ character->setMapId(Configuration::getValue("defaultMap", 1));
}
/* Fill the account-related fields. Last step, as it may require a new
diff --git a/src/account-server/main-account.cpp b/src/account-server/main-account.cpp
index 68cb134b..e684cbad 100644
--- a/src/account-server/main-account.cpp
+++ b/src/account-server/main-account.cpp
@@ -28,18 +28,17 @@
#include <physfs.h>
#include <enet/enet.h>
-#if (defined __USE_UNIX98 || defined __FreeBSD__)
+#ifdef HAVE_CONFIG_H
#include "../config.h"
#endif
-#include "configuration.h"
-#include "resourcemanager.h"
#include "account-server/accounthandler.hpp"
#include "account-server/guildmanager.hpp"
#include "account-server/serverhandler.hpp"
#include "account-server/dalstorage.hpp"
#include "chat-server/chatchannelmanager.hpp"
#include "chat-server/chathandler.hpp"
+#include "common/configuration.hpp"
#include "net/connectionhandler.hpp"
#include "net/messageout.hpp"
#include "utils/logger.h"
@@ -55,8 +54,6 @@
static bool running = true; /**< Determines if server keeps running */
-Configuration config; /**< XML config reader */
-
utils::StringFilter *stringFilter; /**< Slang's Filter */
/** Database handler. */
@@ -145,7 +142,7 @@ static void initialize()
// write the messages to both the screen and the log file.
Logger::setTeeMode(true);
- config.init(configPath);
+ Configuration::initialize(configPath);
LOG_INFO("Using Config File: " << configPath);
LOG_INFO("Using Log File: " << logPath);
@@ -155,7 +152,7 @@ static void initialize()
// --- Initialize the managers
// Initialize the slang's and double quotes filter.
- stringFilter = new StringFilter(&config);
+ stringFilter = new StringFilter;
// Initialize the Chat channels manager
chatChannelManager = new ChatChannelManager;
@@ -167,9 +164,9 @@ static void initialize()
// --- Initialize the global handlers
// FIXME: Make the global handlers global vars or part of a bigger
// singleton or a local variable in the event-loop
- accountHandler = new AccountHandler();
- chatHandler = new ChatHandler();
- serverHandler = new ServerHandler();
+ accountHandler = new AccountHandler;
+ chatHandler = new ChatHandler;
+ serverHandler = new ServerHandler;
// --- Initialize enet.
if (enet_initialize() != 0) {
@@ -192,7 +189,7 @@ static void deinitialize()
{
delete stringFilter;
// Write configuration file
- config.write();
+ Configuration::deinitialize();
// Quit ENet
enet_deinitialize();
@@ -290,7 +287,7 @@ static void parseOptions(int argc, char *argv[])
// Change the port to listen on.
unsigned short portToListenOn;
portToListenOn = atoi(optarg);
- config.setValue("ListenOnPort", portToListenOn);
+ Configuration::setValue("ListenOnPort", portToListenOn);
LOG_INFO("Setting Default Port to " << portToListenOn);
break;
}
@@ -311,7 +308,7 @@ int main(int argc, char *argv[])
// General Initialization
initialize();
- int port = int(config.getValue("accountServerPort", DEFAULT_SERVER_PORT));
+ int port = Configuration::getValue("accountServerPort", DEFAULT_SERVER_PORT);
if (!accountHandler->startListen(port) ||
!serverHandler->startListen(port + 1) ||
!chatHandler->startListen(port + 2))
diff --git a/src/chat-server/chatchannelmanager.hpp b/src/chat-server/chatchannelmanager.hpp
index fe11d68f..423e94ef 100644
--- a/src/chat-server/chatchannelmanager.hpp
+++ b/src/chat-server/chatchannelmanager.hpp
@@ -24,6 +24,7 @@
#ifndef _TMWSERV_CHATCHANNELMANAGER_H_
#define _TMWSERV_CHATCHANNELMANAGER_H_
+#include <list>
#include <map>
#include "chat-server/chatchannel.hpp"
diff --git a/src/chat-server/chathandler.hpp b/src/chat-server/chathandler.hpp
index 8f460e9d..1b44772d 100644
--- a/src/chat-server/chathandler.hpp
+++ b/src/chat-server/chathandler.hpp
@@ -29,6 +29,7 @@
#include "net/connectionhandler.hpp"
#include "utils/tokencollector.hpp"
+class ChatChannel;
class ChatClient;
/**
diff --git a/src/common/configuration.cpp b/src/common/configuration.cpp
new file mode 100644
index 00000000..e230c062
--- /dev/null
+++ b/src/common/configuration.cpp
@@ -0,0 +1,122 @@
+/*
+ * The Mana World
+ * Copyright 2004 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * The Mana World is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with The Mana World; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id$
+ */
+
+#include <cmath>
+#include <map>
+#include <libxml/xmlwriter.h>
+
+#include "common/configuration.hpp"
+
+#include "utils/logger.h"
+#include "utils/xml.hpp"
+
+/**< Persistent configuration. */
+static std::map< std::string, std::string > options;
+/**< Location of config file. */
+static std::string configPath;
+
+void Configuration::initialize(std::string const &filename)
+{
+ configPath = filename;
+
+ xmlDocPtr doc = xmlReadFile(filename.c_str(), NULL, 0);
+
+ if (!doc) return;
+
+ xmlNodePtr node = xmlDocGetRootElement(doc);
+
+ if (!node || !xmlStrEqual(node->name, BAD_CAST "configuration")) {
+ LOG_WARN("No configuration file '" << filename.c_str() << "'.");
+ return;
+ }
+
+ for (node = node->xmlChildrenNode; node != NULL; node = node->next)
+ {
+ if (xmlStrEqual(node->name, BAD_CAST "option"))
+ {
+ std::string key = XML::getProperty(node, "name", "");
+ std::string value = XML::getProperty(node, "value", "");
+
+ if (!key.empty() && !value.empty())
+ {
+ options[key] = value;
+ }
+ }
+ }
+
+ xmlFreeDoc(doc);
+}
+
+void Configuration::deinitialize()
+{
+ xmlTextWriterPtr writer = xmlNewTextWriterFilename(configPath.c_str(), 0);
+
+ if (writer)
+ {
+ xmlTextWriterSetIndent(writer, 1);
+ xmlTextWriterStartDocument(writer, NULL, NULL, NULL);
+ xmlTextWriterStartElement(writer, BAD_CAST "configuration");
+
+ std::map<std::string, std::string>::iterator iter;
+
+ for (iter = options.begin(); iter != options.end(); iter++)
+ {
+ xmlTextWriterStartElement(writer, BAD_CAST "option");
+ xmlTextWriterWriteAttribute(writer,
+ BAD_CAST "name", BAD_CAST iter->first.c_str());
+ xmlTextWriterWriteAttribute(writer,
+ BAD_CAST "value", BAD_CAST iter->second.c_str());
+ xmlTextWriterEndElement(writer);
+ }
+
+ xmlTextWriterEndDocument(writer);
+ xmlFreeTextWriter(writer);
+ }
+}
+
+void Configuration::setValue(std::string const &key, std::string const &value)
+{
+ options[key] = value;
+}
+
+void Configuration::setValue(std::string const &key, int value)
+{
+ std::ostringstream ss;
+ ss << value;
+ setValue(key, ss.str());
+}
+
+std::string const &Configuration::getValue(std::string const &key,
+ std::string const &deflt)
+{
+ std::map<std::string, std::string>::iterator iter = options.find(key);
+ if (iter == options.end()) return deflt;
+ return iter->second;
+}
+
+int Configuration::getValue(std::string const &key, int deflt)
+{
+ std::map<std::string, std::string>::iterator iter = options.find(key);
+ if (iter == options.end()) return deflt;
+ return atoi(iter->second.c_str());
+}
diff --git a/src/common/configuration.hpp b/src/common/configuration.hpp
new file mode 100644
index 00000000..cbc905be
--- /dev/null
+++ b/src/common/configuration.hpp
@@ -0,0 +1,74 @@
+/*
+ * The Mana World
+ * Copyright 2004-2007 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * The Mana World is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with The Mana World; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id$
+ */
+
+#ifndef __INIREAD_H
+#define __INIREAD_H
+
+#include <string>
+
+namespace Configuration
+{
+ /**
+ * Loads the configuration options into memory.
+ * @param filename path to the configuration file .
+ */
+ void initialize(std::string const &filename);
+
+ /**
+ * Writes the current settings back to the configuration file.
+ */
+ void deinitialize();
+
+ /**
+ * Sets an option to a given value.
+ * @param key option identifier.
+ * @param value Value.
+ */
+ void setValue(std::string const &key, std::string const &value);
+
+ /**
+ * Sets an option to a given value.
+ * @param key option identifier.
+ * @param value value.
+ */
+ void setValue(std::string const &key, int value);
+
+ /**
+ * Gets an option as a string.
+ * @param key option identifier.
+ * @param deflt default value.
+ */
+ std::string const &getValue(std::string const &key, std::string const &deflt);
+
+ /**
+ * Gets an option as a string.
+ * @param key option identifier.
+ * @param deflt default value.
+ */
+ int getValue(std::string const &key, int deflt);
+}
+
+#ifndef DEFAULT_SERVER_PORT
+#define DEFAULT_SERVER_PORT 9601
+#endif
+#endif
diff --git a/src/configuration.cpp b/src/configuration.cpp
deleted file mode 100644
index 251d63a1..00000000
--- a/src/configuration.cpp
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * The Mana World
- * Copyright 2004 The Mana World Development Team
- *
- * This file is part of The Mana World.
- *
- * The Mana World is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * The Mana World is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with The Mana World; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * $Id$
- */
-
-
-#include "configuration.h"
-
-#include <cmath>
-
-#include <libxml/xmlwriter.h>
-
-#include "utils/logger.h"
-
-// MSVC libxml2 at the moment doesn't work right when using MinGW, missing this
-// function at link time.
-#ifdef WIN32
-#undef xmlFree
-#define xmlFree(x) ;
-#endif
-
-ConfigListener::~ConfigListener()
-{
-}
-
-void Configuration::init(const std::string &filename)
-{
- configPath = filename;
-
- // Do not attempt to read config from non-existant file
- FILE *testFile = fopen(configPath.c_str(), "r");
- if (!testFile) {
- return;
- }
- else {
- fclose(testFile);
- }
-
- xmlDocPtr doc = xmlReadFile(filename.c_str(), NULL, 0);
-
- if (!doc) return;
-
- xmlNodePtr node = xmlDocGetRootElement(doc);
-
- if (!node || !xmlStrEqual(node->name, BAD_CAST "configuration")) {
- LOG_WARN("Warning: No configuration file (" << filename.c_str() << ")");
- return;
- }
-
- for (node = node->xmlChildrenNode; node != NULL; node = node->next)
- {
- if (xmlStrEqual(node->name, BAD_CAST "option"))
- {
- xmlChar *name = xmlGetProp(node, BAD_CAST "name");
- xmlChar *value = xmlGetProp(node, BAD_CAST "value");
-
- if (name && value) {
- options[std::string((const char*)name)] =
- std::string((const char*)value);
- }
-
- if (name) xmlFree(name);
- if (value) xmlFree(value);
- }
- }
-
- xmlFreeDoc(doc);
-}
-
-void Configuration::write()
-{
- // Do not attempt to write to file that cannot be opened for writing
- FILE *testFile = fopen(configPath.c_str(), "w");
- if (!testFile) {
- return;
- }
- else {
- fclose(testFile);
- }
-
- xmlTextWriterPtr writer = xmlNewTextWriterFilename(configPath.c_str(), 0);
-
- if (writer)
- {
- xmlTextWriterSetIndent(writer, 1);
- xmlTextWriterStartDocument(writer, NULL, NULL, NULL);
- xmlTextWriterStartElement(writer, BAD_CAST "configuration");
-
- std::map<std::string, std::string>::iterator iter;
-
- for (iter = options.begin(); iter != options.end(); iter++)
- {
- xmlTextWriterStartElement(writer, BAD_CAST "option");
- xmlTextWriterWriteAttribute(writer,
- BAD_CAST "name", BAD_CAST iter->first.c_str());
- xmlTextWriterWriteAttribute(writer,
- BAD_CAST "value", BAD_CAST iter->second.c_str());
- xmlTextWriterEndElement(writer);
- }
-
- xmlTextWriterEndDocument(writer);
- xmlFreeTextWriter(writer);
- }
-}
-
-void Configuration::setValue(const std::string &key, std::string value)
-{
- LOG_DEBUG("Configuration::setValue(" << key << ", " << value << ")");
-
- options[key] = value;
-
- // Notify listeners
- std::map<std::string, std::list<ConfigListener*> >::iterator list =
- listeners.find(key);
-
- if (list != listeners.end()) {
- std::list<ConfigListener*>::iterator listener = (*list).second.begin();
-
- while (listener != (*list).second.end())
- {
- (*listener)->optionChanged(key);
- listener++;
- }
- }
-}
-
-void Configuration::setValue(const std::string &key, float value)
-{
- std::stringstream ss;
- if (value == floor(value)) {
- ss << (int)value;
- } else {
- ss << value;
- }
- setValue(key, ss.str());
-}
-
-std::string Configuration::getValue(const std::string &key, std::string deflt)
-{
- std::map<std::string, std::string>::iterator iter = options.find(key);
- if (iter != options.end()) {
- return (*iter).second;
- }
- return deflt;
-}
-
-float Configuration::getValue(const std::string &key, float deflt)
-{
- std::map<std::string, std::string>::iterator iter = options.find(key);
- if (iter != options.end()) {
- return atof((*iter).second.c_str());
- }
- return deflt;
-}
-
-void Configuration::addListener(
- const std::string &key, ConfigListener *listener)
-{
- listeners[key].push_front(listener);
-}
-
-void Configuration::removeListener(
- const std::string &key, ConfigListener *listener)
-{
- std::list<ConfigListener*>::iterator i = listeners[key].begin();
-
- while (i != listeners[key].end())
- {
- if ((*i) == listener) {
- listeners[key].erase(i);
- return;
- }
- i++;
- }
-}
diff --git a/src/configuration.h b/src/configuration.h
deleted file mode 100644
index df64ee85..00000000
--- a/src/configuration.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * The Mana World
- * Copyright 2004 The Mana World Development Team
- *
- * This file is part of The Mana World.
- *
- * The Mana World is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * The Mana World is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with The Mana World; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * $Id$
- */
-
-#ifndef __INIREAD_H
-#define __INIREAD_H
-
-#include <map>
-#include <list>
-#include <string>
-
-
-/**
- * The listener interface for receiving notifications about changes to
- * configuration options.
- *
- * \ingroup CORE
- */
-class ConfigListener
-{
- public:
- /**
- * Destructor.
- */
- virtual ~ConfigListener();
-
- /**
- * Called when an option changed. The config listener will have to be
- * registered to the option name first.
- */
- virtual void optionChanged(const std::string &name) = 0;
-};
-
-/**
- * INI configuration handler for reading (and writing).
- *
- * \ingroup CORE
- */
-class Configuration
-{
- public:
- /**
- * \brief Reads INI file and parse all options into memory.
- * \param filename Full path to INI file (~/.manaworld/tmw.ini)
- */
- void init(const std::string &filename);
-
- /**
- * \brief Writes the current settings back to an ini-file.
- * \param filename Full path to INI file (~/.manaworld/tmw.ini)
- */
- void write();
-
- /**
- * \brief Sets an option using a string value.
- * \param key Option identifier.
- * \param value Value.
- */
- void setValue(const std::string &key, std::string value);
-
- /**
- * \brief Sets an option using a numeric value.
- * \param key Option identifier.
- * \param value Value.
- */
- void setValue(const std::string &key, float value);
-
- /**
- * \brief Gets a value as string.
- * \param key Option identifier.
- * \param deflt Default option if not there or error.
- */
- std::string getValue(const std::string &key, std::string deflt);
-
- /**
- * \brief Gets a value as numeric (float).
- * \param key Option identifier.
- * \param deflt Default option if not there or error.
- */
- float getValue(const std::string &key, float deflt);
-
- /**
- * Adds a listener to the listen list of the specified config option.
- */
- void addListener(const std::string &key, ConfigListener *listener);
-
- /**
- * Removes a listener from the listen list of the specified config
- * option.
- */
- void removeListener(const std::string &key, ConfigListener *listener);
-
- private:
- std::map<std::string, std::string> options;
- std::map<std::string, std::list<ConfigListener*> > listeners;
-
- std::string configPath; /**< Location of config file */
-};
-
-extern Configuration config;
-
-#ifndef DEFAULT_SERVER_PORT
-#define DEFAULT_SERVER_PORT 9601
-#endif
-#endif
diff --git a/src/game-server/accountconnection.cpp b/src/game-server/accountconnection.cpp
index 4219b33d..a07230eb 100644
--- a/src/game-server/accountconnection.cpp
+++ b/src/game-server/accountconnection.cpp
@@ -23,8 +23,8 @@
#include "game-server/accountconnection.hpp"
-#include "configuration.h"
#include "defines.h"
+#include "common/configuration.hpp"
#include "game-server/character.hpp"
#include "game-server/gamehandler.hpp"
#include "game-server/map.hpp"
@@ -41,15 +41,16 @@
bool AccountConnection::start()
{
- if (!Connection::start(config.getValue("accountServerAddress", "localhost"),
- int(config.getValue("accountServerPort", DEFAULT_SERVER_PORT)) + 1))
+ if (!Connection::start(
+ Configuration::getValue("accountServerAddress", "localhost"),
+ Configuration::getValue("accountServerPort", DEFAULT_SERVER_PORT) + 1))
{
return false;
}
LOG_INFO("Connection established to the account server.");
MessageOut msg(GAMSG_REGISTER);
- msg.writeString(config.getValue("gameServerAddress", "localhost"));
- msg.writeShort(int(config.getValue("gameServerPort", DEFAULT_SERVER_PORT + 3)));
+ msg.writeString(Configuration::getValue("gameServerAddress", "localhost"));
+ msg.writeShort(Configuration::getValue("gameServerPort", DEFAULT_SERVER_PORT + 3));
MapManager::Maps const &m = MapManager::getMaps();
for (MapManager::Maps::const_iterator i = m.begin(), i_end = m.end(); i != i_end; ++i)
{
diff --git a/src/game-server/itemmanager.cpp b/src/game-server/itemmanager.cpp
index 232d427b..93906e6d 100644
--- a/src/game-server/itemmanager.cpp
+++ b/src/game-server/itemmanager.cpp
@@ -26,8 +26,8 @@
#include "game-server/itemmanager.hpp"
#include "defines.h"
-#include "resourcemanager.h"
#include "game-server/item.hpp"
+#include "game-server/resourcemanager.hpp"
#include "utils/logger.h"
#include "utils/xml.hpp"
@@ -43,9 +43,8 @@ void ItemManager::initialize(std::string const &file)
void ItemManager::reload()
{
- ResourceManager *resman = ResourceManager::getInstance();
int size;
- char *data = (char *)resman->loadFile(itemReferenceFile, size);
+ char *data = ResourceManager::loadFile(itemReferenceFile, size);
if (!data) {
LOG_ERROR("Item Manager: Could not find " << itemReferenceFile << "!");
diff --git a/src/game-server/main-game.cpp b/src/game-server/main-game.cpp
index db8fee45..b84bcd53 100644
--- a/src/game-server/main-game.cpp
+++ b/src/game-server/main-game.cpp
@@ -27,17 +27,17 @@
#include <physfs.h>
#include <enet/enet.h>
-#if (defined __USE_UNIX98 || defined __FreeBSD__)
+#ifdef HAVE_CONFIG_H
#include "../config.h"
#endif
-#include "configuration.h"
-#include "resourcemanager.h"
+#include "common/configuration.hpp"
#include "game-server/accountconnection.hpp"
#include "game-server/gamehandler.hpp"
#include "game-server/itemmanager.hpp"
#include "game-server/mapmanager.hpp"
#include "game-server/monstermanager.hpp"
+#include "game-server/resourcemanager.hpp"
#include "game-server/state.hpp"
#include "net/connectionhandler.hpp"
#include "net/messageout.hpp"
@@ -58,8 +58,6 @@ utils::Timer worldTimer(100, false); /**< Timer for world tics set to 100 ms *
int worldTime = 0; /**< Current world time in 100ms ticks */
bool running = true; /**< Determines if server keeps running */
-Configuration config; /**< XML config reader */
-
utils::StringFilter *stringFilter; /**< Slang's Filter */
/** Core game message handler */
@@ -69,7 +67,7 @@ GameHandler *gameHandler;
AccountConnection *accountHandler;
/** Callback used when SIGQUIT signal is received. */
-void closeGracefully(int dummy)
+void closeGracefully(int)
{
running = false;
}
@@ -132,14 +130,15 @@ void initialize()
// Write the messages to both the screen and the log file.
Logger::setTeeMode(true);
- config.init(configPath);
+ Configuration::initialize(configPath);
LOG_INFO("Using config file: " << configPath);
LOG_INFO("Using log file: " << logPath);
// --- Initialize the managers
// Initialize the slang's and double quotes filter.
- stringFilter = new StringFilter(&config);
+ stringFilter = new StringFilter;
+ ResourceManager::initialize();
MapManager::initialize(DEFAULT_MAPSDB_FILE);
ItemManager::initialize(DEFAULT_ITEMSDB_FILE);
MonsterManager::initialize(DEFAULT_MONSTERSDB_FILE);
@@ -147,8 +146,8 @@ void initialize()
// --- Initialize the global handlers
// FIXME: Make the global handlers global vars or part of a bigger
// singleton or a local variable in the event-loop
- gameHandler = new GameHandler();
- accountHandler = new AccountConnection();
+ gameHandler = new GameHandler;
+ accountHandler = new AccountConnection;
// --- Initialize enet.
if (enet_initialize() != 0) {
@@ -176,7 +175,7 @@ void initialize()
void deinitialize()
{
// Write configuration file
- config.write();
+ Configuration::deinitialize();
// Stop world timer
worldTimer.stop();
@@ -246,7 +245,7 @@ void parseOptions(int argc, char *argv[])
// Change the port to listen on.
unsigned short portToListenOn;
portToListenOn = atoi(optarg);
- config.setValue("gameServerPort", portToListenOn);
+ Configuration::setValue("gameServerPort", portToListenOn);
LOG_INFO("Setting default port to " << portToListenOn);
break;
}
@@ -275,7 +274,7 @@ int main(int argc, char *argv[])
}
int gameServerPort =
- (int) config.getValue("gameServerPort", DEFAULT_SERVER_PORT + 3);
+ Configuration::getValue("gameServerPort", DEFAULT_SERVER_PORT + 3);
if (!gameHandler->startListen(gameServerPort))
{
diff --git a/src/game-server/mapmanager.cpp b/src/game-server/mapmanager.cpp
index 713bd2cf..de752c00 100644
--- a/src/game-server/mapmanager.cpp
+++ b/src/game-server/mapmanager.cpp
@@ -23,11 +23,12 @@
#include <cassert>
-#include "resourcemanager.h"
+#include "game-server/mapmanager.hpp"
+
#include "game-server/map.hpp"
#include "game-server/mapcomposite.hpp"
-#include "game-server/mapmanager.hpp"
#include "game-server/mapreader.hpp"
+#include "game-server/resourcemanager.hpp"
#include "utils/logger.h"
#include "utils/xml.hpp"
@@ -43,9 +44,8 @@ MapManager::Maps const &MapManager::getMaps()
void MapManager::initialize(std::string const &mapReferenceFile)
{
- ResourceManager *resman = ResourceManager::getInstance();
int size;
- char *data = (char *)resman->loadFile(mapReferenceFile, size);
+ char *data = ResourceManager::loadFile(mapReferenceFile, size);
if (!data) {
LOG_ERROR("Map Manager: Could not find " << mapReferenceFile << "!");
@@ -117,8 +117,7 @@ void MapManager::raiseActive(int mapId)
}
std::string file = "maps/" + composite->getName() + ".tmx";
- ResourceManager *resman = ResourceManager::getInstance();
- if (!resman->exists(file))
+ if (!ResourceManager::exists(file))
{
file += ".gz";
}
diff --git a/src/game-server/mapreader.cpp b/src/game-server/mapreader.cpp
index 9c062cb5..f961efd2 100644
--- a/src/game-server/mapreader.cpp
+++ b/src/game-server/mapreader.cpp
@@ -21,12 +21,13 @@
* $Id$
*/
-#include "resourcemanager.h"
+#include "game-server/mapreader.hpp"
+
#include "game-server/map.hpp"
#include "game-server/mapcomposite.hpp"
#include "game-server/mapmanager.hpp"
-#include "game-server/mapreader.hpp"
#include "game-server/monstermanager.hpp"
+#include "game-server/resourcemanager.hpp"
#include "game-server/spawnarea.hpp"
#include "game-server/trigger.hpp"
#include "scripting/script.hpp"
@@ -43,10 +44,8 @@ static void setTileWithGid(Map *map, int x, int y, int gid);
void MapReader::readMap(const std::string &filename, MapComposite *composite)
{
- // Load the file through resource manager.
- ResourceManager *resman = ResourceManager::getInstance();
int fileSize;
- char *buffer = (char *)resman->loadFile(filename, fileSize);
+ char *buffer = ResourceManager::loadFile(filename, fileSize);
if (buffer == NULL)
{
diff --git a/src/game-server/monstermanager.cpp b/src/game-server/monstermanager.cpp
index 31c00ad0..7a25b6ae 100644
--- a/src/game-server/monstermanager.cpp
+++ b/src/game-server/monstermanager.cpp
@@ -26,9 +26,9 @@
#include "game-server/monstermanager.hpp"
#include "defines.h"
-#include "resourcemanager.h"
#include "game-server/itemmanager.hpp"
#include "game-server/monster.hpp"
+#include "game-server/resourcemanager.hpp"
#include "utils/logger.h"
#include "utils/xml.hpp"
@@ -44,9 +44,8 @@ void MonsterManager::initialize(std::string const &file)
void MonsterManager::reload()
{
- ResourceManager *resman = ResourceManager::getInstance();
int size;
- char *data = (char *)resman->loadFile(monsterReferenceFile, size);
+ char *data = ResourceManager::loadFile(monsterReferenceFile, size);
if (!data) {
LOG_ERROR("Monster Manager: Could not find "
diff --git a/src/resourcemanager.cpp b/src/game-server/resourcemanager.cpp
index f40fc232..f274ded8 100644
--- a/src/resourcemanager.cpp
+++ b/src/game-server/resourcemanager.cpp
@@ -1,6 +1,6 @@
/*
* The Mana World
- * Copyright 2004 The Mana World Development Team
+ * Copyright 2004-2007 The Mana World Development Team
*
* This file is part of The Mana World.
*
@@ -21,13 +21,7 @@
* $Id$
*/
-#include "resourcemanager.h"
-
-#include <physfs.h>
-
-#include "utils/logger.h"
-
-#ifdef WIN32
+#ifdef _WIN32
#include <io.h>
#include <direct.h>
#else
@@ -35,39 +29,15 @@
#include <dirent.h>
#endif
-#define TMWSERV_DATADIR ""
-
-ResourceManager *ResourceManager::instance = NULL;
-
-ResourceManager::ResourceManager()
-{
- // Add zip files to PhysicsFS
- searchAndAddZipFiles();
-}
+#include <physfs.h>
-ResourceManager::~ResourceManager()
-{
-}
+#include "game-server/resourcemanager.hpp"
-ResourceManager*
-ResourceManager::getInstance()
-{
- // Create a new instance if necessary.
- if (instance == NULL) instance = new ResourceManager();
- return instance;
-}
+#include "utils/logger.h"
-void
-ResourceManager::deleteInstance()
-{
- if (instance != NULL) {
- delete instance;
- instance = NULL;
- }
-}
+#define TMWSERV_DATADIR ""
-void
-ResourceManager::searchAndAddZipFiles()
+void ResourceManager::initialize()
{
PHYSFS_permitSymbolicLinks(1);
// Add the main data directory to our PhysicsFS search path
@@ -144,22 +114,16 @@ bool ResourceManager::exists(std::string const &path)
return PHYSFS_exists(path.c_str());
}
-void*
-ResourceManager::loadFile(const std::string &fileName, int &fileSize)
+char *ResourceManager::loadFile(std::string const &fileName, int &fileSize)
{
- // If the file doesn't exist indicate failure
- if (!exists(fileName))
- {
- LOG_WARN("Warning: " << fileName << " not found!");
- return NULL;
- }
-
// Attempt to open the specified file using PhysicsFS
PHYSFS_file* file = PHYSFS_openRead(fileName.c_str());
// If the handler is an invalid pointer indicate failure
- if (file == NULL) {
- LOG_WARN("Warning: " << fileName << " failed to load!");
+ if (file == NULL)
+ {
+ LOG_WARN("Failed to load '" << fileName << "': "
+ << PHYSFS_getLastError());
return NULL;
}
@@ -167,38 +131,19 @@ ResourceManager::loadFile(const std::string &fileName, int &fileSize)
fileSize = PHYSFS_fileLength(file);
// Allocate memory and load the file
- void *buffer = malloc(fileSize + 1);
- PHYSFS_read(file, buffer, 1, fileSize);
+ char *buffer = (char *)malloc(fileSize + 1);
+ if (PHYSFS_read(file, buffer, 1, fileSize) != fileSize)
+ {
+ free(buffer);
+ LOG_WARN("Failed to load '" << fileName << "': "
+ << PHYSFS_getLastError());
+ return NULL;
+ }
// Close the file and let the user deallocate the memory
PHYSFS_close(file);
// Add a trailing nul character, so that the file can be used as a string
- ((char *)buffer)[fileSize] = 0;
+ buffer[fileSize] = 0;
return buffer;
}
-
-std::vector<std::string>
-ResourceManager::loadTextFile(const std::string &fileName)
-{
- int contentsLength;
- char *fileContents = (char*)loadFile(fileName, contentsLength);
- std::vector<std::string> lines;
-
- if (!fileContents)
- {
- LOG_ERROR("Couldn't load text file: " << fileName);
- return lines;
- }
-
- // Tokenize and add each line separately
- char *line = strtok(fileContents, "\n");
- while (line != NULL)
- {
- lines.push_back(line);
- line = strtok(NULL, "\n");
- }
-
- free(fileContents);
- return lines;
-}
diff --git a/src/game-server/resourcemanager.hpp b/src/game-server/resourcemanager.hpp
new file mode 100644
index 00000000..ac4ed1c8
--- /dev/null
+++ b/src/game-server/resourcemanager.hpp
@@ -0,0 +1,55 @@
+/*
+ * The Mana World
+ * Copyright 2004-2007 The Mana World Development Team
+ *
+ * This file is part of The Mana World.
+ *
+ * The Mana World is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * The Mana World is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with The Mana World; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * $Id$
+ */
+
+#ifndef _TMW_RESOURCE_MANAGER_H
+#define _TMW_RESOURCE_MANAGER_H
+
+#include <string>
+
+namespace ResourceManager
+{
+ /**
+ * Searches for zip files and adds them to PhysFS search path.
+ */
+ void initialize();
+
+ /**
+ * Checks whether the given file or directory exists in the search path
+ */
+ bool exists(std::string const &path);
+
+ /**
+ * Allocates data into a buffer pointer for raw data loading. The
+ * returned data is expected to be freed using <code>free()</code>.
+ *
+ * @param fileName The name of the file to be loaded.
+ * @param fileSize The size of the file that was loaded.
+ *
+ * @return An allocated byte array containing the data that was loaded,
+ * or <code>NULL</code> on failure.
+ * @note The array contains an extra \0 character at position fileSize.
+ */
+ char *loadFile(std::string const &fileName, int &fileSize);
+}
+
+#endif
diff --git a/src/resourcemanager.h b/src/resourcemanager.h
deleted file mode 100644
index 0eb79c8d..00000000
--- a/src/resourcemanager.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * The Mana World
- * Copyright 2004 The Mana World Development Team
- *
- * This file is part of The Mana World.
- *
- * The Mana World is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * any later version.
- *
- * The Mana World is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with The Mana World; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * $Id$
- */
-
-#ifndef _TMW_RESOURCE_MANAGER_H
-#define _TMW_RESOURCE_MANAGER_H
-
-#include <iosfwd>
-#include <vector>
-
-/**
- * A class for loading and managing resources.
- */
-class ResourceManager
-{
- public:
- /**
- * Constructor.
- */
- ResourceManager();
-
- /**
- * Destructor.
- */
- ~ResourceManager();
-
- /**
- * Checks whether the given file or directory exists in the search path
- */
- bool exists(std::string const &path);
-
- /**
- * Allocates data into a buffer pointer for raw data loading. The
- * returned data is expected to be freed using <code>free()</code>.
- *
- * @param fileName The name of the file to be loaded.
- * @param fileSize The size of the file that was loaded.
- *
- * @return An allocated byte array containing the data that was loaded,
- * or <code>NULL</code> on fail.
- */
- void*
- loadFile(const std::string &fileName, int &fileSize);
-
- /**
- * Retrieves the contents of a text file.
- */
- std::vector<std::string>
- loadTextFile(const std::string &fileName);
-
- /**
- * Returns an instance of the class, creating one if it does not
- * already exist.
- */
- static ResourceManager*
- getInstance();
-
- /**
- * Deletes the class instance if it exists.
- */
- static void
- deleteInstance();
-
- private:
- /**
- * Searches for zip files and adds them to the PhysicsFS search path.
- */
- void
- searchAndAddZipFiles();
-
- static ResourceManager *instance;
-};
-
-#endif
diff --git a/src/scripting/script.cpp b/src/scripting/script.cpp
index 9666b213..59faaf62 100644
--- a/src/scripting/script.cpp
+++ b/src/scripting/script.cpp
@@ -25,7 +25,7 @@
#include "scripting/script.hpp"
-#include "resourcemanager.h"
+#include "game-server/resourcemanager.hpp"
#include "utils/logger.h"
typedef std::map< std::string, Script::Factory > Engines;
@@ -67,9 +67,8 @@ void Script::update()
void Script::loadFile(std::string const &name)
{
- ResourceManager *resman = ResourceManager::getInstance();
int size;
- char *buffer = (char *)resman->loadFile(name, size);
+ char *buffer = ResourceManager::loadFile(name, size);
if (buffer)
{
load(buffer);
diff --git a/src/utils/stringfilter.cpp b/src/utils/stringfilter.cpp
index ba1f1b99..aa94cde2 100644
--- a/src/utils/stringfilter.cpp
+++ b/src/utils/stringfilter.cpp
@@ -20,19 +20,17 @@
* $Id$
*/
-#include "stringfilter.h"
+#include "utils/stringfilter.h"
-#include "logger.h"
-
-#include "../configuration.h"
-#include "../defines.h"
+#include "defines.h"
+#include "common/configuration.hpp"
+#include "utils/logger.h"
namespace utils
{
-StringFilter::StringFilter(Configuration *config):
- mInitialized(false),
- mConfig(config)
+StringFilter::StringFilter():
+ mInitialized(false)
{
mSlangs.clear(); // Does this make any sense here?
loadSlangFilterList();
@@ -48,7 +46,7 @@ bool StringFilter::loadSlangFilterList()
{
mInitialized = false;
- std::string slangsList = mConfig->getValue("SlangsList", "");
+ std::string slangsList = Configuration::getValue("SlangsList", "");
if (slangsList != "") {
std::istringstream iss(slangsList);
std::string tmp;
diff --git a/src/utils/stringfilter.h b/src/utils/stringfilter.h
index 5002ca1e..ff29db21 100644
--- a/src/utils/stringfilter.h
+++ b/src/utils/stringfilter.h
@@ -27,8 +27,6 @@
#include <list>
#include <string>
-class Configuration;
-
namespace utils
{
@@ -41,7 +39,7 @@ class StringFilter
/**
* ctors.
*/
- StringFilter(Configuration *config);
+ StringFilter();
~StringFilter();
@@ -89,7 +87,6 @@ class StringFilter
typedef Slangs::iterator SlangIterator;
Slangs mSlangs; /**< the formatted Slangs list */
bool mInitialized; /**< Set if the list is loaded */
- Configuration *mConfig; /**< The config instance */
};
} // ::utils