diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-11-25 00:01:38 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-11-25 00:01:38 +0000 |
commit | 97f93f7d2dd30fee884ee4eeb8a16dcb51cf4a7c (patch) | |
tree | ef959b41c9373a02d6424717be5cbcbd1c72782f /crawl-ref/source/files.cc | |
parent | be49ad27a08b4d5a5e347e6d8a2e6852f81c4a8b (diff) | |
download | crawl-ref-97f93f7d2dd30fee884ee4eeb8a16dcb51cf4a7c.tar.gz crawl-ref-97f93f7d2dd30fee884ee4eeb8a16dcb51cf4a7c.zip |
Allow ziggurats placed in Pandemonium to return to the same Pan level when the player leaves the ziggurat. Breaks saves.
Cleaned up up_stairs() and down_stairs() to remove spurious depth changes when changing you.level_type - depth (you.your_level) now changes only for stairs with both ends in LEVEL_DUNGEON.
All levels are now saved on exit, including non LEVEL_DUNGEON levels. Re-entering non-dungeon levels from down_stairs will still delete the old level. Re-entering non-dungeon levels from up_stairs (i.e. returning to a non-dungeon level from some other place, like a ziggurat) will reload the old level.
Fixed bogus marker trashing when player attempts to use a Zot entrance with insufficient runes.
Delete .msg files when game ends.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7598 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/files.cc')
-rw-r--r-- | crawl-ref/source/files.cc | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc index d2085cc678..057a3a32bc 100644 --- a/crawl-ref/source/files.cc +++ b/crawl-ref/source/files.cc @@ -827,15 +827,7 @@ static void _place_player_on_stair(level_area_type old_level_type, bool find_first = true; // Order is important here. - if (you.level_type == LEVEL_DUNGEON - && old_branch == BRANCH_VESTIBULE_OF_HELL - && stair_taken == DNGN_STONE_STAIRS_UP_I) - { - // Leaving hell - look for entry portal first. - stair_taken = DNGN_ENTER_HELL; - find_first = false; - } - else if (stair_taken == DNGN_EXIT_PANDEMONIUM) + if (stair_taken == DNGN_EXIT_PANDEMONIUM) { stair_taken = DNGN_ENTER_PANDEMONIUM; find_first = false; @@ -845,6 +837,10 @@ static void _place_player_on_stair(level_area_type old_level_type, stair_taken = DNGN_ENTER_ABYSS; find_first = false; } + else if (stair_taken == DNGN_EXIT_HELL) + { + stair_taken = DNGN_ENTER_HELL; + } else if (stair_taken == DNGN_ENTER_HELL) { // The vestibule and labyrinth always start from this stair. @@ -885,9 +881,15 @@ static void _place_player_on_stair(level_area_type old_level_type, - DNGN_ENTER_FIRST_BRANCH); } else if (stair_taken >= DNGN_ENTER_DIS - && stair_taken <= DNGN_TRANSIT_PANDEMONIUM) + && stair_taken <= DNGN_ENTER_TARTARUS) + { + // Only when entering a hell - when exiting, go back to the + // entry stair. + if (player_in_hell()) + stair_taken = DNGN_STONE_STAIRS_UP_I; + } + else if (stair_taken == DNGN_EXIT_ABYSS) { - // When entering a hell or pandemonium. stair_taken = DNGN_STONE_STAIRS_UP_I; } else if (stair_taken == DNGN_ENTER_PORTAL_VAULT) @@ -1078,13 +1080,14 @@ bool load( dungeon_feature_type stair_taken, load_mode_type load_mode, if (you.level_type == LEVEL_DUNGEON && old_level_type == LEVEL_DUNGEON || load_mode == LOAD_START_GAME && you.char_direction != GDT_GAME_START) { - if (tmp_file_pairs[you.your_level][you.where_are_you] == false) + const level_id current(level_id::current()); + if (Generated_Levels.find(current) == Generated_Levels.end()) { // Make sure the old file is gone. unlink(cha_fil.c_str()); // Save the information for later deletion -- DML 6/11/99 - tmp_file_pairs[you.your_level][you.where_are_you] = true; + Generated_Levels.insert(current); } } @@ -1104,8 +1107,7 @@ bool load( dungeon_feature_type stair_taken, load_mode_type load_mode, { _grab_followers(); - if (old_level_type == LEVEL_DUNGEON) - _save_level( old_level, LEVEL_DUNGEON, old_branch ); + _save_level( old_level, old_level_type, old_branch ); } if (make_changes) @@ -1135,7 +1137,7 @@ bool load( dungeon_feature_type stair_taken, load_mode_type load_mode, // generation. you.your_level = 0; you.char_direction = GDT_DESCENDING; - tmp_file_pairs[you.your_level][you.where_are_you] = true; + Generated_Levels.insert(level_id::current()); } _clear_env_map(); @@ -1657,13 +1659,11 @@ static void _restore_level(const level_id &original) you.level_type, you.your_level, you.where_are_you ); } -// Given a level in the dungeon (i.e. level_type == LEVEL_DUNGEON), -// returns true if the level has been created already in this game. -// Asserts if the level_type is not LEVEL_DUNGEON. +// Given a level returns true if the level has been created already +// in this game. bool is_existing_level(const level_id &level) { - ASSERT(level.level_type == LEVEL_DUNGEON); - return (tmp_file_pairs[level.absdepth()][level.branch]); + return (Generated_Levels.find(level) != Generated_Levels.end()); } // Applies an operation (applicator) after switching to the specified level. |