From a8c1d6168797526b9d24bc8c86f2578f3be59fa8 Mon Sep 17 00:00:00 2001 From: neoraider Date: Fri, 14 Dec 2007 02:47:03 +0000 Subject: zoomedit: Verallgemeinerte Level-Objekte implementiert. --- FileManager.cpp | 54 +++++++++++++++++++++++++++++------------------------- 1 file changed, 29 insertions(+), 25 deletions(-) (limited to 'FileManager.cpp') 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) { + // + 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; + + // + if(xmlTextWriterEndElement(writer) < 0) + return false; + + return true; +} + FileManager::FileManager(Window *window) { this->window = window; @@ -261,32 +282,10 @@ bool FileManager::write() { return false; } - // - 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; - } - - // - if(xmlTextWriterEndElement(writer) < 0) { - xmlFreeTextWriter(writer); - return false; - } + }*/ // 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; + // if(xmlTextWriterStartElement(writer, (xmlChar*)"room") < 0) { xmlFreeTextWriter(writer); -- cgit v1.2.3