if(new_height > bbox.get_height()) {
Rect additional_space = bbox2;
additional_space.set_height(new_height - bbox.get_height());
- if(!Sector::current()->is_free_of_statics(additional_space, this))
+ if(!Sector::current()->is_free_of_statics(additional_space, this, true))
return false;
}
}
bool
-Sector::is_free_of_tiles(const Rect& rect) const
+Sector::is_free_of_tiles(const Rect& rect, const bool ignoreUnisolid) const
{
using namespace collision;
Constraints constraints;
return collision::rectangle_aatriangle(&constraints, rect, triangle);
}
- if(tile->getAttributes() & Tile::SOLID) return false;
+ if((tile->getAttributes() & Tile::SOLID) && !ignoreUnisolid) return false;
+ if((tile->getAttributes() & Tile::SOLID) && !(tile->getAttributes() & Tile::UNISOLID)) return false;
}
}
}
}
bool
-Sector::is_free_of_statics(const Rect& rect, const MovingObject* ignore_object) const
+Sector::is_free_of_statics(const Rect& rect, const MovingObject* ignore_object, const bool ignoreUnisolid) const
{
using namespace collision;
- if (!is_free_of_tiles(rect)) return false;
+ if (!is_free_of_tiles(rect, ignoreUnisolid)) return false;
for(MovingObjects::const_iterator i = moving_objects.begin();
i != moving_objects.end(); ++i) {
* Checks if the specified rectangle is free of (solid) tiles.
* Note that this does not include static objects, e.g. bonus blocks.
*/
- bool is_free_of_tiles(const Rect& rect) const;
+ bool is_free_of_tiles(const Rect& rect, const bool ignoreUnisolid = false) const;
/**
* Checks if the specified rectangle is free of both
* 1.) solid tiles and
* 2.) MovingObjects in COLGROUP_STATIC.
* Note that this does not include badguys or players.
*/
- bool is_free_of_statics(const Rect& rect, const MovingObject* ignore_object = 0) const;
+ bool is_free_of_statics(const Rect& rect, const MovingObject* ignore_object = 0, const bool ignoreUnisolid = false) const;
/**
* Checks if the specified rectangle is free of both
* 1.) solid tiles and