Introduce [race]undead_variation as a default for the race's [unit_type]s

This commit is contained in:
Alexander van Gessel 2011-11-05 17:16:24 +01:00
parent ac9055bbd2
commit 3867b5292c
5 changed files with 27 additions and 2 deletions

View file

@ -109,6 +109,7 @@ Version 1.9.9+svn:
* Implemented $second_unit being bound to the acting leader in recall/recruit events
* Added [secondary_unit] SUF for filtering the recalling leader in [recall] action WML
* Introduce [redraw]clear_shroud=yes|no and [redraw]<SSF> support
* Introduce [race]undead_variation as a default for the race's [unit_type]s
* Miscellaneous and bug fixes:
* Add --language/-L commandline option to set the language for that session
* Fixed: Avoid copying of singular iterators in the whiteboard code

View file

@ -309,6 +309,23 @@ Xu , Xu , Qxu , Qxu , Ql , Ql
type="Silver Mage"
name= "Hidden Teleporter"
[/unit]
[unit]
x,y=18,10
type="Soulless"
[modifications]
[object]
silent=yes
[effect]
apply_to=attack
increase_damage=50
[/effect]
[effect]
apply_to=hitpoints
increase_total=300
[/effect]
[/object]
[/modifications]
[/unit]
[/side]
[side]
side=3

View file

@ -146,7 +146,8 @@ unit_race::unit_race() :
chain_size_(0),
traits_(empty_traits().child_range("trait")),
topics_(empty_topics().child_range("topic")),
global_traits_(true)
global_traits_(true),
undead_variation_()
{
name_[MALE] = "";
name_[FEMALE] = "";
@ -161,7 +162,8 @@ unit_race::unit_race(const config& cfg) :
chain_size_(cfg["markov_chain_size"]),
traits_(cfg.child_range("trait")),
topics_(cfg.child_range("topic")),
global_traits_(!cfg["ignore_global_traits"].to_bool())
global_traits_(!cfg["ignore_global_traits"].to_bool()),
undead_variation_(cfg["undead_variation"])
{
if (id_.empty()) {

View file

@ -47,6 +47,7 @@ public:
const config::const_child_itors &additional_traits() const;
const config::const_child_itors &additional_topics() const;
unsigned int num_traits() const;
const std::string& undead_variation() const { return undead_variation_; };
private:
const config cfg_;
@ -62,6 +63,7 @@ private:
config::const_child_itors traits_;
config::const_child_itors topics_;
bool global_traits_;
std::string undead_variation_;
};
unit_race::GENDER string_gender(const std::string& str,unit_race::GENDER def=unit_race::MALE);

View file

@ -714,6 +714,9 @@ void unit_type::build_full(const movement_type_map &mv_types,
possibleTraits_.add_child("trait", t);
}
}
if (undead_variation_.empty()) {
undead_variation_ = race_->undead_variation();
}
}
// Insert any traits that are just for this unit type