diff options
Diffstat (limited to 'Source/Ogda/Searchers/Seekers/characterseeker.cpp')
-rw-r--r-- | Source/Ogda/Searchers/Seekers/characterseeker.cpp | 114 |
1 files changed, 43 insertions, 71 deletions
diff --git a/Source/Ogda/Searchers/Seekers/characterseeker.cpp b/Source/Ogda/Searchers/Seekers/characterseeker.cpp index 852cd090..33de9171 100644 --- a/Source/Ogda/Searchers/Seekers/characterseeker.cpp +++ b/Source/Ogda/Searchers/Seekers/characterseeker.cpp @@ -29,92 +29,70 @@ #include <Utility/strings.h> #include <Logging/logdata.h> -std::vector<Item> CharacterSeeker::SearchXML( const Item & item, TiXmlDocument& doc ) -{ - const char* elems[] = - { - "clothing" - }; +std::vector<Item> CharacterSeeker::SearchXML(const Item& item, TiXmlDocument& doc) { + const char* elems[] = + { + "clothing"}; const char* elems_type[] = - { - "material" - }; + { + "material"}; assert(ARRLEN(elems_type) == ARRLEN(elems)); - const char* ignored[] = - { - "morphs", - "tags", - "visemes", - "morphs", - "team", - "soundmod" - }; + const char* ignored[] = + { + "morphs", + "tags", + "visemes", + "morphs", + "team", + "soundmod"}; std::vector<Item> items; TiXmlHandle hRoot(&doc); const char* roots[] = - { - "character" - }; - - TiXmlElement *eRoot = hRoot.FirstChildElement().Element(); - - if( !eRoot ) - { + { + "character"}; + + TiXmlElement* eRoot = hRoot.FirstChildElement().Element(); + + if (!eRoot) { LOGE << "Can't find anything in file listed " << item << std::endl; } - while( eRoot ) - { - if( FindStringInArray( roots, ARRLEN(roots), eRoot->Value() ) < 0 ) - { + while (eRoot) { + if (FindStringInArray(roots, ARRLEN(roots), eRoot->Value()) < 0) { LOGE << "Unknown root " << eRoot->Value() << " from " << item << std::endl; } - TiXmlElement *eElem = eRoot->FirstChildElement(); + TiXmlElement* eElem = eRoot->FirstChildElement(); - while( eElem ) - { + while (eElem) { const char* name = eElem->Value(); const char* text = eElem->GetText(); - if( name ) - { + if (name) { int id; - if( (id = FindStringInArray( elems, ARRLEN(elems), name )) >= 0 ) - { - if( text && strlen(text) > 0 ) - { - items.push_back(Item(item.input_folder, text,elems_type[id],item.source)); - } - else - { + if ((id = FindStringInArray(elems, ARRLEN(elems), name)) >= 0) { + if (text && strlen(text) > 0) { + items.push_back(Item(item.input_folder, text, elems_type[id], item.source)); + } else { LOGW << "String value in " << item << " for element " << elems[id] << " is empty" << std::endl; } - } - else if( (id = FindStringInArray( ignored, ARRLEN(ignored), name )) >= 0 ) - { + } else if ((id = FindStringInArray(ignored, ARRLEN(ignored), name)) >= 0) { LOGD << "Ignored " << ignored[id] << " in " << item << std::endl; - } - else if( strmtch( "animations", name ) ) - { - AttributeScanner::DoAllSame( items, item, eElem, "animation" ); - } - else if( strmtch( "attacks", name ) ) - { - AttributeScanner::DoAllSame( items, item, eElem, "attack"); - } - else if( strmtch( "appearance", name ) ) - { + } else if (strmtch("animations", name)) { + AttributeScanner::DoAllSame(items, item, eElem, "animation"); + } else if (strmtch("attacks", name)) { + AttributeScanner::DoAllSame(items, item, eElem, "attack"); + } else if (strmtch("appearance", name)) { std::vector<attribpair> a; a.push_back(attribpair("obj_path", "object")); - a.push_back(attribpair("morph", "model")); + a.push_back(attribpair("morph", "model")); a.push_back(attribpair("skeleton", "skeleton")); - a.push_back(attribpair("fur", "model")); + a.push_back(attribpair("fur", "model")); std::vector<const char*> i; i.push_back("model_scale"); @@ -124,26 +102,20 @@ std::vector<Item> CharacterSeeker::SearchXML( const Item & item, TiXmlDocument& i.push_back("channel_2"); i.push_back("channel_3"); i.push_back("channel_4"); - - AttributeScanner::Do( items, item, eElem, a, i ); - } - else if( strmtch( "voice", name ) ) - { + + AttributeScanner::Do(items, item, eElem, a, i); + } else if (strmtch("voice", name)) { std::vector<attribpair> a; a.push_back(attribpair("path", "voice")); std::vector<const char*> i; i.push_back("pitch"); - AttributeScanner::Do( items, item, eElem, a, i ); - } - else - { + AttributeScanner::Do(items, item, eElem, a, i); + } else { LOGE << "Unahandled subvalue in Character from " << item << " called " << name << std::endl; } - } - else - { + } else { LOGE << "Generic warning" << std::endl; } |