Gender variation for the race name displayed.

PS: for the following races i didn't add gender-specific names,
because i don't know if it make senses :

- Mechanical

- Monster

- Wose (do they have a gender ?)
This commit is contained in:
Benoît Timbert 2007-12-10 21:55:45 +00:00
parent 307a9358f8
commit f4c6304c96
5 changed files with 44 additions and 21 deletions

View file

@ -26,7 +26,7 @@ Version 1.3.12+svn:
* sound:
* new or improved sounds: ogre hit and die
* User interface
* display the race in the unit preview panel.
* display the race in the unit preview panel (with gender variation support).
* allow to use team labels also for 1-player-teams (bug #9747)
* changing the langugage now sets the version number in the title
properly.

View file

@ -40,7 +40,8 @@
[race]
id=bats
name= _ "race^Bat"
male_name= _ "race^Bat"
female_name= _ "race+female^Bat"
plural_name= _ "race^Bats"
description= ""
num_traits=2
@ -48,7 +49,8 @@
[race]
id=drake
name= _ "race^Drake"
male_name= _ "race^Drake"
female_name= _ "race+female^Drake"
plural_name= _ "race^Drakes"
description= ""
num_traits=2
@ -57,7 +59,8 @@
[race]
id=dwarf
name= _ "race^Dwarf"
male_name= _ "race^Dwarf"
female_name= _ "race+female^Dwarf"
plural_name= _ "race^Dwarves"
description= ""
num_traits=2
@ -67,7 +70,8 @@
[race]
id=elf
name= _ "race^Elf"
male_name= _ "race^Elf"
female_name= _ "race+female^Elf"
plural_name= _ "race^Elves"
description= ""
num_traits=2
@ -78,7 +82,8 @@
[race]
id=goblin
name= _ "race^Goblin"
male_name= _ "race^Goblin"
female_name= _ "race+female^Goblin"
plural_name= _ "race^Goblins"
description= ""
num_traits=2
@ -87,7 +92,8 @@
[race]
id=gryphon
name= _ "race^Gryphon"
male_name= _ "race^Gryphon"
female_name= _ "race+female^Gryphon"
plural_name= _ "race^Gryphons"
description= _ "These majestic and powerful creatures are masters of the sky. Gryphons are both dangerous and wary of other intelligent creatures, and thus should not be disturbed without a good reason."
num_traits=2
@ -96,7 +102,8 @@
[race]
id=human
name= _ "race^Human"
male_name= _ "race^Human"
female_name= _ "race+female^Human"
plural_name= _ "race^Humans"
description= ""
num_traits=2
@ -105,7 +112,8 @@
[race]
id=lizard
name= _ "race^Saurian"
male_name= _ "race^Saurian"
female_name= _ "race+female^Saurian"
plural_name= _ "race^Saurians"
description= ""
num_traits=2
@ -115,7 +123,7 @@
[race]
id=mechanical
name= _ "race^Mechanical"
name= _ "race^Mechanical"
plural_name= _ "race+plural^Mechanical"
description= ""
num_traits=1
@ -126,7 +134,8 @@
[race]
id=merman
name= _ "race^Merman"
male_name= _ "race^Merman"
female_name= _ "race^Mermaid"
plural_name= _ "race^Mermen"
description= ""
num_traits=2
@ -143,7 +152,8 @@
[race]
id=naga
name= _ "race^Naga"
male_name= _ "race^Naga"
female_name= _ "race^Nagani"
plural_name= _ "race^Nagas"
description= ""
num_traits=2
@ -152,7 +162,8 @@
[race]
id=ogre
name= _ "race^Ogre"
male_name= _ "race^Ogre"
female_name= _ "race+female^Ogre"
plural_name= _ "race^Ogres"
description= _ "Ogres are giant creatures that usually live alone in the wilderness, remarkably similar to humans in form, though large and misshapen. While they can be easily outrun or outsmarted, their strength is not to be underestimated."
num_traits=2
@ -161,7 +172,8 @@
[race]
id=orc
name= _ "race^Orc"
male_name= _ "race^Orc"
female_name= _ "race+female^Orc"
plural_name= _ "race^Orcs"
description= ""
num_traits=2
@ -170,7 +182,8 @@
[race]
id=troll
name= _ "race^Troll"
male_name= _ "race^Troll"
female_name= _ "race+female^Troll"
plural_name= _ "race^Trolls"
description= ""
num_traits=2
@ -184,7 +197,8 @@
[race]
id=undead
name= _ "race^Undead"
male_name= _ "race^Undead"
female_name= _ "race+female^Undead"
plural_name= _ "race+plural^Undead"
description= _ "Undead units are the bodies of the dead, risen to fight again."
num_traits=1

View file

@ -71,7 +71,7 @@ report generate_report(TYPE type,
case UNIT_TYPE:
return report(u->second.language_name(),"",u->second.unit_description());
case UNIT_RACE:
return report(u->second.race()->name(),"",u->second.race()->description());
return report(u->second.race()->name(u->second.gender()),"",u->second.race()->description());
case UNIT_LEVEL:
str << u->second.level();
break;

View file

@ -131,7 +131,6 @@ static wide_string markov_generate_name(const markov_prefix_map& prefixes, size_
unit_race::unit_race() :
id_(),
name_(),
plural_name_(),
description_(),
ntraits_(0),
@ -139,11 +138,12 @@ unit_race::unit_race() :
traits_(&empty_traits),
global_traits_(true)
{
name_[MALE] = "";
name_[FEMALE] = "";
}
unit_race::unit_race(const config& cfg) :
id_(cfg["id"]),
name_(cfg["name"]),
plural_name_(cfg["plural_name"]),
description_(cfg["description"]),
ntraits_(atoi(cfg["num_traits"].c_str())),
@ -163,6 +163,15 @@ unit_race::unit_race(const config& cfg) :
// This code is only for compatibility with old race defs.
plural_name_ = (cfg["name"]);
}
// use "name" if "male_name" or "female_name" aren't available
name_[MALE] = cfg["male_name"];
if(name_[MALE].empty()) {
name_[MALE] = (cfg["name"]);
}
name_[FEMALE] = cfg["female_name"];
if(name_[FEMALE].empty()) {
name_[FEMALE] = (cfg["name"]);
}
if(chain_size_ <= 0)
chain_size_ = 2;

View file

@ -33,7 +33,7 @@ public:
unit_race(const config& cfg);
const std::string& id() const { return id_; };
const t_string& name() const { return name_; };
const t_string& name(GENDER gender=MALE) const { return name_[gender]; };
const t_string& plural_name() const { return plural_name_; };
const t_string& description() const { return description_; };
@ -46,7 +46,7 @@ public:
private:
std::string id_;
t_string name_;
t_string name_[NUM_GENDERS];
t_string plural_name_;
t_string description_;
unsigned int ntraits_;