From a1d6cda4bbcd9cdb9c10aabbf765fa1c02c941fe Mon Sep 17 00:00:00 2001 From: dshaligram Date: Thu, 10 Apr 2008 00:24:08 +0000 Subject: 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 --- crawl-ref/source/chardump.cc | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'crawl-ref/source/chardump.cc') 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 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) -- cgit v1.2.3-54-g00ecf