Alter the special notes syntax in EffectWML so that the note macros can be reused in that context
This commit is contained in:
parent
f05f811d6c
commit
d090f91bce
4 changed files with 17 additions and 18 deletions
|
@ -49,7 +49,7 @@
|
|||
* Special notes for units now use a new system, with a `[special_note]note=` tag.
|
||||
* This tag is supported both in `[unit]` and in `[unit_type]`. If used in `[unit]`, it will override the type's notes.
|
||||
* Standard special notes should now be added with `{NOTE_*}` instead of `{SPECIAL_NOTES_*}`.
|
||||
* In `[effect]apply_to=profile`, `[add_special_note]` and `[remove_special_note]` are supported.
|
||||
* In `[effect]apply_to=profile`, `[special_note]` is now supported to add/remove special notes.
|
||||
* Support for the deprecated "&image.png=text" syntax has been removed in all contexts - use the DescriptionWML attributes instead.
|
||||
* Fix infinite recursion in SUF with [hides] and [filter_vision]. (Issue#1389)
|
||||
### Miscellaneous and bug fixes
|
||||
|
|
|
@ -103,6 +103,12 @@ _"This unit has a defense cap on certain terrain types — it cannot achieve a h
|
|||
|
||||
# New versions start here!
|
||||
|
||||
#define NOTE_REMOVE
|
||||
[+special_note]
|
||||
remove=yes
|
||||
[/special_note]
|
||||
#enddef
|
||||
|
||||
#define NOTE_SPIRIT
|
||||
[special_note]
|
||||
note={INTERNAL:SPECIAL_NOTES_SPIRIT}
|
||||
|
|
|
@ -129,14 +129,10 @@
|
|||
{SIMPLE_KEY small_portrait string}
|
||||
{SIMPLE_KEY description t_string}
|
||||
[tag]
|
||||
name="add_special_note"
|
||||
max="infinite"
|
||||
{REQUIRED_KEY note t_string}
|
||||
[/tag]
|
||||
[tag]
|
||||
name="remove_special_note"
|
||||
name="special_note"
|
||||
max="infinite"
|
||||
{REQUIRED_KEY note t_string}
|
||||
{SIMPLE_KEY remove bool}
|
||||
[/tag]
|
||||
[/case]
|
||||
[case]
|
||||
|
|
|
@ -1939,18 +1939,15 @@ void unit::apply_builtin_effect(std::string apply_to, const config& effect)
|
|||
description_ = *v;
|
||||
}
|
||||
|
||||
if(config::const_child_itors cfg_range = effect.child_range("add_special_note")) {
|
||||
if(config::const_child_itors cfg_range = effect.child_range("special_note")) {
|
||||
for(const config& c : cfg_range) {
|
||||
special_notes_.emplace_back(c["note"].t_str());
|
||||
}
|
||||
}
|
||||
|
||||
if(config::const_child_itors cfg_range = effect.child_range("remove_special_note")) {
|
||||
// TODO: Test that this works properly
|
||||
for(const config& c : cfg_range) {
|
||||
auto iter = std::find(special_notes_.begin(), special_notes_.end(), c["note"].t_str());
|
||||
if(iter != special_notes_.end()) {
|
||||
special_notes_.erase(iter);
|
||||
if(!c["remove"].to_bool()) {
|
||||
special_notes_.emplace_back(c["note"].t_str());
|
||||
} else {
|
||||
auto iter = std::find(special_notes_.begin(), special_notes_.end(), c["note"].t_str());
|
||||
if(iter != special_notes_.end()) {
|
||||
special_notes_.erase(iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue