From 73b14eecd8cbf2d02376c7a9583bd0fa176c6deb Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Thu, 11 Mar 2010 08:42:03 +0000 Subject: [PATCH] supertux/tile.hpp: Implement Tile::is_slope(). SVN-Revision: 6593 --- src/object/particlesystem_interactive.cpp | 2 +- src/supertux/sector.cpp | 8 ++++---- src/supertux/tile.hpp | 5 +++++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/object/particlesystem_interactive.cpp b/src/object/particlesystem_interactive.cpp index 9923c03c7..880c4c56b 100644 --- a/src/object/particlesystem_interactive.cpp +++ b/src/object/particlesystem_interactive.cpp @@ -93,7 +93,7 @@ ParticleSystem_Interactive::collision(Particle* object, Vector movement) continue; Rectf rect = solids->get_tile_bbox(x, y); - if(tile->getAttributes() & Tile::SLOPE) { // slope tile + if(tile->is_slope ()) { // slope tile AATriangle triangle = AATriangle(rect, tile->getData()); if(rectangle_aatriangle(&constraints, dest, triangle)) { diff --git a/src/supertux/sector.cpp b/src/supertux/sector.cpp index ecb7bab95..fbf0f368b 100644 --- a/src/supertux/sector.cpp +++ b/src/supertux/sector.cpp @@ -971,7 +971,7 @@ int check_movement_unisolid (Vector movement, const Tile* tile) #define MV_SOLID 1 /* If the tile is not a slope, this is very easy. */ - if ((tile->getAttributes() & Tile::SLOPE) == 0) + if (!tile->is_slope ()) { if (movement.y >= 0) /* moving down */ return MV_SOLID; @@ -1099,7 +1099,7 @@ int check_position_unisolid (const Rectf& obj_bbox, #define POS_SOLID 1 /* If this is not a slope, this is - again - easy */ - if ((tile->getAttributes() & Tile::SLOPE) == 0) + if (!tile->is_slope ()) { if ((obj_bbox.get_bottom () - SHIFT_DELTA) <= tile_bbox.get_top ()) return POS_SOLID; @@ -1297,7 +1297,7 @@ Sector::collision_tilemap(collision::Constraints* constraints, continue; } - if(tile->getAttributes() & Tile::SLOPE) { // slope tile + if(tile->is_slope ()) { // slope tile AATriangle triangle; int slope_data = tile->getData(); if (solids->get_drawing_effect() == VERTICAL_FLIP) @@ -1683,7 +1683,7 @@ Sector::is_free_of_tiles(const Rectf& rect, const bool ignoreUnisolid) const continue; if((tile->getAttributes() & Tile::UNISOLID) && ignoreUnisolid) continue; - if(tile->getAttributes() & Tile::SLOPE) { + if(tile->is_slope ()) { AATriangle triangle; Rectf tbbox = solids->get_tile_bbox(x, y); triangle = AATriangle(tbbox, tile->getData()); diff --git a/src/supertux/tile.hpp b/src/supertux/tile.hpp index c2b9bc593..4351f115f 100644 --- a/src/supertux/tile.hpp +++ b/src/supertux/tile.hpp @@ -123,6 +123,11 @@ public: int getData() const { return data; } + bool is_slope (void) const + { + return ((attributes & SLOPE) != 0); + } + void print_debug(int id) const; private: -- 2.11.0