diff options
-rw-r--r-- | crawl-ref/source/dat/entry.des | 2 | ||||
-rw-r--r-- | crawl-ref/source/dat/mini.des | 8 | ||||
-rw-r--r-- | crawl-ref/source/dat/orc.des | 18 | ||||
-rw-r--r-- | crawl-ref/source/dungeon.cc | 36 | ||||
-rw-r--r-- | crawl-ref/source/dungeon.h | 12 | ||||
-rw-r--r-- | crawl-ref/source/mapdef.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/mapdef.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/maps.cc | 18 | ||||
-rw-r--r-- | crawl-ref/source/util/levcomp.lpp | 6 |
9 files changed, 62 insertions, 42 deletions
diff --git a/crawl-ref/source/dat/entry.des b/crawl-ref/source/dat/entry.des index e1e265665b..1ea158f233 100644 --- a/crawl-ref/source/dat/entry.des +++ b/crawl-ref/source/dat/entry.des @@ -200,7 +200,7 @@ xxxxxx?x.xxxxxxxxxx xxxxxxx?.?xxxxxxxxx xxxxxxxx..?xxxxxxxx xxxxxxxxxx@xxxxxxxx -ENDMAP +ENDMAP ############################################################################## # lemuel_entrance_funnel diff --git a/crawl-ref/source/dat/mini.des b/crawl-ref/source/dat/mini.des index 45cf2bd33b..9d07dcc9c5 100644 --- a/crawl-ref/source/dat/mini.des +++ b/crawl-ref/source/dat/mini.des @@ -1225,11 +1225,11 @@ TAGS: water_ok MONS: cyclops CHANCE: 1000 MAP -.x+x. + x+x xx1xx =1O1x xx1xx -.xxx. + xxx ENDMAP ############################## @@ -1242,9 +1242,9 @@ TAGS: water_ok allow_dup MONS: cyclops CHANCE: 1000 MAP -.x+x. + x+x xx.xx =.*1x xx1xx -.xxx. + xxx ENDMAP diff --git a/crawl-ref/source/dat/orc.des b/crawl-ref/source/dat/orc.des index 2ced39e813..376d5224fc 100644 --- a/crawl-ref/source/dat/orc.des +++ b/crawl-ref/source/dat/orc.des @@ -28,13 +28,13 @@ ITEM: % / w:2 * / scroll of blinking / scroll of recharging / scroll of fear SHUFFLE: %1 ORIENT: float MAP -xxxxxxxxxxxxxxxxxxxxxxxxx -xxxxxxxxxxxxOxxxxxxxxxxxx -xxxxxxxxx.......xxxxxxxxx -xxxxxx.............xxxxxx -xxxx....x.......x....xxxx -xxx....xxx.....xxx....xxx -xx.....xxx.I.I.xxx..I..xx + xxx + xxxxOxxxx + xxxx.......xxxx + xxx.............xxx + xx....x.......x....xx + xx....xxx.....xxx....xx +xx.....xxx.I.I.xxx..I..x xx......x.......x......xx x..x.x..x..x=x..x..x+x..x x.xx.xx.x.xx=xx.x.xx~xx.x @@ -44,8 +44,8 @@ x.xx.xx.x.xx=xx.x.xx~xx.x x..x.x..x..x=x..x..x+x..x x.......+.......+.......x xx.....xxx.I.I.xxx..I..xx -xxx...xxxxx...xxxxx...xxx -xxx.@.xxxxxxxxxxxxx.@.xxx + xx...xx xx...xx xx...xx + x.@.x xxxxx x.@.x ENDMAP ############################################################################## diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index fa02233867..19399fd054 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -2538,10 +2538,14 @@ static bool safe_minivault_place(int v1x, int v1y, if (reg.overlaps_any(vault_zones)) return (false); const bool water_ok = place.map.has_tag("water_ok"); + const std::vector<std::string> &lines = place.map.map.get_lines(); for (int vx = v1x; vx < v1x + place.width; vx++) { for (int vy = v1y; vy < v1y + place.height; vy++) { + if (lines[vy - v1y][vx - v1x] == ' ') + continue; + if ((grd[vx][vy] != DNGN_FLOOR && grd[vx][vy] != DNGN_ROCK_WALL && grd[vx][vy] != DNGN_CLOSED_DOOR @@ -2564,11 +2568,14 @@ static bool connected_minivault_place(int v1x, int v1y, { /* must not be completely isolated: */ const bool water_ok = place.map.has_tag("water_ok"); + const std::vector<std::string> &lines = place.map.map.get_lines(); for (int vx = v1x; vx < v1x + place.width; vx++) { - // if (vx != v1x && vx != v1x + 12) continue; for (int vy = v1y; vy < v1y + place.height; vy++) { + if (lines[vy - v1y][vx - v1x] == ' ') + continue; + if (grd[vx][vy] == DNGN_FLOOR || grd[vx][vy] == DNGN_CLOSED_DOOR || grd[vx][vy] == DNGN_SECRET_DOOR @@ -2639,18 +2646,6 @@ static bool build_minivaults(int level_number, int force_vault) vault_zones.push_back( dgn_region(place.x, place.y, place.width, place.height)); - for (vx = v1x; vx < v1x + place.width; vx++) - { - for (vy = v1y; vy < v1y + place.height; vy++) - { - // [dshaligram] vault_main always populates vgrid[y][x] instead of - // vgrid[x][y] now. - grd[vx][vy] = - static_cast<dungeon_feature_type>( - vgrid[vy - v1y][vx - v1x] ); - } - } - // these two are throwaways: std::vector<coord_def> dummy; int num_runes = 0; @@ -2660,10 +2655,13 @@ static bool build_minivaults(int level_number, int force_vault) { for (vy = v1y; vy < v1y + place.height; vy++) { + const int feat = vgrid[vy - v1y][vx - v1x]; + if (feat == ' ') + continue; altar_count = vault_grid( place, level_number, vx, vy, altar_count, acq_item_class, - grd[vx][vy], dummy, + feat, dummy, num_runes ); } } @@ -3028,13 +3026,12 @@ static bool build_vaults(int level_number, int force_vault, int rune_subst, dgn_region this_vault(place.x, place.y, place.width, place.height); // note: assumes *no* previous item (I think) or monster (definitely) // placement - for (vx = 0; vx < GXM; vx++) + for (vx = place.x; vx < place.x + place.width; vx++) { - for (vy = 0; vy < GYM; vy++) + for (vy = place.y; vy < place.y + place.height; vy++) { - if (!this_vault.contains( coord_def(vx, vy) )) + if (vgrid[vy][vx] == ' ') continue; - altar_count = vault_grid( place, level_number, vx, vy, altar_count, acq_item_class, @@ -3309,6 +3306,9 @@ dungeon_feature_type map_feature(map_def *map, const coord_def &c, int rawfeat) { if (rawfeat == -1) rawfeat = map->glyph_at(c); + + if (rawfeat == ' ') + return (NUM_FEATURES); keyed_mapspec *mapsp = map? map->mapspec_for_key(rawfeat) : NULL; if (mapsp) diff --git a/crawl-ref/source/dungeon.h b/crawl-ref/source/dungeon.h index 34fd78690c..9182de4d5d 100644 --- a/crawl-ref/source/dungeon.h +++ b/crawl-ref/source/dungeon.h @@ -266,6 +266,18 @@ bool flood_find<fgrd, bound_check>::path_flood( } const dungeon_feature_type grid = fgrid(dc); + + if (grid == NUM_FEATURES) + { + if (want_exit) + { + greedy_dist = 100; + greedy_place = coord_def(-1, -1); + return (true); + } + return (false); + } + if (needed_features[ grid ]) { unexplored_place = dc; diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc index a4e6c6c777..fc6c0a62dc 100644 --- a/crawl-ref/source/mapdef.cc +++ b/crawl-ref/source/mapdef.cc @@ -1601,7 +1601,7 @@ void map_def::normalise() { // Minivaults are padded out with floor tiles, normal maps are // padded out with rock walls. - map.normalise(is_minivault()? '.' : 'x'); + map.normalise(' '); } std::string map_def::resolve() diff --git a/crawl-ref/source/mapdef.h b/crawl-ref/source/mapdef.h index bde13024b4..2d4b95c0dc 100644 --- a/crawl-ref/source/mapdef.h +++ b/crawl-ref/source/mapdef.h @@ -204,7 +204,7 @@ public: std::string apply_transforms(); // Make all lines the same length. - void normalise(char fillc = 'x'); + void normalise(char fillc = ' '); // Rotate 90 degrees either clockwise or anticlockwise void rotate(bool clockwise); diff --git a/crawl-ref/source/maps.cc b/crawl-ref/source/maps.cc index 95eee85414..be6aa2f249 100644 --- a/crawl-ref/source/maps.cc +++ b/crawl-ref/source/maps.cc @@ -120,6 +120,8 @@ static bool resolve_map(map_def &map, const map_def &original) mprf(MSGCH_WARN, "Lua error: %s", err.c_str()); return (false); } + + map.fixup(); err = map.resolve(); if (!err.empty()) { @@ -145,12 +147,17 @@ static bool resolve_map(map_def &map, const map_def &original) return (true); } -static bool is_grid_clobbered(int sx, int sy, int width, int height) +static bool is_grid_clobbered(const map_def &map, + int sx, int sy, int width, int height) { + const std::vector<std::string> &lines = map.map.get_lines(); for (int y = sy; y < sy + height; ++y) { for (int x = sx; x < sx + width; ++x) { + if (lines[y - sy][x - sx] == ' ') + continue; + const dungeon_feature_type grid = grd[x][y]; if (!grid_is_opaque(grid) @@ -171,8 +178,9 @@ static bool is_grid_clobbered(int sx, int sy, int width, int height) // Determines if the region specified by (x, y, x + width - 1, y + height - 1) // is a bad place to build a vault. -static bool bad_map_place(int x, int y, int width, int height, - std::vector<vault_placement> *avoid) +static bool bad_map_place(const map_def &map, + int x, int y, int width, int height, + std::vector<vault_placement> *avoid) { if (!avoid) return (false); @@ -188,7 +196,7 @@ static bool bad_map_place(int x, int y, int width, int height, return (true); } - return (is_grid_clobbered(x, y, width, height)); + return (is_grid_clobbered(map, x, y, width, height)); } static bool apply_vault_grid(map_def &def, map_type map, @@ -232,7 +240,7 @@ static bool apply_vault_grid(map_def &def, map_type map, starty = where.y; } - if (bad_map_place(startx, starty, width, height, avoid)) + if (bad_map_place(def, startx, starty, width, height, avoid)) { #ifdef DEBUG_DIAGNOSTICS mprf(MSGCH_DIAGNOSTICS, "Bad vault place: (%d,%d) dim (%d,%d)", diff --git a/crawl-ref/source/util/levcomp.lpp b/crawl-ref/source/util/levcomp.lpp index b4010596c5..6ec10124ad 100644 --- a/crawl-ref/source/util/levcomp.lpp +++ b/crawl-ref/source/util/levcomp.lpp @@ -81,10 +81,10 @@ NSPACE [^\ \t\r\n] %% -<MAPDEF>^\s*ENDMAP { BEGIN(INITIAL); } +<MAPDEF>^\s*ENDMAP[ ]* { BEGIN(INITIAL); } -<MAPDEF>^[^ \r\n\t]+ { - settext(); +<MAPDEF>^[^\r\n\t]+ { + settext(true); return MAP_LINE; } |