Skip to content

Commit

Permalink
supertux/tile.hpp: Implement Tile::is_slope().
Browse files Browse the repository at this point in the history
SVN-Revision: 6593
  • Loading branch information
Florian Forster committed Mar 11, 2010
1 parent fecc3ee commit 73b14ee
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/object/particlesystem_interactive.cpp
Expand Up @@ -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)) {
Expand Down
8 changes: 4 additions & 4 deletions src/supertux/sector.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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());
Expand Down
5 changes: 5 additions & 0 deletions src/supertux/tile.hpp
Expand Up @@ -123,6 +123,11 @@ class Tile
int getData() const
{ return data; }

bool is_slope (void) const
{
return ((attributes & SLOPE) != 0);
}

void print_debug(int id) const;

private:
Expand Down

0 comments on commit 73b14ee

Please sign in to comment.