diff options
Diffstat (limited to 'FileManager.cpp')
-rw-r--r-- | FileManager.cpp | 54 |
1 files changed, 29 insertions, 25 deletions
diff --git a/FileManager.cpp b/FileManager.cpp index 0025cf2..89c6d41 100644 --- a/FileManager.cpp +++ b/FileManager.cpp @@ -159,6 +159,27 @@ bool FileManager::writeTexCoords(xmlTextWriterPtr writer, float s, float t) { return true; } +bool FileManager::writeStart(xmlTextWriterPtr writer, const Vertex3d &start) { + // <vertex> + if(xmlTextWriterStartElement(writer, (xmlChar*)"start") < 0) + return false; + + if(xmlTextWriterWriteFormatAttribute(writer, (xmlChar*)"x", "%f", start.getX()) < 0) + return false; + + if(xmlTextWriterWriteFormatAttribute(writer, (xmlChar*)"y", "%f", start.getY()) < 0) + return false; + + if(xmlTextWriterWriteFormatAttribute(writer, (xmlChar*)"z", "%f", start.getZ()) < 0) + return false; + + // </vertex> + if(xmlTextWriterEndElement(writer) < 0) + return false; + + return true; +} + FileManager::FileManager(Window *window) { this->window = window; @@ -261,32 +282,10 @@ bool FileManager::write() { return false; } - // <start> - if(xmlTextWriterStartElement(writer, (xmlChar*)"start") < 0) { - xmlFreeTextWriter(writer); - return false; - } - - if(xmlTextWriterWriteAttribute(writer, (xmlChar*)"x", (xmlChar*)"0.0") < 0) { - xmlFreeTextWriter(writer); - return false; - } - - if(xmlTextWriterWriteAttribute(writer, (xmlChar*)"y", (xmlChar*)"2.0") < 0) { - xmlFreeTextWriter(writer); - return false; - } - - if(xmlTextWriterWriteAttribute(writer, (xmlChar*)"z", (xmlChar*)"0.0") < 0) { + /*if(!writeStart(writer, window->getLevel().getPlayerStart())) { xmlFreeTextWriter(writer); return false; - } - - // </start> - if(xmlTextWriterEndElement(writer) < 0) { - xmlFreeTextWriter(writer); - return false; - } + }*/ // </info> if(xmlTextWriterEndElement(writer) < 0) { @@ -300,7 +299,12 @@ bool FileManager::write() { return false; } - for(Level::iterator room = window->getLevel().begin(); room != window->getLevel().end(); room++) { + for(Level::iterator object = window->getLevel().begin(); object != window->getLevel().end(); object++) { + if(!(*object)->isOfType("Room")) + continue; + + Room *room = (Room*)&**object; + // <room> if(xmlTextWriterStartElement(writer, (xmlChar*)"room") < 0) { xmlFreeTextWriter(writer); |