Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move away from [+tag] macros #8762

Open
soliton- opened this issue Apr 14, 2024 · 1 comment
Open

Move away from [+tag] macros #8762

soliton- opened this issue Apr 14, 2024 · 1 comment
Labels
Enhancement Issues that are requests for new features or changes to existing ones. Good first issue Issues deemed adequate for contributors without prior experience to work on. WML Issues involving the WML engine or WML APIs.

Comments

@soliton-
Copy link
Member

Describe the desired feature

It'd be good to move away from macros of the form:

#define GUARDIAN
# Meant to be used as a suffix to a unit-generating macro call.
[+unit]
ai_special=guardian
[/unit]
#enddef

which are most commonly used following unit creation macro calls. I think it's a bad habit especially in core macros.

We should either use a macro tailored for the use case that includes the additional parts or use a generic macro that allows adding whatever WML when calling the macro as in the case of the UNIT macro for example.

#define UNIT SIDE TYPE X Y WML
# Place a unit with embedded WML specified.
#
[unit]
side={SIDE}
type={TYPE}
x={X}
y={Y}
{WML}
[/unit]
#enddef

When calling that macro the WML parameter there could be ai_special=guardian for example which completely avoids the need for the first macro.

I think one simple step would be to add an optional WML parameter to all core macros that would benefit from it or at least those that are currently used with [+tag] macros following them (for example LOYAL_UNIT). And then remove all instances of [+tag] macro calls following these macros and put the respective WML in that macro call instead.

For example {LOYAL_UNIT 1 Spearman 1 1} followed by {GUARDIAN} would become {LOYAL_UNIT 1 Spearman 1 1 (ai_special=guardian)}.

The obsolete [+tag] macros can then be deprecated indefinitely.

(See #7883 for one such macro example. That issue is mixed with using different defaults for unit macros though.)

@soliton- soliton- added Enhancement Issues that are requests for new features or changes to existing ones. Good first issue Issues deemed adequate for contributors without prior experience to work on. labels Apr 14, 2024
@CelticMinstrel
Copy link
Member

With the advent of optional macro parameters, I wonder if perhaps it's a good idea to consolidate all the unit macros into a single macro for placing a unit… though I think this still isn't quite possible. I don't know of any way to have an optional parameter that makes the unit loyal if present, for example. We'd probably need something like #ifarg?

@Wedge009 Wedge009 added the WML Issues involving the WML engine or WML APIs. label Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Issues that are requests for new features or changes to existing ones. Good first issue Issues deemed adequate for contributors without prior experience to work on. WML Issues involving the WML engine or WML APIs.
Projects
None yet
Development

No branches or pull requests

3 participants