Merge branch 'female_text' of https://github.com/CelticMinstrel/wesnoth into staging/pr-465

This commit is contained in:
Ignacio R. Morelle 2015-08-18 21:31:12 -03:00
commit a0268c7ccc
4 changed files with 12 additions and 28 deletions

View file

@ -36,6 +36,7 @@ Version 1.13.1+dev:
* Added support for has_flag= in terrain graphics [variant].
* Added category= to [label] - allows grouping labels so that players can
show/hide them
* Add female_text= to [animate_unit] and [unstore_unit] for easier translating
* The WML preprocessor now writes warnings to stderr for macros redefined
without #undef, to help detect unintentional name clashes.
* Fix macro definition line numbers being offset by 1 in WML preprocessor

View file

@ -100,31 +100,11 @@
{VARIABLE second_unit.status.stunned yes}
[if]
[variable]
name=second_unit.gender
equals=female
[/variable]
[then]
[set_variable]
name=tmp_stunned_text
value= _ "female^stunned"
[/set_variable]
[/then]
[else]
[set_variable]
name=tmp_stunned_text
value= _ "stunned"
[/set_variable]
[/else]
[/if]
[unstore_unit]
variable=second_unit
find_vacant=no
text=$tmp_stunned_text
text= _ "stunned"
female_text= _ "female^stunned"
red,green,blue=196,196,128
[/unstore_unit]
@ -146,10 +126,6 @@
value=no
[/effect]
[/object]
[clear_variable]
name=tmp_stunned_text
[/clear_variable]
[/event]
[event]

View file

@ -1684,7 +1684,10 @@ WML_HANDLER_FUNCTION(unstore_unit, /*event_info*/, cfg)
resources::units->erase(loc);
resources::units->add(loc, *u);
std::string text = cfg["text"];
config::attribute_value text = var["gender"].str() == "female" ? cfg["female_text"] : cfg["male_text"];
if(text.blank()) {
text = cfg["text"];
}
play_controller *controller = resources::controller;
if(!text.empty() && !controller->is_skipping_replay())
{

View file

@ -868,9 +868,13 @@ void wml_animation_internal(unit_animator &animator, const vconfig &cfg, const m
secondary_loc = u->get_location().get_direction(dir);
}
}
config::attribute_value text = u->gender() == unit_race::FEMALE ? cfg["female_text"] : cfg["male_text"];
if(text.blank()) {
text = cfg["text"];
}
animator.add_animation(&*u, cfg["flag"], u->get_location(),
secondary_loc, cfg["value"], cfg["with_bars"].to_bool(),
cfg["text"], text_color, hits, primary, secondary,
text.str(), text_color, hits, primary, secondary,
cfg["value_second"]);
}
const vconfig::child_list sub_anims = cfg.get_children("animate");