Change the terrain definition tag from [terrain] to [terrain_type].

This is paraallel to the change from [unit] to [unit_type], and for
similar reasons - reduces ambiguity, enables better WML sanity
checking.
This commit is contained in:
Eric S. Raymond 2009-04-14 20:17:41 +00:00
parent 8f0fe91612
commit 25e9e53cb6
11 changed files with 299 additions and 290 deletions

View file

@ -1,19 +1,19 @@
border_size=1
usage=map
Aa^Fpa , Aa^Fpa , Ha , Ha , Ha , Aa^Fpa , Aa^Fpa , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Ww , Ww , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gg , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp
Aa^Fpa , Aa^Fpa , Ha , Ha , Ha , Aa^Fpa , Aa^Fpa , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Ww , Ww , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gg , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp
Aa^Fpa , Aa^Fpa , Aa^Fpa , Aa^Fpa , Aa^Fpa , Aa^Fpa , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gg^Ve , Gs^Fp , Ww , Ww , Gs^Fp , Gs^Fp , Gg , Ch , Gs^Fp , Gs^Fp , Gg^Fet , Gs^Fp
Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Ww^Bw/ , Gg , Gg , Ch , Ch , Kh , Gg , Gs^Fp , Gs^Fp
Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gg , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gs^Fp , Gg , Gg , Ww , Gg , Gs^Fp , Kh , Ch , Ch , Ggf , Gs^Fp , Gs^Fp
Gs^Fms , Gs^Fp , Gg^Fet , Gs^Fp , Gs^Fp , Gg^Ve , Gg , Gs^Fp , Gs^F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hh , Gs^Fmw , Wwf , Ww , Re , Re , Re , Aa^Fpa , Aa^Fpa , Aa^Fpa , Aa^Fpa , Aa^Fpa , Aa^Fpa
Ms , Aa^Fpa , Aa^Fpa , Aa , Aa , Re , Gs^Fp , Gs^Fp , Hh , Hh , Hh , Ww , Ww , Aa^Fpa , Aa^Fpa , Re , Aa^Fpa , Aa^Fpa , Aa^Fpa , Aa^Fpa , Aa^Fpa , Aa^Fpa
Ms , Aa^Fpa , Aa^Fpa , Re , Re , Hh , Hh , Hh , Hh , Gs^Fp , Wwf , Ww , Aa^Fpa , Aa^Fpa , Aa^Fpa , Aa^Fpa , Aa , Aa^Fpa , Aa^Fpa , Aa^Fpa , Aa^Fpa , Aa^Fpa
Aa^Fpa , Aa^Fpa , Aa^Fpa , Re , Ms , Ms , Ce , Re , Re , Aa , Ww , Aa , Aa^Fpa , Aa^Fpa , Aa^Fpa , Re , Re , Aa^Fpa , Aa^Fpa , Aa^Fpa , Ms , Ms

View file

@ -6,33 +6,33 @@
# the graphics layout, see terrain-graphics/_final.cfg.
#
[terrain]
[terrain_type]
symbol_image=ethereal-abyss1
id=abyss-ethereal
name=_ "Ethereal Abyss"
string=Qea
aliasof=Qt
editor_group=dm
[/terrain]
[/terrain_type]
#
# Milestones
#
[terrain]
[terrain_type]
symbol_image=../scenery/monolith1
id=milestone1
name= _ "Milestone1"
string=^Im1
aliasof=_bas
editor_group=dm
[/terrain]
[/terrain_type]
[terrain]
[terrain_type]
symbol_image=../scenery/monolith2
id=milestone2
name= _ "Milestone2"
string=^Im2
aliasof=_bas
editor_group=dm
[/terrain]
[/terrain_type]

View file

@ -1,7 +1,7 @@
#textdomain wesnoth-did
# Door-related terrain and macros ########################################
[terrain]
[terrain_type]
symbol_image=flat/road
id=door
name=_ "Door"
@ -11,5 +11,5 @@
recruit_onto=false
recruit_from=false
editor_group=did
[/terrain]
[/terrain_type]
{TERRAIN_BASE xx flat/road}

View file

@ -1,12 +1,12 @@
#textdomain wesnoth-tb
[terrain]
[terrain_type]
#impassable custom magic gate
symbol_image=../scenery/gate-rusty-se
id=magic_irongate
name= _ "Irongate"
string=Xzga
aliasof=Xu
[/terrain]
[/terrain_type]
{TERRAIN_BASE Xzga flat/road}

View file

@ -4,19 +4,19 @@
# dark tile terrain
# for this to work for some reason it has to be on the top of the list
[terrain]
[terrain_type]
symbol_image=dark_tile1
id=DarkTiles
name="Dark Tiles"
string=Ryd
aliasof=Gt
editor_group=utbs
[/terrain]
[/terrain_type]
# custom lava terrain
# similar to normal lava except that I allow units to walk across lava
[terrain]
[terrain_type]
symbol_image=lava
id=lava
name= _ "Lava"
@ -26,11 +26,11 @@
submerge=0.4
unit_height_adjust=-4
editor_group=utbs
[/terrain]
[/terrain_type]
# human ship terrain (alias of merfolk village so it can be captured)
[terrain]
[terrain_type]
symbol_image=water/coast
id=HumanShip
name= _ "Human Ship"
@ -39,20 +39,20 @@
heals=0
gives_income=true
editor_group=utbs
[/terrain]
[/terrain_type]
# desert campfire terrain
[terrain]
[terrain_type]
symbol_image=../scenery/fire1
id=DesertCampfire
name= _ "Campfire"
string=Dd^Fi
aliasof=Xt
editor_group=utbs
[/terrain]
[/terrain_type]
# phantom castle
[terrain]
[terrain_type]
symbol_image=darkcastle
id=LostCastle
name= _ "Phantom Castle"
@ -61,10 +61,10 @@
recruit_onto=true
no_overlay=true
editor_group=utbs
[/terrain]
[/terrain_type]
# phantom keep
[terrain]
[terrain_type]
symbol_image=dark-keep-throne
id=LostCastle
name= _ "Phantom Keep"
@ -74,9 +74,9 @@
recruit_from=true
no_overlay=true
editor_group=utbs
[/terrain]
[/terrain_type]
[terrain]
[terrain_type]
symbol_image=summoning-center
id=InnerSummoningCircle
name=_ "Inner Summoning Circle"
@ -86,9 +86,9 @@
recruit_from=true
no_overlay=true
editor_group=utbs
[/terrain]
[/terrain_type]
[terrain]
[terrain_type]
symbol_image=summoning-circle6
id=OuterSummoningCircle
name=_ "Outer Summoning Circle"
@ -98,4 +98,4 @@
recruit_onto=true
no_overlay=true
editor_group=utbs
[/terrain]
[/terrain_type]

File diff suppressed because it is too large Load diff

View file

@ -1356,7 +1356,7 @@ def hack_syntax(filename, lines):
print '"%s", line %d: quote-enclosing attribute value.'%(filename, i+1)
except TypeError:
pass
# Transformation for 1.7:
# Palette transformation for 1.7:
for i in range(len(lines)):
if "no-syntax-rewrite" in lines[i]:
break
@ -1368,6 +1368,15 @@ def hack_syntax(filename, lines):
elif "campaigns/" in lines[i]:
lines[i] = lines[i].replace("{~campaigns/", "{~add-ons/")
lines[i] = lines[i].replace("{@campaigns/", "{@add-ons/")
# Rename the terrAin definition tag
for i in range(len(lines)):
if "no-syntax-rewrite" in lines[i]:
break
if lines[i].startswith("#"):
pass
# Ugh...relies on code having been wmlindented
lines[i] = re.sub(r"^\[terrain\]", "[terrain_type]", lines[i])
lines[i] = re.sub(r"^\[/terrain\]", "[/terrain_type]", lines[i])
# More syntax transformations would go here.
return lines

View file

@ -119,7 +119,7 @@ gamemap::gamemap(const config& cfg, const std::string& data):
usage_(IS_MAP)
{
DBG_G << "loading map: '" << data << "'\n";
const config::const_child_itors &terrains = cfg.child_range("terrain");
const config::const_child_itors &terrains = cfg.child_range("terrain_type");
create_terrain_maps(terrains, terrainList_, tcodeToTerrain_);
read(data);
@ -330,7 +330,7 @@ void gamemap::overlay(const gamemap& m, const config& rules_cfg, int xpos, int y
if (rule != rules.second)
{
const config &cfg = *rule;
const t_translation::t_list& terrain = t_translation::read_list(cfg["terrain"]);
const t_translation::t_list& terrain = t_translation::read_list(cfg["terrain_type"]);
tmerge_mode mode = BOTH;
if (cfg["layer"] == "base") {

View file

@ -79,16 +79,16 @@ terrain_type::terrain_type(const config& cfg) :
* @todo reenable these validations. The problem is that all MP
* scenarios/campaigns share the same namespace and one rogue scenario
* can avoid the player to create a MP game. So every scenario/campaign
* should get it's own namespace to be save.
* should get it's own namespace to be safe.
*/
#if 0
VALIDATE(number_ != t_translation::NONE_TERRAIN,
missing_mandatory_wml_key("terrain", "string"));
missing_mandatory_wml_key("terrain_type", "string"));
VALIDATE(!minimap_image_.empty(),
missing_mandatory_wml_key("terrain", "symbol_image", "string",
missing_mandatory_wml_key("terrain_type", "symbol_image", "string",
t_translation::write_terrain_code(number_)));
VALIDATE(!name_.empty(),
missing_mandatory_wml_key("terrain", "name", "string",
missing_mandatory_wml_key("terrain_type", "name", "string",
t_translation::write_terrain_code(number_)));
#endif

View file

@ -104,7 +104,7 @@ bool terrain_filter::match_internal(const map_location& loc, const bool ignore_x
{
if(cfg_.has_attribute("terrain")) {
if(cache_.parsed_terrain == NULL) {
cache_.parsed_terrain = new t_translation::t_match(cfg_["terrain"]);
cache_.parsed_terrain = new t_translation::t_match(cfg_["terrain_type"]);
}
if(!cache_.parsed_terrain->is_empty) {
const t_translation::t_terrain letter = map_.get_terrain_info(loc).number();

View file

@ -129,7 +129,7 @@ unit_animation::unit_animation(int start_time,
}
unit_animation::unit_animation(const config& cfg,const std::string frame_string ) :
terrain_types_(t_translation::read_list(cfg["terrain"])),
terrain_types_(t_translation::read_list(cfg["terrain_type"])),
unit_filter_(),
secondary_unit_filter_(),
directions_(),