]> git.localhorst.tv Git - l2e.git/blob - src/map/Area.h
removed useless comments
[l2e.git] / src / map / Area.h
1 #ifndef MAP_AREA_H_
2 #define MAP_AREA_H_
3
4 namespace graphics {
5         class Sprite;
6 }
7 namespace map {
8         class Tile;
9 }
10
11 #include "../math/Vector.h"
12
13 #include <SDL.h>
14
15 namespace map {
16
17 /// Defines a rectangular section of a map.
18 /// Tiles are rendered ltr with a row break each width tiles.
19 /// Missing tiles in the last row are possible but don't fool yourself.
20 class Area {
21
22 public:
23         static const int TYPE_ID = 601;
24
25 public:
26         Area();
27         ~Area() { }
28
29 public:
30         /// Get the width in tiles.
31         int Width() const { return width; }
32         /// Get the height in tiles.
33         int Height() const { return numTiles / width + (numTiles % width ? 1 : 0); }
34         /// Get the size in tiles.
35         math::Vector<int> Size() const { return math::Vector<int>(Width(), Height()); }
36         /// Get a tile by tile coordinates (not pixel coordinates!).
37         Tile *TileAt(const math::Vector<int> &);
38         const Tile *TileAt(const math::Vector<int> &) const;
39
40         /// Get the default battle background for this area.
41         SDL_Surface *BattleBackground() { return battlebg; }
42
43         void Render(SDL_Surface *dest, const graphics::Sprite *tileset, const math::Vector<int> &offset) const;
44         void RenderDebug(SDL_Surface *dest, const graphics::Sprite *tileset, const math::Vector<int> &offset) const;
45
46         static void CreateTypeDescription();
47         static void Construct(void *);
48
49 // temporary setters
50 public:
51         void SetTiles(Tile *t, int num) { tiles = t; numTiles = num; }
52         void SetWidth(int w) { width = w; }
53
54 private:
55         SDL_Surface *battlebg;
56         Tile *tiles;
57         int numTiles;
58         int width;
59
60 };
61
62 }
63
64 #endif