Follow-up Comment #3, patch #1063 (project wesnoth):

The patch is broken. First, instead of using spurious constructs such as
[variable] not_equals="" [/variable] (where the engine could detect it as if
the not_equals= attribute was missing altogether), you should use the new
string_length facility. This is a corrected version of the patch:

++++
#define ADVANCE_UNIT FILTER ADVANCETO
    # Advances all units matching the filter to ADVANCETO or if missing,
their normal advancement
    #
    # Example to advance all spearmen to a cavalrymen:
    #! {ADVANCE_UNIT type=Spearman Cavalryman}
    # Example to advance your leader normally:
    #! {ADVANCE_UNIT side,canrecruit=1,yes ""}
    [store_unit]
        [filter]
            {FILTER}
        [/filter]
        variable=ADVANCE_UNIT_store
        kill=no
    [/store_unit]
    [set_variable]
        name=advanceto_len
        string_length={ADVANCETO}
    [/set_variable]

    {FOREACH ADVANCE_UNIT_store i}
    [if]
        [variable]
            name=advanceto_len
            greater_than=0
        [/variable]
        [then]
            [set_variable]
                name=ADVANCE_UNIT_store[$i].advanceto
                value={ADVANCETO}
            [/set_variable]
        [/then]
    [/if]
    [set_variable]
        name=ADVANCE_UNIT_store[$i].experience
        value=$ADVANCE_UNIT_store[$i].max_experience
    [/set_variable]
    [unstore_unit]
        variable=ADVANCE_UNIT_store[$i]
        find_vacant=no
        advance=true
    [/unstore_unit]
    {NEXT i}
    {CLEAR_VARIABLE ADVANCE_UNIT_store}
    {CLEAR_VARIABLE advanceto_len}
#enddef
----

However, it still doesn't do what you wanted it to do. I set it to advance
the test scenario leader in trunk to "Rogue" by stepping on hex at 11,6, and
when the event was triggered, with neither version of the patch the leader
would advance to any unit type but himself.

    _______________________________________________________

Reply to this item at:

  <http://gna.org/patch/?1063>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs

Reply via email to