]> git.localhorst.tv Git - l2e.git/blobdiff - src/map/Area.cpp
added debug render for ladder flag
[l2e.git] / src / map / Area.cpp
index b6d02f6204f7ba0477b4c7c9df636fc2a3bad936..a2554c31b2bd01b833171909556d4ee7dd6f3441 100644 (file)
@@ -1,21 +1,15 @@
-/*
- * Area.cpp
- *
- *  Created on: Sep 26, 2012
- *      Author: holy
- */
-
 #include "Area.h"
 
 #include "Tile.h"
 #include "../graphics/Sprite.h"
 #include "../loader/TypeDescription.h"
 #include "../loader/Interpreter.h"
+#include "../math/Vector.h"
 #include "../sdl/utility.h"
 
 #include <stdexcept>
 
-using geometry::Vector;
+using math::Vector;
 using loader::FieldDescription;
 using loader::Interpreter;
 using loader::TypeDescription;
@@ -31,7 +25,7 @@ Area::Area()
 }
 
 
-Tile *Area::TileAt(const geometry::Vector<int> &offset) {
+Tile *Area::TileAt(const math::Vector<int> &offset) {
        int tileIndex(offset.Y() * width + offset.X());
        if (tileIndex < numTiles) {
                return tiles +tileIndex;
@@ -40,7 +34,7 @@ Tile *Area::TileAt(const geometry::Vector<int> &offset) {
        }
 }
 
-const Tile *Area::TileAt(const geometry::Vector<int> &offset) const {
+const Tile *Area::TileAt(const math::Vector<int> &offset) const {
        int tileIndex(offset.Y() * width + offset.X());
        if (tileIndex < numTiles) {
                return tiles +tileIndex;
@@ -88,6 +82,14 @@ void Area::RenderDebug(SDL_Surface *dest, const graphics::Sprite *tileset, const
                if (tile.BlocksWest()) {
                        sdl::VerticalLine(dest, offset, tileset->Height(), color);
                }
+               if (tile.IsLadder()) {
+                       SDL_Rect rect;
+                       rect.x = offset.X() + (tileset->Width() / 2) - 2;
+                       rect.y = offset.Y();
+                       rect.w = 4;
+                       rect.h = tileset->Height();
+                       SDL_FillRect(dest, &rect, color);
+               }
        }
 }