Godely
Member
- Joined
- Aug 19, 2007
- Messages
- 233
- Reaction score
- 19
In TFS, players can't get new outfits by quest. So, I was thinking about a new function on outfits.xml. It would be " storageid="" ". But I'm getting troubles with outfit.cpp. Look:
If someone can help me, thanks =D
Code:
bool Outfits::loadFromXml()
{
std::string filename = "data/XML/outfits.xml";
xmlDocPtr doc = xmlParseFile(filename.c_str());
if(doc)
{
xmlNodePtr root, p;
root = xmlDocGetRootElement(doc);
if(xmlStrcmp(root->name,(const xmlChar*)"outfits") != 0)
{
xmlFreeDoc(doc);
std::cout << "[Warning] outfits.xml not found, using defaults." << std::endl;
return true;
}
p = root->children;
while(p)
{
std::string str;
int32_t intVal;
if(xmlStrcmp(p->name, (const xmlChar*)"outfit") == 0)
{
if(readXMLInteger(p, "type", intVal))
{
if(intVal > 9 || intVal < 0)
std::cout << "[Warning] No valid outfit type " << intVal << std::endl;
else
{
OutfitList* list;
if(m_list[intVal] != NULL)
list = m_list[intVal];
else
{
list = new OutfitList;
m_list[intVal] = list;
}
Outfit outfit;
std::string outfitName;
bool storageID = true;
readXMLString(p, "name", outfitName);
if(readXMLInteger(p, "looktype", intVal))
outfit.looktype = intVal;
else
std::cout << "[Warning] Missing looktype on outfit: " << outfitName << std::endl;
if(readXMLInteger(p, "addons", intVal))
outfit.addons = intVal;
else
outfit.addons = 0;
if(readXMLInteger(p, "premium", intVal))
outfit.premium = (intVal == 1);
if(readXMLInteger(p, "storageid", intVal))
storageID = getStorageValue(storageID, (int32_t&)value);
outfitNamesMap[outfit.looktype] = outfitName;
if(storageID)
{
//This way you can add names for outfits without adding them to default list
list->addOutfit(outfit);
}
}
}
else
std::cout << "Missing outfit type." << std::endl;
}
p = p->next;
}
xmlFreeDoc(doc);
}
return true;
}
If someone can help me, thanks =D