summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/player.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-14 08:29:33 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-14 08:29:33 +0000
commitc2e225e37b6fd61253cb5804c719462fb29bb136 (patch)
tree360714dacc9f90aacba2300c0e877d7e7f8d487f /crawl-ref/source/player.cc
parent07cd5056664cc32435043eb78282a5831eda545e (diff)
downloadcrawl-ref-c2e225e37b6fd61253cb5804c719462fb29bb136.tar.gz
crawl-ref-c2e225e37b6fd61253cb5804c719462fb29bb136.zip
Added to classes actor, monsters and player the method can_pass_through(),
which returns true for a grid that the monster or player can pass trhough. Also added new monster type "rock worm" to demonstrate a monster which can pass through solid walls. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2459 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r--crawl-ref/source/player.cc17
1 files changed, 16 insertions, 1 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 02266afb2a..6d7e083a11 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -169,7 +169,7 @@ bool move_player_to_grid( int x, int y, bool stepped, bool allow_shift,
const dungeon_feature_type new_grid = grd[x][y];
// really must be clear
- ASSERT( !grid_is_solid( new_grid ) );
+ ASSERT( you.can_pass_through( new_grid ) );
// if (grid_is_solid( new_grid ))
// return (false);
@@ -5406,6 +5406,21 @@ bool player::floundering() const
return in_water() && !can_swim();
}
+bool player::can_pass_through(const dungeon_feature_type grid) const
+{
+ return !grid_is_solid(grid);
+}
+
+bool player::can_pass_through(const int _x, const int _y) const
+{
+ return can_pass_through(grd[_x][_y]);
+}
+
+bool player::can_pass_through(const coord_def &c) const
+{
+ return can_pass_through(grd(c));
+}
+
size_type player::body_size(int psize, bool base) const
{
size_type ret = (base) ? SIZE_CHARACTER : transform_size( psize );