summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-08-25 17:35:44 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-08-25 17:35:44 +0000
commit529ba0581833b05921d8dc3336b02a3c6abd511a (patch)
tree0fe12ba22ffef75d2e0ab5729fa86dd48bbbf20b /src
parent9c5199501633ba0e032035a20ef7b9b8e09585cd (diff)
downloadmana-client-529ba0581833b05921d8dc3336b02a3c6abd511a.tar.gz
mana-client-529ba0581833b05921d8dc3336b02a3c6abd511a.tar.bz2
mana-client-529ba0581833b05921d8dc3336b02a3c6abd511a.tar.xz
mana-client-529ba0581833b05921d8dc3336b02a3c6abd511a.zip
Fixed line length in ChangeLog and some other small changes.
Diffstat (limited to 'src')
-rw-r--r--src/configuration.cpp19
-rw-r--r--src/configuration.h24
-rw-r--r--src/resources/image.cpp2
-rw-r--r--src/resources/resourcemanager.cpp13
4 files changed, 25 insertions, 33 deletions
diff --git a/src/configuration.cpp b/src/configuration.cpp
index e8e673b3..5e21ee5a 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -24,23 +24,17 @@
#include "configuration.h"
-#include <math.h>
#include <sstream>
#include <libxml/xmlwriter.h>
-#ifdef __DEBUG
-#include <iostream>
-#endif
-
#include "configlistener.h"
#include "log.h"
-void Configuration::init(const std::string &filename)
+void Configuration::init(const std::string &filename):
+ mConfigPath(filename)
{
- configPath = filename;
-
// Do not attempt to read config from non-existant file
- FILE *testFile = fopen(configPath.c_str(), "r");
+ FILE *testFile = fopen(filename.c_str(), "r");
if (!testFile) {
return;
}
@@ -82,7 +76,7 @@ void Configuration::init(const std::string &filename)
void Configuration::write()
{
// Do not attempt to write to file that cannot be opened for writing
- FILE *testFile = fopen(configPath.c_str(), "w");
+ FILE *testFile = fopen(mConfigPath.c_str(), "w");
if (!testFile) {
return;
}
@@ -90,7 +84,7 @@ void Configuration::write()
fclose(testFile);
}
- xmlTextWriterPtr writer = xmlNewTextWriterFilename(configPath.c_str(), 0);
+ xmlTextWriterPtr writer = xmlNewTextWriterFilename(mConfigPath.c_str(), 0);
if (writer)
{
@@ -120,9 +114,6 @@ void Configuration::write()
void Configuration::setValue(const std::string &key, std::string value)
{
-#ifdef __DEBUG
- std::cout << "Configuration::setValue(" << key << ", " << value << ")\n";
-#endif
options[key] = value;
// Notify listeners
diff --git a/src/configuration.h b/src/configuration.h
index f1e47aae..d2f44dca 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -31,7 +31,7 @@
class ConfigListener;
/**
- * INI configuration handler for reading (and writing).
+ * Configuration handler for reading (and writing).
*
* \ingroup CORE
*/
@@ -39,40 +39,44 @@ class Configuration
{
public:
/**
- * \brief Reads INI file and parse all options into memory.
- * \param filename Full path to INI file (~/.manaworld/tmw.ini)
+ * Reads config file and parse all options into memory.
+ *
+ * \param filename path to config file
*/
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)
+ * Writes the current settings back to the config file.
*/
void write();
/**
- * \brief Sets an option using a string value.
+ * 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.
+ * 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.
+ * 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).
+ * Gets a value as numeric (float).
+ *
* \param key Option identifier.
* \param deflt Default option if not there or error.
*/
@@ -93,7 +97,7 @@ class Configuration
std::map<std::string, std::string> options;
std::map<std::string, std::list<ConfigListener*> > listeners;
- std::string configPath; /**< Location of config file */
+ std::string mConfigPath; /**< Location of config file */
};
extern Configuration config;
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index a468bb30..5ea45842 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -70,7 +70,7 @@ Image* Image::load(void* buffer, unsigned int bufferSize)
SDL_RWops *rw = SDL_RWFromMem(buffer, bufferSize);
// Use SDL_Image to load the raw image data and have it free the data
- SDL_Surface* tmpImage = IMG_Load_RW(rw, 1);
+ SDL_Surface *tmpImage = IMG_Load_RW(rw, 1);
if (tmpImage == NULL) {
logger->log("Error, image load failed");
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 8f26cf5c..b443c715 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -26,11 +26,6 @@
#include <cassert>
#include <physfs.h>
-#ifdef WIN32
-#include <io.h>
-#include <direct.h>
-#endif
-
#include "image.h"
#include "music.h"
#include "soundeffect.h"
@@ -83,10 +78,12 @@ void ResourceManager::searchAndAddArchives(
const char *dirSep = PHYSFS_getDirSeparator();
char **list = PHYSFS_enumerateFiles(path.c_str());
- for (char **i = list; *i != NULL; i++) {
+ for (char **i = list; *i != NULL; i++)
+ {
size_t len = strlen(*i);
- if (len > ext.length() && !ext.compare((*i)+(len - ext.length()))) {
+ if (len > ext.length() && !ext.compare((*i)+(len - ext.length())))
+ {
std::string file, realPath, archive;
file = path + "/" + (*i);
@@ -245,7 +242,7 @@ ResourceManager::loadFile(const std::string &fileName, int &fileSize)
}
// Attempt to open the specified file using PhysicsFS
- PHYSFS_file* file = PHYSFS_openRead(fileName.c_str());
+ PHYSFS_file *file = PHYSFS_openRead(fileName.c_str());
// If the handler is an invalid pointer indicate failure
if (file == NULL) {