- initial work to save game state to XML. Current only saves when out of synch or game end occurs and saves to same folder as log files and file is called: megaglest-saved.xml

(Currently we store way too much info but this is a starting point)
This commit is contained in:
Mark Vejvoda
2012-03-10 03:27:25 +00:00
parent 623623d33f
commit c5331b7e8a
67 changed files with 2120 additions and 14 deletions

View File

@@ -147,6 +147,16 @@ void XmlIo::save(const string &path, const XmlNode *node){
XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *document= implementation->createDocument(0, str, 0);
DOMElement *documentElement= document->getDocumentElement();
for(unsigned int i = 0; i < node->getAttributeCount() ; ++i){
XmlAttribute *attr = node->getAttribute(i);
XMLCh strName[strSize];
XMLString::transcode(attr->getName().c_str(), strName, strSize-1);
XMLCh strValue[strSize];
XMLString::transcode(attr->getValue("",false).c_str(), strValue, strSize-1);
documentElement->setAttribute(strName,strValue);
}
for(unsigned int i=0; i<node->getChildCount(); ++i){
documentElement->appendChild(node->getChild(i)->buildElement(document));