Allow creation of Tilemap and Door objects by feeding them with info.
[supertux.git] / src / tilemap.h
index 18340aa..c464355 100644 (file)
@@ -31,6 +31,15 @@ class TileManager;
 class LispReader;
 class Tile;
 
+struct TileId
+{
+  TileId() : id(0), hidden(0) {}
+  explicit TileId(unsigned int i, bool hidden_ = false) : id(i), hidden(hidden_) {}
+
+  unsigned id     :31;
+  unsigned hidden :1;
+};
+
 /**
  * This class is reponsible for drawing the level tiles
  */
@@ -39,6 +48,7 @@ class TileMap : public GameObject, public Serializable
 public:
   TileMap();
   TileMap(LispReader& reader);
+  TileMap(int layer_, bool solid_, size_t width_, size_t height_);
   virtual ~TileMap();
 
   virtual void write(LispWriter& writer);
@@ -59,11 +69,14 @@ public:
 
   size_t get_height() const
   { return height; }
+
+  int get_layer() const
+  { return layer; }
   
   bool is_solid() const
   { return solid; }
 
-  unsigned int get_tile_id_at(const Vector& pos) const;
+  TileId& get_tile_id_at(const Vector& pos);
 
   /// returns tile in row y and column y (of the tilemap)
   Tile* get_tile(int x, int y) const;
@@ -74,8 +87,8 @@ public:
 
   void change_at(const Vector& pos, unsigned int newtile);
 
-public:
-  std::vector<unsigned int> tiles;
+private:
+  std::vector<TileId> tiles;
   
 private:
   TileManager* tilemanager;