mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-21 04:23:10 +00:00

Refactor special notes for abilities, attack types, movetypes and weapon specials An easier way of setting special notes in the most common use-cases. Text given in the following attributes will be collected and added to the special notes for units and unit types (some of these were added in the previous commit): * [ability tag name]special_note= * [language]special_note_damage_type_TYPE= * [movetype][special_note]note= * [attack][specials][special tag name]special_note= It's no longer necessary to put these notes in each unit_type's .cfg file, and the macros for doing so are now deprecated. C++ changes ----- Simplify both unit_type::special_notes and unit::unit_special_notes. Add utils::stable_unique, similar to std::unique but accepts non-ordered input and preserves the order in the output. Remove unit_type::has_special_notes() - callers can instead call special_notes() and then check if the returned vector is empty, which removes the need for duplicating code in unit_type. Trade-off: the new [language]special_note_damage_type_TYPE is likely deprecated in 1.19. ----- Adding [language]special_note_damage_type_TYPE= uses the same existing design as [language]type_TYPE=, however both are hacks that don't fit the general style of WML. It could be better to define a new [damage_type] tag that supercedes both and also provides a place for specifying the damage icon; however that won't be done in time for the API freeze for 1.16. Doing it in the way that this commit does it is a hack, but it's one where replacing it with the better solution in 1.18 will affect very few UMCs (only those that define additional damage types). Even in the UMCs that would be affected, it would likely only be a few changes in a single central file. Trade-off: NOTE_DEFENSE_CAP is not auto-added ----- It might be better to auto-add NOTE_DEFENSE_CAP when movetype.cpp detects that the type has capped values. However as NOTE_SPIRIT already requires [movetype][special_note], it's simple to use the same mechanism. If we decide to change it to being auto-added, the current commit greatly reduces the number of places that would need to change again, as it's now in the [movetype] instead of the many [unit_type]s using that movetype.