From 8a93b4d230d3f50c06940f88195e9e514ff1c4ea Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Thu, 14 May 2009 19:31:41 +0200 Subject: 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) --- src/resources/colordb.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/resources') 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 -#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"); } } -- cgit v1.2.3-70-g09d2