diff options
author | Adam Borowski <kilobyte@angband.pl> | 2012-01-01 05:02:09 +0100 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2012-01-03 04:45:59 +0100 |
commit | 405e9b68034c5e8793f6c169cbed7dd90d4ac8ba (patch) | |
tree | 792e3efe617bb42cfd8dadfb2c20947cad734e74 /crawl-ref/source/place.cc | |
parent | 29969a4f936d3357f5f25971cbff31c026872a29 (diff) | |
download | crawl-ref-405e9b68034c5e8793f6c169cbed7dd90d4ac8ba.tar.gz crawl-ref-405e9b68034c5e8793f6c169cbed7dd90d4ac8ba.zip |
Use branch depth rather than absolute depth as the authoritative one.
Diffstat (limited to 'crawl-ref/source/place.cc')
-rw-r--r-- | crawl-ref/source/place.cc | 38 |
1 files changed, 7 insertions, 31 deletions
diff --git a/crawl-ref/source/place.cc b/crawl-ref/source/place.cc index bf63f6292c..2e762309a1 100644 --- a/crawl-ref/source/place.cc +++ b/crawl-ref/source/place.cc @@ -9,8 +9,8 @@ #include "branch.h" #include "libutil.h" -#include "place.h" #include "player.h" +#include "place.h" #include "travel.h" std::string short_place_name(level_id id) @@ -35,8 +35,7 @@ unsigned short get_packed_place(branch_type branch, int subdepth) unsigned short get_packed_place() { - return get_packed_place(you.where_are_you, - subdungeon_depth(you.where_are_you, you.absdepth0)); + return get_packed_place(you.where_are_you, you.depth); } bool single_level_branch(branch_type branch) @@ -101,39 +100,16 @@ int absdungeon_depth(branch_type branch, int subdepth) { if (branch >= BRANCH_VESTIBULE_OF_HELL && branch <= BRANCH_LAST_HELL) return subdepth + 27 - (branch == BRANCH_VESTIBULE_OF_HELL); - else + + --subdepth; + while (branch != BRANCH_MAIN_DUNGEON && branch != NUM_BRANCHES) { - --subdepth; - while (branch != BRANCH_MAIN_DUNGEON && branch != NUM_BRANCHES) - { - subdepth += startdepth[branch]; - branch = branches[branch].parent_branch; - } + subdepth += startdepth[branch]; + branch = branches[branch].parent_branch; } return subdepth; } -int subdungeon_depth(branch_type branch, int depth) -{ - int d = depth - absdungeon_depth(branch, 0); - // FIXME: assert instead once bugs are gone - if (d < 1) - d = 1; - else if (d > brdepth[branch]) - d = brdepth[branch]; - return d; -} - -int absdungeon_depth() -{ - return you.absdepth0; -} - -int player_branch_depth() -{ - return subdungeon_depth(you.where_are_you, you.absdepth0); -} - // Returns true if exits from this type of level involve going upstairs. bool branch_exits_up(branch_type branch) { |