ice yeti animation updates
[supertux.git] / src / tile.cpp
index 6c75fb1..68e271e 100644 (file)
@@ -36,6 +36,12 @@ Tile::Tile()
 {
 }
 
+Tile::Tile(unsigned int id_, Uint32 attributes_, const ImageSpec& imagespec)
+  : id(id_), editor_image(0), attributes(attributes_), data(0), anim_fps(1)
+{
+  imagespecs.push_back(imagespec);
+}
+
 Tile::~Tile()
 {
   for(std::vector<Surface*>::iterator i = images.begin(); i != images.end();
@@ -52,7 +58,7 @@ Tile::parse(const lisp::Lisp& reader)
     throw std::runtime_error("Missing tile-id.");
   }
   
-  bool value;
+  bool value = false;
   if(reader.get("solid", value) && value)
     attributes |= SOLID;
   if(reader.get("unisolid", value) && value)
@@ -111,7 +117,7 @@ Tile::parse_images(const lisp::Lisp& images_lisp)
       const lisp::Lisp* ptr = cur->get_cdr();
 
       std::string file;
-      float x, y, w, h;
+      float x = 0, y = 0, w = 0, h = 0;
       ptr->get_car()->get(file); ptr = ptr->get_cdr();
       ptr->get_car()->get(x); ptr = ptr->get_cdr();
       ptr->get_car()->get(y); ptr = ptr->get_cdr();
@@ -137,18 +143,18 @@ Tile::load_images(const std::string& tilesetpath)
     Surface* surface;
     std::string file = tilesetpath + spec.file;
     if(spec.rect.get_width() <= 0) {
-      surface = new Surface(file, true);
+      surface = new Surface(file);
     } else {
       surface = new Surface(file,
           (int) spec.rect.p1.x,
           (int) spec.rect.p1.y,
           (int) spec.rect.get_width(),
-          (int) spec.rect.get_height(), true);
+          (int) spec.rect.get_height());
     }
     images.push_back(surface);
   }
   if(editor_imagefile != "") {
-    editor_image = new Surface(tilesetpath + editor_imagefile, true);
+    editor_image = new Surface(tilesetpath + editor_imagefile);
   }
 }