X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmap%2FArea.h;h=9da3083b3fb42f2a7db9f627327cbab9afdb66a4;hb=fb9bd716a1740e41efbb08a3bfa42e441d64c693;hp=3c370abc0acf88afb6ee8c78217cd88d4971bb83;hpb=7c43158af1abf38fa896a442cb3c6d8a5bc630e7;p=l2e.git diff --git a/src/map/Area.h b/src/map/Area.h index 3c370ab..9da3083 100644 --- a/src/map/Area.h +++ b/src/map/Area.h @@ -16,6 +16,9 @@ namespace map { +/// Defines a rectangular section of a map. +/// Tiles are rendered ltr with a row break each width tiles. +/// Missing tiles in the last row are possible but don't fool yourself. class Area { public: @@ -23,12 +26,17 @@ public: ~Area() { } public: + /// Get the width in tiles. int Width() const { return width; } + /// Get the height in tiles. int Height() const { return numTiles / width + (numTiles % width ? 1 : 0); } + /// Get the size in tiles. geometry::Vector Size() const { return geometry::Vector(Width(), Height()); } + /// Get a tile by tile coordinates (not pixel coordinates!). Tile *TileAt(const geometry::Vector &); const Tile *TileAt(const geometry::Vector &) const; + /// Get the default battle background for this area. SDL_Surface *BattleBackground() { return battlebg; } void Render(SDL_Surface *dest, const graphics::Sprite *tileset, const geometry::Vector &offset) const;