summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/chardump.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-10 00:24:08 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-10 00:24:08 +0000
commita1d6cda4bbcd9cdb9c10aabbf765fa1c02c941fe (patch)
tree11eb03a2f2a4605a283e4e469a09a040aeb60621 /crawl-ref/source/chardump.cc
parentdb37e2e9b818817a63d6c0a08ba227be885fe3bb (diff)
downloadcrawl-ref-a1d6cda4bbcd9cdb9c10aabbf765fa1c02c941fe.tar.gz
crawl-ref-a1d6cda4bbcd9cdb9c10aabbf765fa1c02c941fe.zip
The level-builder now enforces the constraint that every contiguous region on a level must include at least one stair (ekiM). This guarantee does not apply to areas inside vaults (the builder assumes vault-designers are sane) and does not apply to certain branches (Swamp, Shoals, the branches of Hell), or the non-Dungeon areas (Abyss, Pan, Bazaars).
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4169 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/chardump.cc')
-rw-r--r--crawl-ref/source/chardump.cc22
1 files changed, 14 insertions, 8 deletions
diff --git a/crawl-ref/source/chardump.cc b/crawl-ref/source/chardump.cc
index 8e26e59668..cc2f9f5671 100644
--- a/crawl-ref/source/chardump.cc
+++ b/crawl-ref/source/chardump.cc
@@ -1133,7 +1133,7 @@ static std::string morgue_directory()
return (dir);
}
-static void dump_map(const char* fname)
+void dump_map(FILE *fp)
{
// Duplicate the screenshot() trick.
FixedVector<unsigned, NUM_DCHAR_TYPES> char_table_bk;
@@ -1142,14 +1142,10 @@ static void dump_map(const char* fname)
init_char_table(CSET_ASCII);
init_feature_table();
- FILE* fp = fopen(fname, "w");
- if ( !fp )
- return;
-
int min_x = GXM-1, max_x = 0, min_y = GYM-1, max_y = 0;
- for (int i = 0; i < GXM; i++)
- for (int j = 0; j < GYM; j++)
+ for (int i = X_BOUND_1; i <= X_BOUND_2; i++)
+ for (int j = Y_BOUND_1; j <= Y_BOUND_2; j++)
if (env.map[i][j].known())
{
if ( i > max_x )
@@ -1168,13 +1164,23 @@ static void dump_map(const char* fname)
fputc( env.map[x][y].glyph(), fp );
fputc('\n', fp);
}
- fclose(fp);
// Restore char and feature tables
Options.char_table = char_table_bk;
init_feature_table();
}
+void dump_map(const char* fname)
+{
+ FILE* fp = fopen(fname, "w");
+ if ( !fp )
+ return;
+
+ dump_map(fp);
+
+ fclose(fp);
+}
+
static bool write_dump(
const std::string &fname,
dump_params &par)