summaryrefslogtreecommitdiff
path: root/src
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 22:12:22 +0200
commit8a93b4d230d3f50c06940f88195e9e514ff1c4ea (patch)
tree03f004c4ff9c304bed2ce012a1ca83c611f24daf /src
parent53c32dd1beb5575c38bbc830f7d37cb954be90d2 (diff)
downloadmana-8a93b4d230d3f50c06940f88195e9e514ff1c4ea.tar.gz
mana-8a93b4d230d3f50c06940f88195e9e514ff1c4ea.tar.bz2
mana-8a93b4d230d3f50c06940f88195e9e514ff1c4ea.tar.xz
mana-8a93b4d230d3f50c06940f88195e9e514ff1c4ea.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. (cherry picked from commit e0eeaef318d63ae79522c1d0407e4f5b8212c5f7)
Diffstat (limited to 'src')
-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");
}
}