diff options
-rw-r--r-- | crawl-ref/source/dat/levdes.vim | 2 | ||||
-rw-r--r-- | crawl-ref/source/dat/trove.des | 2 | ||||
-rw-r--r-- | crawl-ref/source/dat/volcano.des | 2 | ||||
-rw-r--r-- | crawl-ref/source/l_dgn.cc | 54 | ||||
-rw-r--r-- | crawl-ref/source/mapdef.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/maps.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/util/levcomp.lpp | 1 | ||||
-rw-r--r-- | crawl-ref/source/util/levcomp.ypp | 10 |
8 files changed, 44 insertions, 31 deletions
diff --git a/crawl-ref/source/dat/levdes.vim b/crawl-ref/source/dat/levdes.vim index d506c76982..5f2bcfe058 100644 --- a/crawl-ref/source/dat/levdes.vim +++ b/crawl-ref/source/dat/levdes.vim @@ -51,7 +51,7 @@ syn region desNsubst start=/^NSUBST:\s*/ end=/$/ contains=desNsubstDec,desSubstA syn region desShuffle start=/^SHUFFLE:\s*/ end=/$/ contains=desShuffleDec,desMapFrag keepend -syn keyword desDeclarator NAME: ORIENT: DEPTH: PLACE: MONS: FLAGS: default-depth: TAGS: CHANCE: WEIGHT: ITEM: KFEAT: KMONS: KITEM: COLOUR: KMASK: KPROP: MARKER: LFLAGS: BFLAGS: LROCKCOL: LFLOORCOL: LFLOORTILE: LROCKTILE: FTILE: RTILE: SUBVAULT: +syn keyword desDeclarator NAME: ORIENT: DEPTH: PLACE: MONS: FLAGS: default-depth: TAGS: CHANCE: WEIGHT: ITEM: KFEAT: KMONS: KITEM: COLOUR: KMASK: KPROP: MARKER: LFLAGS: BFLAGS: LROCKCOL: LFLOORCOL: LFLOORTILE: LROCKTILE: FTILE: RTILE: SUBVAULT: BORDER: syn keyword desOrientation encompass north south east west northeast northwest southeast southwest float syn keyword desOrientation no_hmirror no_vmirror no_rotate syn keyword desOrientation entry pan lab bazaar allow_dup dummy mini_float minotaur diff --git a/crawl-ref/source/dat/trove.des b/crawl-ref/source/dat/trove.des index 224cc528d8..beabb163f4 100644 --- a/crawl-ref/source/dat/trove.des +++ b/crawl-ref/source/dat/trove.des @@ -560,8 +560,8 @@ ITEM: any good_item / any ITEM: any jewellery good_item / any good_item ITEM: acquire weapon / acquire armour / any good_item ITEM: potion of cure mutation +BORDER: deep_water : trove_setup_features(_G) -: set_border_fill_type("deep_water") MAP wwwwwwwwwwwwwwwwwwwwwwwwwwwww wwwwwwwwwwwwwwwwwwwwwwwwwwwww diff --git a/crawl-ref/source/dat/volcano.des b/crawl-ref/source/dat/volcano.des index 4fd83eddd3..90b9226a85 100644 --- a/crawl-ref/source/dat/volcano.des +++ b/crawl-ref/source/dat/volcano.des @@ -986,7 +986,7 @@ NSUBST: M = 4:1 / 1:2 / *:. NSUBST: N = 6:1 / *:. SUBST: " = ..' KFEAT: ' = alarm trap -: set_border_fill_type("open_sea") +BORDER: open_sea : fiery_humans(_G) : volcano_setup(_G) : place_chained_volcano(_G) diff --git a/crawl-ref/source/l_dgn.cc b/crawl-ref/source/l_dgn.cc index 422270dbc3..56a4ba6256 100644 --- a/crawl-ref/source/l_dgn.cc +++ b/crawl-ref/source/l_dgn.cc @@ -773,6 +773,32 @@ static int dgn_get_rock_colour(lua_State *ls) PLUARET(string, colour_to_str(env.rock_colour).c_str()); } +bool _valid_border_feat (dungeon_feature_type feat) +{ + return ((feat <= DNGN_MAXWALL && feat >= DNGN_MINWALL) + || (feat == DNGN_TREES || feat == DNGN_OPEN_SEA + || feat == DNGN_LAVA || feat == DNGN_DEEP_WATER + || feat == DNGN_SHALLOW_WATER || feat == DNGN_FLOOR)); +} + +static int dgn_border(lua_State *ls) +{ + MAP(ls, 1, map); + if (lua_gettop(ls) != 2) + luaL_error(ls, "set_border_fill_type requires a feature."); + + std::string fill_string = luaL_checkstring(ls, 2); + dungeon_feature_type fill_type = dungeon_feature_by_name(fill_string); + + if (_valid_border_feat(fill_type)) + map->border_fill_type = fill_type; + else + luaL_error(ls, ("set_border_fill_type cannot be the feature '" + + fill_string +"'.").c_str()); + + PLUARET(string, dungeon_feature_name(map->border_fill_type)); +} + static int _lua_colour(lua_State *ls, int ndx, int forbidden_colour = -1) { @@ -920,32 +946,6 @@ static int lua_dgn_set_lt_callback(lua_State *ls) return (0); } -bool _valid_border_feat (dungeon_feature_type feat) -{ - return ((feat <= DNGN_MAXWALL && feat >= DNGN_MINWALL) - || (feat == DNGN_TREES || feat == DNGN_OPEN_SEA - || feat == DNGN_LAVA || feat == DNGN_DEEP_WATER - || feat == DNGN_SHALLOW_WATER || feat == DNGN_FLOOR)); -} - -static int lua_dgn_set_border_fill_type (lua_State *ls) -{ - MAP(ls, 1, map); - if (lua_gettop(ls) != 2) - luaL_error(ls, "set_border_fill_type requires a feature."); - - std::string fill_string = luaL_checkstring(ls, 2); - dungeon_feature_type fill_type = dungeon_feature_by_name(fill_string); - - if (_valid_border_feat(fill_type)) - map->border_fill_type = fill_type; - else - luaL_error(ls, ("set_border_fill_type cannot be the feature '" + - fill_string +"'.").c_str()); - - return (0); -} - static int dgn_fixup_stairs(lua_State *ls) { const dungeon_feature_type up_feat = @@ -1711,6 +1711,7 @@ const struct luaL_reg dgn_dlib[] = { "colour", dgn_colour }, { "lfloorcol", dgn_lfloorcol}, { "lrockcol", dgn_lrockcol}, +{ "border", dgn_border}, { "normalise", dgn_normalise }, { "map", dgn_map }, { "mons", dgn_mons }, @@ -1746,7 +1747,6 @@ const struct luaL_reg dgn_dlib[] = { "change_floor_colour", dgn_change_floor_colour }, { "change_rock_colour", dgn_change_rock_colour }, { "set_lt_callback", lua_dgn_set_lt_callback }, -{ "set_border_fill_type", lua_dgn_set_border_fill_type }, { "fixup_stairs", dgn_fixup_stairs }, { "floor_halo", dgn_floor_halo }, { "random_walk", dgn_random_walk }, diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc index 2d04e483be..9684032f2e 100644 --- a/crawl-ref/source/mapdef.cc +++ b/crawl-ref/source/mapdef.cc @@ -1989,6 +1989,7 @@ void map_def::write_index(writer& outf) const marshallString4(outf, place_loaded_from.filename); marshallLong(outf, place_loaded_from.lineno); marshallShort(outf, orient); + marshallShort(outf, static_cast<short>(border_fill_type)); marshallLong(outf, chance_priority); marshallLong(outf, chance); marshallLong(outf, weight); @@ -2005,6 +2006,7 @@ void map_def::read_index(reader& inf) unmarshallString4(inf, place_loaded_from.filename); place_loaded_from.lineno = unmarshallLong(inf); orient = static_cast<map_section_type>( unmarshallShort(inf) ); + border_fill_type = static_cast<dungeon_feature_type>( unmarshallShort(inf) ); chance_priority = unmarshallLong(inf); chance = unmarshallLong(inf); weight = unmarshallLong(inf); diff --git a/crawl-ref/source/maps.h b/crawl-ref/source/maps.h index c05d5515b5..37f0f22841 100644 --- a/crawl-ref/source/maps.h +++ b/crawl-ref/source/maps.h @@ -66,7 +66,7 @@ typedef std::vector<coord_def> point_vector; extern map_place_check_t map_place_valid; extern point_vector map_anchor_points; -const int MAP_CACHE_VERSION = 1011; +const int MAP_CACHE_VERSION = 1012; #ifdef DEBUG_DIAGNOSTICS diff --git a/crawl-ref/source/util/levcomp.lpp b/crawl-ref/source/util/levcomp.lpp index 151ef1418e..10db92e912 100644 --- a/crawl-ref/source/util/levcomp.lpp +++ b/crawl-ref/source/util/levcomp.lpp @@ -249,6 +249,7 @@ LFLOORCOL: { CBEGIN(ARGUMENT); return LFLOORCOL; } LROCKCOL: { CBEGIN(ARGUMENT); return LROCKCOL; } LFLOORTILE: { CBEGIN(ARGUMENT); return LFLOORTILE; } LROCKTILE: { CBEGIN(ARGUMENT); return LROCKTILE; } +BORDER: { CBEGIN(ARGUMENT); return BORDER; } FTILE: { CBEGIN(ITEM_LIST); return FTILE; } RTILE: { CBEGIN(ITEM_LIST); return RTILE; } MONS: { CBEGIN(MNAME); return MONS; } diff --git a/crawl-ref/source/util/levcomp.ypp b/crawl-ref/source/util/levcomp.ypp index f13f102da0..ad0335b5a3 100644 --- a/crawl-ref/source/util/levcomp.ypp +++ b/crawl-ref/source/util/levcomp.ypp @@ -55,6 +55,7 @@ level_range set_range(const char *s, int start, int end) %token <i> NAME DEPTH ORIENT PLACE CHANCE WEIGHT MONS ITEM MARKER COLOUR %token <i> PRELUDE MAIN VALIDATE VETO NSUBST WELCOME LFLAGS BFLAGS %token <i> LFLOORCOL LROCKCOL LFLOORTILE LROCKTILE FTILE RTILE SUBVAULT +%token <i> BORDER %token <i> COMMA COLON PERC INTEGER CHARACTER @@ -164,6 +165,7 @@ metaline : place | lrockcol | lfloortile | lrocktile + | border | ftile | rtile | shuffle @@ -404,6 +406,14 @@ lrocktile : LROCKTILE { } quote_lua_string($2).c_str())); } +border : BORDER { } + | BORDER STRING + { + lc_map.main.add( + yylineno, + make_stringf("border(\"%s\")", + quote_lua_string($2).c_str())); + } ftile : FTILE ftile_specifiers ; |