From c6b621bf1bfc70baa0ea87b15e4e4656c6a43457 Mon Sep 17 00:00:00 2001 From: dolorous Date: Wed, 18 Jun 2008 03:08:45 +0000 Subject: Add more miscellaneous minor fixes. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5931 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/monplace.cc | 9 ++++++--- crawl-ref/source/stuff.cc | 14 ++++++++------ crawl-ref/source/stuff.h | 3 +-- crawl-ref/source/travel.cc | 1 + 4 files changed, 16 insertions(+), 11 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc index 46b8f41630..2a54fae689 100644 --- a/crawl-ref/source/monplace.cc +++ b/crawl-ref/source/monplace.cc @@ -503,8 +503,10 @@ static monster_type _resolve_monster_type(monster_type mon_type, static int _is_near_stairs(coord_def &p) { int result = 0; - for (int i = -1; i <= 1; i++) - for (int j = -1; j <= 1; j++) + + for (int i = -1; i <= 1; ++i) + { + for (int j = -1; j <= 1; ++j) { if (!in_bounds(p)) continue; @@ -519,9 +521,10 @@ static int _is_near_stairs(coord_def &p) // Should there be several stairs, don't overwrite the // player on stairs info. if (result < 2) - result = (p == you.pos() ? 2 : 1); + result = (p == you.pos()) ? 2 : 1; } } + } return result; } diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc index df64a4e24d..a261bdbf06 100644 --- a/crawl-ref/source/stuff.cc +++ b/crawl-ref/source/stuff.cc @@ -1493,13 +1493,14 @@ int fuzz_value(int val, int lowfuzz, int highfuzz, int naverage) // Returns 0 if the point is not near stairs. // Returns 1 if the point is near unoccupied stairs. // Returns 2 if the point is near player-occupied stairs. -int near_stairs(const coord_def &p, int max_dist, - dungeon_char_type &stair_type, - branch_type &branch) +int near_stairs(const coord_def &p, int max_dist, bool allow_hatches, + dungeon_char_type &stair_type, branch_type *branch) { coord_def inc; - for (inc.x = -max_dist; inc.x <= max_dist; inc.x++) - for (inc.y = -max_dist; inc.y <= max_dist; inc.y++) + + for (inc.x = -max_dist; inc.x <= max_dist; ++inc.x) + { + for (inc.y = -max_dist; inc.y <= max_dist; ++inc.y) { const coord_def np(p + inc); @@ -1529,9 +1530,10 @@ int near_stairs(const coord_def &p, int max_dist, break; } } - return (np == you.pos()? 2 : 1); + return (np == you.pos()) ? 2 : 1; } } + } return false; } diff --git a/crawl-ref/source/stuff.h b/crawl-ref/source/stuff.h index 02fa98aa5e..7f2ebeb2fd 100644 --- a/crawl-ref/source/stuff.h +++ b/crawl-ref/source/stuff.h @@ -169,8 +169,7 @@ char index_to_letter (int the_index); int letter_to_index(int the_letter); int near_stairs(const coord_def &p, int max_dist, - dungeon_char_type &stair_type, - branch_type &branch); + dungeon_char_type &stair_type. branch_type &branch); inline bool testbits(unsigned long flags, unsigned long test) { diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 27a21f3010..074d2e8b1c 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -607,6 +607,7 @@ bool is_stair(dungeon_feature_type gridc) { return (is_travelable_stair(gridc) || gridc == DNGN_ENTER_ABYSS + || gridc == DNGN_EXIT_ABYSS || gridc == DNGN_ENTER_LABYRINTH || gridc == DNGN_ENTER_PANDEMONIUM || gridc == DNGN_EXIT_PANDEMONIUM -- cgit v1.2.3-54-g00ecf