diff options
Diffstat (limited to 'src/resources/colordb.cpp')
-rw-r--r-- | src/resources/colordb.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/resources/colordb.cpp b/src/resources/colordb.cpp index af498297..e5377aa6 100644 --- a/src/resources/colordb.cpp +++ b/src/resources/colordb.cpp @@ -27,9 +27,6 @@ #include <libxml/tree.h> -#define HAIR_COLOR_FILE "colors.xml" -#define TMW_COLOR_FILE "hair.xml" - namespace { ColorDB::Colors mColors; @@ -42,23 +39,23 @@ 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 TMW's color file, %s.", TMW_COLOR_FILE); + logger->log("Trying to fall back on colors.xml"); - TMWHair = true; + hairXml = false; delete doc; - - doc = new XML::Document(TMW_COLOR_FILE); + doc = new XML::Document("colors.xml"); root = doc->rootNode(); + if (!root || !xmlStrEqual(root->name, BAD_CAST "colors")) { - logger->log("ColorDB: Failed"); + logger->log("ColorDB: Failed to find any color files."); mColors[0] = mFail; mLoaded = true; @@ -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"); } } |