diff options
-rw-r--r-- | crawl-ref/source/externs.h | 11 | ||||
-rw-r--r-- | crawl-ref/source/files.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/travel.cc | 6 |
3 files changed, 18 insertions, 3 deletions
diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 7cdaad0d20..609377e42b 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -503,8 +503,17 @@ public: level_type = LEVEL_DUNGEON; } + // Returns the absolute depth in the dungeon for the level_id; + // non-dungeon branches (specifically Abyss and Pan) will return + // depths suitable for use in monster and item generation. If + // you're looking for a depth to set you.your_level to, use + // dungeon_absdepth(). int absdepth() const; + // Returns the absolute depth in the dungeon for the level_id, corresponding + // to you.your_level. + int dungeon_absdepth() const; + bool is_valid() const { return (branch != NUM_BRANCHES && depth != -1) @@ -990,7 +999,7 @@ public: god_type deity() const; bool alive() const; bool is_summoned(int* duration = NULL, int* summon_type = NULL) const; - + bool swimming() const; bool submerged() const; bool floundering() const; diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc index 691840293a..e79d1537bc 100644 --- a/crawl-ref/source/files.cc +++ b/crawl-ref/source/files.cc @@ -1678,7 +1678,7 @@ static void _restore_level(const level_id &original) { // Reload the original level. you.where_are_you = original.branch; - you.your_level = original.absdepth(); + you.your_level = original.dungeon_absdepth(); you.level_type = original.level_type; load( DNGN_STONE_STAIRS_DOWN_I, LOAD_VISITOR, @@ -1710,7 +1710,7 @@ bool apply_to_level(const level_id &level, bool preserve_current, _save_level(you.your_level, you.level_type, you.where_are_you); you.where_are_you = level.branch; - you.your_level = level.absdepth(); + you.your_level = level.dungeon_absdepth(); you.level_type = level.level_type; // Load the dungeon level... diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index bd330549c2..7148b04f38 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -3026,6 +3026,12 @@ level_id level_id::current() return id; } +int level_id::dungeon_absdepth() const +{ + ASSERT(branch != NUM_BRANCHES && depth != -1); + return absdungeon_depth(branch, depth); +} + int level_id::absdepth() const { switch (level_type) |