diff options
author | neoraider <devnull@localhost> | 2007-12-14 03:47:03 +0100 |
---|---|---|
committer | neoraider <devnull@localhost> | 2007-12-14 03:47:03 +0100 |
commit | a8c1d6168797526b9d24bc8c86f2578f3be59fa8 (patch) | |
tree | 8515976a634b788d99b2c894757a0b4ecbb6fa6a /FileManager.cpp | |
parent | d82c597917d8ef5866c7a83d0c101f423a2ac05d (diff) | |
download | zoomedit-a8c1d6168797526b9d24bc8c86f2578f3be59fa8.tar zoomedit-a8c1d6168797526b9d24bc8c86f2578f3be59fa8.zip |
zoomedit: Verallgemeinerte Level-Objekte implementiert.
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); |