diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-05-24 18:18:51 +0200 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-05-24 18:18:51 +0200 |
commit | 509d0a5cd64e37c5f6397ce20b4aef877b604e18 (patch) | |
tree | 0c98b29338211001afdb4b49e41c19fcc4234688 /src/common/configuration.cpp | |
parent | 5a401a833d9807a257331f49a8a8ba9768a12655 (diff) | |
download | manaserv-509d0a5cd64e37c5f6397ce20b4aef877b604e18.tar.gz manaserv-509d0a5cd64e37c5f6397ce20b4aef877b604e18.tar.bz2 manaserv-509d0a5cd64e37c5f6397ce20b4aef877b604e18.tar.xz manaserv-509d0a5cd64e37c5f6397ce20b4aef877b604e18.zip |
Stopped tmwserv from writing to its configuration file
This was confusing, since changes made to the config file while the
server is running are lost once the server exists. Also, XML comments
were being stripped by the server.
The command line option to set the port now only applies to a single
run, and isn't saved in the configuration. There shouldn't be a need for
the server to write to its configuration file, it might not even have
the rights to do so.
Diffstat (limited to 'src/common/configuration.cpp')
-rw-r--r-- | src/common/configuration.cpp | 37 |
1 files changed, 1 insertions, 36 deletions
diff --git a/src/common/configuration.cpp b/src/common/configuration.cpp index 4b52b65e..e749af88 100644 --- a/src/common/configuration.cpp +++ b/src/common/configuration.cpp @@ -21,7 +21,7 @@ #include <cmath> #include <map> -#include <libxml/xmlwriter.h> +#include <libxml/xmlreader.h> #include "common/configuration.hpp" @@ -67,41 +67,6 @@ void Configuration::initialize(const std::string &filename) 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(const std::string &key, const std::string &value) -{ - options[key] = value; -} - -void Configuration::setValue(const std::string &key, int value) -{ - std::ostringstream ss; - ss << value; - setValue(key, ss.str()); } const std::string &Configuration::getValue(const std::string &key, |