summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/files.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-05-10 16:38:57 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-05-10 16:38:57 +0000
commit90ac0755a3ded561037b612fa7adbf293887e050 (patch)
tree71bf12b204b207c8c6bc143851b040bbf9fb69c9 /crawl-ref/source/files.cc
parenta4ac31b1514c2eb7066379e79bfdd5985a7ddecb (diff)
downloadcrawl-ref-90ac0755a3ded561037b612fa7adbf293887e050.tar.gz
crawl-ref-90ac0755a3ded561037b612fa7adbf293887e050.zip
Level-files are now saved with subdungeon depths rather than absolute depths.
Breaks save compatibility resoundingly. The advantage of the change is that ghosts dying in a branch will always be reloaded at the same depth in the branch. Fixed minor bug that could result in branch stairs taking you to different places on successive visits. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1446 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/files.cc')
-rw-r--r--crawl-ref/source/files.cc21
1 files changed, 13 insertions, 8 deletions
diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc
index b9c14f74b3..ce75807379 100644
--- a/crawl-ref/source/files.cc
+++ b/crawl-ref/source/files.cc
@@ -481,13 +481,15 @@ std::string get_prefs_filename()
return get_savedir_filename("start", "ns", "prf");
}
-static std::string get_level_suffix(int level, int where, level_area_type lt)
+static std::string get_level_suffix(int level, branch_type where,
+ level_area_type lt)
{
switch (lt)
{
default:
case LEVEL_DUNGEON:
- return (make_stringf("%02d%c", level, where + 'a'));
+ return (make_stringf("%02d%c", subdungeon_depth(where, level),
+ where + 'a'));
case LEVEL_LABYRINTH:
return ("lab");
case LEVEL_ABYSS:
@@ -497,7 +499,7 @@ static std::string get_level_suffix(int level, int where, level_area_type lt)
}
}
-std::string make_filename( const char *prefix, int level, int where,
+std::string make_filename( const char *prefix, int level, branch_type where,
level_area_type ltype, bool isGhost )
{
return get_savedir_filename( prefix, "",
@@ -533,7 +535,7 @@ static void write_tagged_file( FILE *dataFile, char majorVersion,
}
}
-bool travel_load_map( char branch, int absdepth )
+bool travel_load_map( branch_type branch, int absdepth )
{
// Try to open level savefile.
FILE *levelFile = fopen(make_filename(you.your_name, absdepth, branch,
@@ -603,11 +605,14 @@ static coord_def find_nearby_stair(int stair_to_find, bool find_closest)
if (grd[xpos][ypos] == stair_to_find)
{
found++;
- if (find_closest && dist < best_dist)
+ if (find_closest)
{
- best_dist = dist;
- result.x = xpos;
- result.y = ypos;
+ if (dist < best_dist)
+ {
+ best_dist = dist;
+ result.x = xpos;
+ result.y = ypos;
+ }
}
else if (one_chance_in( found ))
{