Skip to content

Commit

Permalink
Merge branch 'staging/pr-465'
Browse files Browse the repository at this point in the history
  • Loading branch information
irydacea committed Aug 19, 2015
2 parents 66a9cb0 + a0268c7 commit 5216c54
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 28 deletions.
1 change: 1 addition & 0 deletions changelog
Expand Up @@ -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
Expand Down
28 changes: 2 additions & 26 deletions data/campaigns/Dead_Water/units/Brawler.cfg
Expand Up @@ -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]

Expand All @@ -146,10 +126,6 @@
value=no
[/effect]
[/object]

[clear_variable]
name=tmp_stunned_text
[/clear_variable]
[/event]

[event]
Expand Down
5 changes: 4 additions & 1 deletion src/game_events/action_wml.cpp
Expand Up @@ -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())
{
Expand Down
6 changes: 5 additions & 1 deletion src/unit_display.cpp
Expand Up @@ -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");
Expand Down

0 comments on commit 5216c54

Please sign in to comment.