From: florianf Date: Thu, 11 Mar 2010 08:42:03 +0000 (+0000) Subject: supertux/tile.hpp: Implement Tile::is_slope(). X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=a0b8add3f0cae02e855e13899423afeb4afe6d57;p=supertux.git supertux/tile.hpp: Implement Tile::is_slope(). git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@6593 837edb03-e0f3-0310-88ca-d4d4e8b29345 --- 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: