From 1c4332cbef95fdc87d42e34043129f20f210850e Mon Sep 17 00:00:00 2001 From: dshaligram Date: Thu, 7 Dec 2006 09:55:54 +0000 Subject: 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 --- crawl-ref/source/player.cc | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'crawl-ref/source/player.cc') 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", -- cgit v1.2.3-54-g00ecf