diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-08-23 18:52:05 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-08-23 18:52:05 +0000 |
commit | a42cf252322e22af17e24e3f5e8f2f7a35cc0bd7 (patch) | |
tree | 36bd351605e76e4d35492ed03a258d8b303ba325 /crawl-ref/source/stuff.cc | |
parent | 72acf198cb29df6fc60463fc042356f549f10b43 (diff) | |
download | crawl-ref-a42cf252322e22af17e24e3f5e8f2f7a35cc0bd7.tar.gz crawl-ref-a42cf252322e22af17e24e3f5e8f2f7a35cc0bd7.zip |
Monsters coming up or down staircases will now
be chosen according to the destination. And yes,
this does mean that occasionally an elf summoner
will cross the Orc/Elf border etc, which could
make things harder. On the other hand, that's
just one staircase out of (at least!) seven, and
monsters entering the level through the upstairs
will likewise be a bit easier.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2030 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/stuff.cc')
-rw-r--r-- | crawl-ref/source/stuff.cc | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc index 6d0f282909..251e9cd9b9 100644 --- a/crawl-ref/source/stuff.cc +++ b/crawl-ref/source/stuff.cc @@ -53,6 +53,7 @@ #include "libunix.h" #endif +#include "branch.h" #include "delay.h" #include "externs.h" #include "items.h" @@ -1062,7 +1063,7 @@ int fuzz_value(int val, int lowfuzz, int highfuzz, int naverage) // returns 1 if the point is near unoccupied stairs // returns 2 if the point is near player-occupied stairs -int near_stairs(int px, int py, int max_dist, unsigned char &stair_gfx) +int near_stairs(int px, int py, int max_dist, unsigned char &stair_gfx, branch_type &branch) { int i,j; @@ -1081,7 +1082,29 @@ int near_stairs(int px, int py, int max_dist, unsigned char &stair_gfx) && grd[x][y] <= DNGN_RETURN_FROM_SWAMP && grd[x][y] != DNGN_ENTER_SHOP) // silly { + // shouldn't happen for escape hatches + if (grd[x][y] == DNGN_ROCK_STAIRS_DOWN + || grd[x][y] == DNGN_ROCK_STAIRS_UP) + { + continue; + } + stair_gfx = get_sightmap_char(grd[x][y]); + + // is it a branch stair? + for ( i = 0; i < NUM_BRANCHES; ++i ) + { + if (branches[i].entry_stairs == grd[x][y]) + { + branch = branches[i].id; + break; + } + else if (branches[i].exit_stairs == grd[x][y]) + { + branch = branches[i].parent_branch; + break; + } + } return ((x == you.x_pos && y == you.y_pos) ? 2 : 1); } } |