summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/actorsprite.cpp14
-rw-r--r--src/being.cpp2
-rw-r--r--src/resources/colordb.cpp8
-rw-r--r--src/resources/theme.cpp2
-rw-r--r--src/utils/xml.h4
5 files changed, 19 insertions, 11 deletions
diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp
index 8dc873da..17e6b3d2 100644
--- a/src/actorsprite.cpp
+++ b/src/actorsprite.cpp
@@ -21,6 +21,7 @@
#include "actorsprite.h"
#include "client.h"
+#include "configuration.h"
#include "event.h"
#include "game.h"
#include "imagesprite.h"
@@ -323,7 +324,7 @@ void ActorSprite::setupSpriteDisplay(const SpriteDisplay &display,
for (it = display.sprites.begin(), it_end = display.sprites.end();
it != it_end; it++)
{
- std::string file = "graphics/sprites/" + (*it)->sprite;
+ std::string file = paths.getStringValue("sprites") + (*it)->sprite;
int variant = (*it)->variant;
addSprite(AnimatedSprite::load(file, variant));
}
@@ -332,15 +333,20 @@ void ActorSprite::setupSpriteDisplay(const SpriteDisplay &display,
if (size() == 0 && forceDisplay)
{
if (display.image.empty())
- addSprite(AnimatedSprite::load("graphics/sprites/error.xml"));
+ {
+ addSprite(AnimatedSprite::load(paths.getStringValue("sprites")
+ + paths.getStringValue("spriteErrorFile")));
+ }
else
{
ResourceManager *resman = ResourceManager::getInstance();
- std::string imagePath = "graphics/items/" + display.image;
+ std::string imagePath = paths.getStringValue("itemIcons")
+ + display.image;
Image *img = resman->getImage(imagePath);
if (!img)
- img = Theme::getImageFromTheme("unknown-item.png");
+ img = Theme::getImageFromTheme(
+ paths.getStringValue("unknownItemFile"));
addSprite(new ImageSprite(img));
}
diff --git a/src/being.cpp b/src/being.cpp
index 04cd6719..2747b87d 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -66,8 +66,6 @@
#include <cassert>
#include <cmath>
-#define HAIR_FILE "hair.xml"
-
int Being::mNumberOfHairstyles = 1;
Being::Being(int id, Type type, int subtype, Map *map):
diff --git a/src/resources/colordb.cpp b/src/resources/colordb.cpp
index c35a5660..d0b46b4e 100644
--- a/src/resources/colordb.cpp
+++ b/src/resources/colordb.cpp
@@ -38,18 +38,18 @@ void ColorDB::load()
if (mLoaded)
unload();
- XML::Document *doc = new XML::Document("hair.xml");
+ XML::Document *doc = new XML::Document(HAIR_XML_FILE);
xmlNodePtr root = doc->rootNode();
bool hairXml = true;
if (!root || !xmlStrEqual(root->name, BAD_CAST "colors"))
{
- logger->log("Trying to fall back on colors.xml");
+ logger->log("Trying to fall back on " COLORS_XML_FILE);
hairXml = false;
delete doc;
- doc = new XML::Document("colors.xml");
+ doc = new XML::Document(COLORS_XML_FILE);
root = doc->rootNode();
if (!root || !xmlStrEqual(root->name, BAD_CAST "colors"))
@@ -101,7 +101,7 @@ std::string &ColorDB::get(int id)
if (i == mColors.end())
{
- logger->log("ColorDB: Error, unknown dye ID# %d", id);
+ logger->log("ColorDB: Error, unknown dye Id# %d", id);
return mFail;
}
else
diff --git a/src/resources/theme.cpp b/src/resources/theme.cpp
index 869f225c..20573618 100644
--- a/src/resources/theme.cpp
+++ b/src/resources/theme.cpp
@@ -536,7 +536,7 @@ void Theme::loadColors(std::string file)
if (file == "")
file = defaultThemePath;
- file += "/colors.xml";
+ file += "/" COLORS_XML_FILE;
XML::Document doc(file);
xmlNodePtr root = doc.rootNode();
diff --git a/src/utils/xml.h b/src/utils/xml.h
index 48e66787..8b7fd043 100644
--- a/src/utils/xml.h
+++ b/src/utils/xml.h
@@ -26,6 +26,10 @@
#include <string>
+// Define commonly used xml file
+#define HAIR_XML_FILE "hair.xml"
+#define COLORS_XML_FILE "colors.xml"
+
/**
* XML helper functions.
*/