diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2006-12-07 09:55:54 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2006-12-07 09:55:54 +0000 |
commit | 1c4332cbef95fdc87d42e34043129f20f210850e (patch) | |
tree | 6bf364710c0893ec0a1ef1125423b504051ca004 /crawl-ref/source/player.cc | |
parent | faca2fd92e2ba17f40f4a5c08d4f88dd25ae7085 (diff) | |
download | crawl-ref-1c4332cbef95fdc87d42e34043129f20f210850e.tar.gz crawl-ref-1c4332cbef95fdc87d42e34043129f20f210850e.zip |
Updated .des documentation. We should probably move this to the docs directory.
[1610591] Friendlies on dangerous terrain cannot be displaced. Prompting for
confirmation would be more consistent, but also more irritating.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@587 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r-- | crawl-ref/source/player.cc | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 3b4f44b370..8df05fdbf1 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -177,8 +177,7 @@ bool move_player_to_grid( int x, int y, bool stepped, bool allow_shift, { // XXX: at some point we're going to need to fix the swimming // code to handle burden states. - if (new_grid == DNGN_LAVA - || (new_grid == DNGN_DEEP_WATER && you.species != SP_MERFOLK)) + if (is_grid_dangerous(new_grid)) { // lava and dangerous deep water (ie not merfolk) int entry_x = (stepped) ? you.x_pos : x; @@ -295,6 +294,18 @@ bool move_player_to_grid( int x, int y, bool stepped, bool allow_shift, return (true); } +bool player_can_swim() +{ + return (you.species == SP_MERFOLK); +} + +bool is_grid_dangerous(int grid) +{ + return (!player_is_levitating() + && (grid == DNGN_LAVA + || grid == DNGN_DEEP_WATER && !player_can_swim())); +} + bool player_in_mappable_area( void ) { return (you.level_type != LEVEL_LABYRINTH && you.level_type != LEVEL_ABYSS); @@ -322,7 +333,7 @@ bool player_in_water(void) bool player_is_swimming(void) { - return (player_in_water() && you.species == SP_MERFOLK); + return (player_in_water() && player_can_swim()); } bool player_under_penance(void) @@ -1383,7 +1394,7 @@ int player_movement_speed(void) { int mv = 10; - if (you.species == SP_MERFOLK && player_is_swimming()) + if (player_is_swimming()) { // This is swimming... so it doesn't make sense to really // apply the other things (the mutation is "cover ground", |