Terrain types can now have description attributes.

If present, these override the name attribute for the "outside"
portion of the human-readable terrain description, e.g.  the part not
in parentheses.

The main use for this is editor palette tooltips; they now say, for
example, "Summer Deciduous Forest (Forest)".  I've also wired things
so that the normal in-game terrain report uses description rather than
name when it's available, as a demonstration (that's the diff to
generate.report.cpp) but it might be that level of detail is not
actually desirable in the game itself.
This commit is contained in:
Eric S. Raymond 2009-04-15 07:55:31 +00:00
parent bc01f2b041
commit 89bd5dff5a
5 changed files with 33 additions and 3 deletions

View file

@ -251,6 +251,7 @@
symbol_image=castle/encampment-keep-tile
id=encampment_keep
name= _ "Keep"
description=_ "Encampment Keep"
string=Ke
aliasof=Ch
unit_height_adjust=0
@ -263,6 +264,7 @@
symbol_image=castle/keep-tile
id=human_keep
name= _ "Keep"
description=_ "Castle Keep"
string=Kh
aliasof=Ch
unit_height_adjust=20
@ -275,6 +277,7 @@
symbol_image=castle/elven/keep-tile
id=elven_keep
name= _ "Keep"
description=_ "Elven Keep"
string=Kv
aliasof=Ch
unit_height_adjust=20
@ -287,6 +290,7 @@
symbol_image=castle/dwarven-keep-tile
id=dwarven_keep
name= _ "Keep"
description=_ "Castle Keep"
string=Kud
aliasof=Ch
unit_height_adjust=0
@ -299,6 +303,7 @@
symbol_image=castle/ruined-keep-tile
id=ruined_keep
name= _ "Keep"
description=_ "Ruined Castle Keep"
string=Khr
aliasof=Ch
unit_height_adjust=20
@ -311,6 +316,7 @@
symbol_image=castle/sunken-keep-tile
id=sunken_keep
name= _ "Keep"
description=_ "Sunken Castle Keep"
string=Khw
aliasof=Ch, Ww
unit_height_adjust=20
@ -323,6 +329,7 @@
symbol_image=castle/swamp-keep-tile
id=swamp_keep
name= _ "Keep"
description=_ "Castle Keep"
string=Khs
aliasof=Ch, Ss
unit_height_adjust=20
@ -426,6 +433,7 @@
symbol_image=forest/snow-forest-tile
id=snow_forest
name= _ "Snow Forest"
description=_ "Snowy Pine Forest"
string=^Fpa
default_base=Aa
aliasof=At,^Fp
@ -447,6 +455,7 @@
symbol_image=forest/pine-tile
id=forest
name= _ "Forest"
description=_ "Pine Forest"
string=^Fp
default_base=Gs
editor_group=forest
@ -466,6 +475,7 @@
symbol_image=forest/deciduous-summer-tile
id=deciduous_forest_summer
name=_ "Forest"
description=_ "Summer Deciduous Forest"
string=^Fds
default_base=Gs
aliasof=^Fp
@ -476,6 +486,7 @@
symbol_image=forest/deciduous-fall-tile
id=deciduous_forest_fall
name=_ "Forest"
description=_ "Fall Deciduous Forest"
string=^Fdf
default_base=Gs
aliasof=^Fp
@ -486,6 +497,7 @@
symbol_image=forest/deciduous-winter-tile
id=deciduous_forest_winter
name=_ "Forest"
description=_ "Winter Deciduous Forest"
string=^Fdw
default_base=Gs
aliasof=^Fp
@ -496,6 +508,7 @@
symbol_image=forest/deciduous-winter-snow-tile
id=deciduous_forest_winter_snow
name=_ "Snow Forest"
description=_ "Snowy Deciduous Forest"
string=^Fda
default_base=Aa
aliasof=At,^Fp
@ -507,6 +520,7 @@
symbol_image=forest/mixed-summer-tile
id=mixed_forest_summer
name=_ "Forest"
description=_ "Summer Mixed Forest"
string=^Fms
default_base=Gs
aliasof=^Fp
@ -517,6 +531,7 @@
symbol_image=forest/mixed-fall-tile
id=mixed_forest_fall
name=_ "Forest"
description=_ "Fall Mixed Forest"
string=^Fmf
default_base=Gs
aliasof=^Fp
@ -527,6 +542,7 @@
symbol_image=forest/mixed-winter-tile
id=mixed_forest_winter
name=_ "Forest"
description=_ "Winter Mixed Forest"
string=^Fmw
default_base=Gs
aliasof=^Fp
@ -537,6 +553,7 @@
symbol_image=forest/mixed-winter-snow-tile
id=mixed_forest_winter_snow
name=_ "Snow Forest"
description=_ "Snowy Mixed Forest"
string=^Fma
default_base=Aa
aliasof=At,^Fp
@ -572,6 +589,7 @@
symbol_image=forested-deciduous-summer-hills-tile
id=deciduous_forest_summer_hills
name=_ "Forested Hills"
description=_ "Summer Deciduous Forested Hills"
string=Hh^Fds
aliasof=Hh,^Fp
mvt_alias=-,Hh,^Fp
@ -582,6 +600,7 @@
symbol_image=forested-deciduous-fall-hills-tile
id=deciduous_forest_fall_hills
name=_ "Forested Hills"
description=_ "Fall Deciduous Forested Hills"
string=Hh^Fdf
aliasof=Hh,^Fp
mvt_alias=-,Hh,^Fp
@ -592,6 +611,7 @@
symbol_image=forested-deciduous-winter-hills-tile
id=deciduous_forest_winter_hills
name=_ "Forested Hills"
description=_ "Winter Deciduous Forested Hills"
string=Hh^Fdw
aliasof=Hh,^Fp
mvt_alias=-,Hh,^Fp
@ -602,6 +622,7 @@
symbol_image=forested-deciduous-winter-snow-hills-tile
id=deciduous_forest_winter_snow_hills
name=_ "Forested Snow Hills"
description=_ "Snowy Deciduous Forested Hills"
string=Ha^Fda
aliasof=Ha,^Fp
mvt_alias=-,Ha,^Fp
@ -612,6 +633,7 @@
symbol_image=forested-mixed-summer-hills-tile
id=mixed_forest_summer_hills
name=_ "Forested Hills"
description=_ "Summer Mixed Forested Hills"
string=Hh^Fms
aliasof=Hh,^Fp
mvt_alias=-,Hh,^Fp
@ -632,6 +654,7 @@
symbol_image=forested-mixed-winter-hills-tile
id=mixed_forest_winter_hills
name=_ "Forested Hills"
description=_ "Winter Mixed Forested Hills"
string=Hh^Fmw
aliasof=Hh,^Fp
mvt_alias=-,Hh,^Fp
@ -642,6 +665,7 @@
symbol_image=forested-mixed-winter-snow-hills-tile
id=mixed_forest_winter_snow_hills
name=_ "Forested Snow Hills"
description=_ "Snowy Mixed Forested Hills"
string=Ha^Fma
aliasof=Ha,^Fp
mvt_alias=-,Ha,^Fp
@ -728,6 +752,7 @@
symbol_image=desert-mountains
id=desert_mountains
name= _ "Mountains"
description=_ "Desert Mountains"
string=Md
aliasof=Mm
editor_group=rough, desert
@ -745,6 +770,7 @@
symbol_image=snow-mountain-tile
id=snow_mountains
name= _ "Mountains"
description = _"Snowy Mountains"
string=Ms
aliasof=At, Mm
mvt_alias=-,At, Mm

View file

@ -433,7 +433,7 @@ Units cannot be killed by poison alone. The poison will not reduce it below 1 HP
}
str << " ";
} else {
str << map.get_terrain_info(terrain).name();
str << map.get_terrain_info(terrain).description();
}
if(underlying.size() != 1 || underlying.front() != terrain) {

View file

@ -83,7 +83,7 @@ const t_translation::t_list& gamemap::underlying_union_terrain(t_translation::t_
std::string gamemap::get_terrain_string(const t_translation::t_terrain& terrain) const
{
std::stringstream ss;
const std::string& name = get_terrain_info(terrain).name();
const std::string& name = get_terrain_info(terrain).description();
const t_translation::t_list& underlying = underlying_union_terrain(terrain);
assert(!underlying.empty());
ss << name;

View file

@ -26,6 +26,7 @@ terrain_type::terrain_type() :
editor_image_("void"),
id_(),
name_(),
description_(),
number_(t_translation::VOID_TERRAIN),
mvt_type_(1, t_translation::VOID_TERRAIN),
def_type_(1, t_translation::VOID_TERRAIN),
@ -54,6 +55,7 @@ terrain_type::terrain_type(const config& cfg) :
editor_image_(cfg["editor_image"]),
id_(cfg["id"]),
name_(cfg["name"]),
description_(cfg["description"]),
number_(t_translation::read_terrain_code(cfg["string"])),
mvt_type_(),
def_type_(),

View file

@ -33,6 +33,7 @@ public:
const std::string& minimap_image_overlay() const { return minimap_image_overlay_; }
const std::string& editor_image() const { return editor_image_; }
const t_string& name() const { return name_; }
const t_string& description() const { return description_.empty() ? name_ : description_; }
const std::string& id() const { return id_; }
bool hide_in_editor() const { return hide_in_editor_; }
@ -84,11 +85,12 @@ private:
std::string editor_image_;
std::string id_;
t_string name_;
t_string description_;
//the 'number' is the number that represents this
//terrain type. The 'type' is a list of the 'underlying types'
//of the terrain. This may simply be the same as the number.
//This is the internal number used, WML still used characters
//This is the internal number used, WML still uses character strings.
t_translation::t_terrain number_;
t_translation::t_list mvt_type_;
t_translation::t_list def_type_;