summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/travel.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-01-09 10:32:10 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-01-09 10:32:10 +0000
commit843b0034d812492266b0aa07c812b9f54890feaa (patch)
tree96908c38b61be7b7c43cbcee82e50841f620a716 /crawl-ref/source/travel.cc
parent5e3c0308b4efb39a41b21d37e8648c8b2fae248d (diff)
downloadcrawl-ref-843b0034d812492266b0aa07c812b9f54890feaa.tar.gz
crawl-ref-843b0034d812492266b0aa07c812b9f54890feaa.zip
Tweaked travel/explore so that it doesn't cut off before trying to move to a
square with an invisible monster/mimic. Travel now cuts off when the PC attempts to attack the invisible monster. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@813 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/travel.cc')
-rw-r--r--crawl-ref/source/travel.cc24
1 files changed, 8 insertions, 16 deletions
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc
index 8cdb247a1e..673e17db04 100644
--- a/crawl-ref/source/travel.cc
+++ b/crawl-ref/source/travel.cc
@@ -441,26 +441,18 @@ static bool is_travel_ok(int x, int y, bool ignore_hostile)
}
// Returns true if the location at (x,y) is monster-free and contains no clouds.
-static bool is_safe(int x, int y)
+static bool is_safe_move(int x, int y)
{
unsigned char mon = mgrd[x][y];
if (mon != NON_MONSTER)
{
- // If this is an invisible critter, say we're safe to get here, but
- // turn off travel - the result should be that the player bashes into
- // the monster and stops travelling right there. Same treatment applies
- // to mimics.
- if (!player_monster_visible(&menv[mon]) ||
- mons_is_mimic( menv[mon].type ))
+ // Stop before wasting energy on plants and fungi.
+ if (player_monster_visible(&menv[mon])
+ && mons_class_flag( menv[mon].type, M_NO_EXP_GAIN ))
{
- you.running.stop();
- return true;
+ return (false);
}
- // Stop before wasting energy on plants and fungi.
- if (mons_class_flag( menv[mon].type, M_NO_EXP_GAIN ))
- return false;
-
// If this is any *other* monster, it'll be visible and
// a) Friendly, in which case we'll displace it, no problem.
// b) Unfriendly, in which case we're in deep trouble, since travel
@@ -468,11 +460,11 @@ static bool is_safe(int x, int y)
}
const int cloud = env.cgrid[x][y];
if (cloud == EMPTY_CLOUD)
- return true;
+ return (true);
// We can also safely run through smoke.
const cloud_type ctype = (cloud_type) env.cloud[ cloud ].type;
- return !is_damaging_cloud(ctype);
+ return (!is_damaging_cloud(ctype));
}
static bool player_is_permalevitating()
@@ -1278,7 +1270,7 @@ void find_travel_pos(int youx, int youy,
if (dx == dest_x && dy == dest_y)
{
// Hallelujah, we're home!
- if (is_safe(x, y) && move_x && move_y)
+ if (is_safe_move(x, y) && move_x && move_y)
{
*move_x = sgn(x - dest_x);
*move_y = sgn(y - dest_y);