#textdomain wesnoth-low

#define CHECK_CHARACTER ID MACRO PARAMETERS
    [if]
        [not]
            [have_unit]
                id={ID}
            [/have_unit]
        [/not]

        [then]
            [wml_message]
                message="{ID} is missing, assuming we are in debug mode"	# wmllint: no spellcheck
                logger=warn
            [/wml_message]

            [unit]
                {{MACRO}}
                {PARAMETERS}
            [/unit]

            [recall]
                id={ID}
            [/recall]
        [/then]
    [/if]
#enddef

#define CHECK_LANDAR
    {CHECK_CHARACTER Landar LANDAR () }
#enddef

#define CHECK_CLEODIL
    {CHECK_CHARACTER Cleodil CLEODIL () }
#enddef

#define CHECK_OLURF
    {CHECK_CHARACTER Olurf OLURF (side=1
    {IS_HERO}) }
#enddef

#define CHECK_STORE VARIABLE ID CHARACTER PARAMETERS
    [if]
        [variable]
            name={VARIABLE}.length
            equals=0
        [/variable]
        [then]
            [wml_message]
                message="{VARIABLE} is empty, assuming debug mode"	# wmllint: no spellcheck
                logger=warn
            [/wml_message]
            [unit]
                {{CHARACTER}}
                {PARAMETERS}
            [/unit]
            [store_unit]
                variable={VARIABLE}
                [filter]
                    id={ID}
                [/filter]
                kill=yes
            [/store_unit]
        [/then]
    [/if]
#enddef

#define CHECK_OLURF_STORE PARAMETERS
    {CHECK_STORE olurf_store Olurf OLURF ({PARAMETERS})}
#enddef

#define CHECK_LANDAR_STORE PARAMETERS
    {CHECK_STORE landar_store Landar LANDAR ({PARAMETERS})}
#enddef
