wip- forest worldmap
[supertux.git] / src / level.cpp
index e9f8ccd..8f1885b 100644 (file)
 #include <memory>
 #include <stdexcept>
 
-#include "video/screen.h"
-#include "lisp/parser.h"
-#include "lisp/lisp.h"
-#include "lisp/list_iterator.h"
-#include "lisp/writer.h"
-#include "level.h"
-#include "physic.h"
-#include "sector.h"
-#include "tile.h"
-#include "resources.h"
-#include "file_system.h"
-#include "object/gameobjs.h"
-#include "object/camera.h"
-#include "object/tilemap.h"
-#include "object/coin.h"
+#include "video/screen.hpp"
+#include "lisp/parser.hpp"
+#include "lisp/lisp.hpp"
+#include "lisp/list_iterator.hpp"
+#include "lisp/writer.hpp"
+#include "level.hpp"
+#include "physic.hpp"
+#include "sector.hpp"
+#include "tile.hpp"
+#include "resources.hpp"
+#include "file_system.hpp"
+#include "object/gameobjs.hpp"
+#include "object/camera.hpp"
+#include "object/tilemap.hpp"
+#include "object/coin.hpp"
 
 // test
-#include "flip_level_transformer.h"
+#include "flip_level_transformer.hpp"
 
 using namespace std;
 
@@ -70,13 +70,6 @@ Level::load(const std::string& filepath)
     level->get("version", version);
     if(version == 1) {
       load_old_format(*level);
-
-#if 0
-      // test for now
-      FlipLevelTransformer* transformer = new FlipLevelTransformer();  
-      transformer->transform(this);
-#endif
-     
       return;
     }
 
@@ -123,12 +116,7 @@ Level::load_old_format(const lisp::Lisp& reader)
 void
 Level::save(const std::string& filename)
 {
-  std::string filepath = "levels/" + filename;
-  int last_slash = filepath.find_last_of('/');
-  FileSystem::fcreatedir(filepath.substr(0,last_slash).c_str());
-  filepath = user_dir + "/" + filepath;
-  ofstream file(filepath.c_str(), ios::out);
-  lisp::Writer* writer = new lisp::Writer(file);
+  lisp::Writer* writer = new lisp::Writer(filename);
 
   writer->write_comment("Level made using SuperTux's built-in Level Editor");
 
@@ -150,7 +138,6 @@ Level::save(const std::string& filename)
   writer->end_list("supertux-level");
 
   delete writer;
-  file.close();
 }
 
 Level::~Level()