mirror of
https://github.com/glest/glest-source.git
synced 2025-09-26 15:39:21 +02:00
- 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:
@@ -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));
|
||||
|
Reference in New Issue
Block a user