WeiDUorg / weidu

WeiDU is a program used to develop, distribute and install modifications for games based on the Infinity Engine.
http://www.weidu.org
GNU General Public License v2.0
90 stars 20 forks source link

TEXT_SPRINT disregards scope of variables in macros #104

Closed Argent77 closed 7 years ago

Argent77 commented 7 years ago

Action and patch versions of TEXT_SPRINT seem to disregard variables declared by LOCAL_SPRINT.

Example code:

DEFINE_ACTION_MACRO MACRO_1
BEGIN
  LOCAL_SPRINT my_string ~outer macro~
  PRINT ~MACRO_1 (before): my_string = "%my_string%"~
  LAM MACRO_2
  PRINT ~MACRO_1 (after): my_string = "%my_string%"~
END

DEFINE_ACTION_MACRO MACRO_2
BEGIN
  LOCAL_SPRINT my_string ~local~
  OUTER_TEXT_SPRINT my_string ~inner macro~
  PRINT ~MACRO_2: my_string = "%my_string%"~
END

LAM MACRO_1

Output:

MACRO_1 (before): my_string = "outer macro"

MACRO_2: my_string = "inner macro"

MACRO_1 (after): my_string = "local"

Action and patch versions of SPRINT are not affected and work as expected.

FredrikLindgren commented 7 years ago

Fixed.