summaryrefslogtreecommitdiff
path: root/src/map.h
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-02-02 21:00:59 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-02-02 21:00:59 +0000
commit7b53da553fdc1389a159703bfade87083155f15f (patch)
treebb508d379289aec01d342575d11da11c89b892f8 /src/map.h
parentc4e5b796f722c3f65c5431ff2f67f4d23fcbf98d (diff)
downloadmana-client-7b53da553fdc1389a159703bfade87083155f15f.tar.gz
mana-client-7b53da553fdc1389a159703bfade87083155f15f.tar.bz2
mana-client-7b53da553fdc1389a159703bfade87083155f15f.tar.xz
mana-client-7b53da553fdc1389a159703bfade87083155f15f.zip
Turned MAP struct into Map class.
Diffstat (limited to 'src/map.h')
-rw-r--r--src/map.h75
1 files changed, 40 insertions, 35 deletions
diff --git a/src/map.h b/src/map.h
index 323a00d0..a4c8e351 100644
--- a/src/map.h
+++ b/src/map.h
@@ -59,44 +59,49 @@ l - Animated layer
f - future use
*/
struct TILE {
- char data[4];
- char flags;
+ char data[4];
+ char flags;
};
-struct MAP {
- TILE tiles[MAP_WIDTH][MAP_HEIGHT];
- char tileset[20];
- char bg_music[20];
+class Map
+{
+ public:
+ /**
+ * Loads a map file
+ */
+ bool load(char *mapFile);
+
+ /**
+ * Set tile ID.
+ */
+ void setTile(int x, int y, int layer, unsigned short id);
+
+ /**
+ * Get tile ID.
+ */
+ int getTile(int x, int y, int layer);
+
+ /**
+ * Set walkability flag for a tile
+ */
+ void setWalk(int x, int y, bool walkable);
+
+ /**
+ * Tell if a tile is walkable or not
+ */
+ bool getWalk(int x, int y);
+
+ /**
+ * Tell if a tile is walkable or not (0=walkable,1=not walkable)
+ */
+ int getPathWalk(int x, int y);
+
+ private:
+ TILE tiles[MAP_WIDTH][MAP_HEIGHT];
+ char tileset[20];
+ char bg_music[20];
};
-/** Loads a map file */
-bool load_map(char *map_file);
-
-/** Set walkability flag for a tile */
-void set_walk(short x_c, short y_c, bool walkable);
-
-/** Tell if a tile is walkable or not */
-bool get_walk(short x_c, short y_c);
-
-/** Tell if a tile is walkable or not (0=walkable,1=not walkable) */
-unsigned char get_path_walk(unsigned short x, unsigned short y);
-
-/** Tell if a tile is animated or not */
-bool get_anim(short x_c, short y_c, char layer);
-
-/** Set tile ID */
-void set_tile(short x_c, short y_c, char layer, unsigned short id);
-
-/** Return tile ID */
-unsigned short get_tile(short x_c, short y_c, char layer);
-
-/** Return tile x coordinate in tileset */
-inline int get_tile_x(int x, int y, int layer) {
- return get_tile(x,y,layer)%TILESET_WIDTH;
-}
-/** Return tile y coordinate in tileset */
-inline int get_tile_y(int x, int y, int layer) {
- return get_tile(x,y,layer)/TILESET_WIDTH;
-}
+extern Map tiledMap;
#endif