summaryrefslogtreecommitdiff
path: root/src/resources/colordb.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-05-14 19:31:41 +0200
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-05-14 19:34:17 +0200
commite0eeaef318d63ae79522c1d0407e4f5b8212c5f7 (patch)
tree33d755077c65b118174f51046c4967fba9863da3 /src/resources/colordb.cpp
parent3591c264f14edf300e7d3ea20577c517a092cf50 (diff)
downloadmana-e0eeaef318d63ae79522c1d0407e4f5b8212c5f7.tar.gz
mana-e0eeaef318d63ae79522c1d0407e4f5b8212c5f7.tar.bz2
mana-e0eeaef318d63ae79522c1d0407e4f5b8212c5f7.tar.xz
mana-e0eeaef318d63ae79522c1d0407e4f5b8212c5f7.zip
Fixed the fallback on colors.xml to be more neutral
There is no need to separate these projects more than necessary. Also fixed a bug that made the hair always white.
Diffstat (limited to 'src/resources/colordb.cpp')
-rw-r--r--src/resources/colordb.cpp19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/resources/colordb.cpp b/src/resources/colordb.cpp
index 12806f8e..e5377aa6 100644
--- a/src/resources/colordb.cpp
+++ b/src/resources/colordb.cpp
@@ -27,9 +27,6 @@
#include <libxml/tree.h>
-#define HAIR_COLOR_FILE "hair.xml"
-#define AE_COLOR_FILE "colors.xml"
-
namespace
{
ColorDB::Colors mColors;
@@ -42,20 +39,20 @@ void ColorDB::load()
if (mLoaded)
return;
- XML::Document *doc = new XML::Document(HAIR_COLOR_FILE);
+ XML::Document *doc = new XML::Document("hair.xml");
xmlNodePtr root = doc->rootNode();
- bool TMWHair = false;
+ bool hairXml = true;
if (!root || !xmlStrEqual(root->name, BAD_CAST "colors"))
{
- logger->log("Trying Aethyra's color file, %s.", AE_COLOR_FILE);
+ logger->log("Trying to fall back on colors.xml");
- TMWHair = true;
+ hairXml = false;
delete doc;
-
- doc = new XML::Document(AE_COLOR_FILE);
+ doc = new XML::Document("colors.xml");
root = doc->rootNode();
+
if (!root || !xmlStrEqual(root->name, BAD_CAST "colors"))
{
logger->log("ColorDB: Failed to find any color files.");
@@ -78,8 +75,8 @@ void ColorDB::load()
logger->log("ColorDB: Redefinition of dye ID %d", id);
}
- TMWHair ? mColors[id] = XML::getProperty(node, "value", "#FFFFFF") :
- mColors[id] = XML::getProperty(node, "dye", "#FFFFFF");
+ mColors[id] = hairXml ? XML::getProperty(node, "value", "#FFFFFF") :
+ XML::getProperty(node, "dye", "#FFFFFF");
}
}