X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fmap%2FArea.cpp;h=985dea2d5462f4aae5ecba7663d6c79651f635d3;hb=978ccdf2644bc445c864dbe581ead365b238cff8;hp=6b3f9b186373714aa384748e7a3ba10eb8f19b22;hpb=b8b3c5eb15fe990182e76a738953f444ccfbe06c;p=l2e.git diff --git a/src/map/Area.cpp b/src/map/Area.cpp index 6b3f9b1..985dea2 100644 --- a/src/map/Area.cpp +++ b/src/map/Area.cpp @@ -18,19 +18,29 @@ using geometry::Vector; namespace map { Area::Area() -: tiles(0) +: battlebg(0) +, tiles(0) , numTiles(0) , width(0) { } -const Tile &Area::TileAt(const geometry::Vector &offset) const { +Tile *Area::TileAt(const geometry::Vector &offset) { int tileIndex(offset.Y() * width + offset.X()); if (tileIndex < numTiles) { - return tiles[tileIndex]; + return tiles +tileIndex; } else { - throw std::out_of_range("tile index out of range"); + return 0; + } +} + +const Tile *Area::TileAt(const geometry::Vector &offset) const { + int tileIndex(offset.Y() * width + offset.X()); + if (tileIndex < numTiles) { + return tiles +tileIndex; + } else { + return 0; } }