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
87 stars 19 forks source link

ADD_JOURNAL should not reuse mod-specific variables #201

Closed Argent77 closed 2 years ago

Argent77 commented 3 years ago

Defining an array called "titles" in a mod seems to interfere with the execution of ADD_JOURNAL and results in the creation of invalid journal entries in bgee.lua.

Test script:

// Initializing the array "titles" which might be used for anything within the mod
OUTER_FOR (i = 1; i <= 10; ++i) BEGIN
  OUTER_SET $titles(~random_string_for_internal_use_only_%i%~) = 12345
END

ADD_JOURNAL TITLE (#1) #2 #3 #4 #5 #6

Resulting entries in bgee.lua:

createEntry    ( 12345, -1, random_string_for_internal_use_only_1, {}, nil )
createEntry    ( 12345, -1, random_string_for_internal_use_only_2, {}, nil )
createEntry    ( 12345, -1, random_string_for_internal_use_only_3, {}, nil )
createEntry    ( 12345, -1, random_string_for_internal_use_only_4, {}, nil )
createEntry    ( 12345, -1, random_string_for_internal_use_only_5, {}, nil )
createEntry    ( 12345, -1, random_string_for_internal_use_only_6, {}, nil )
createEntry    ( 12345, -1, random_string_for_internal_use_only_7, {}, nil )
createEntry    ( 12345, -1, random_string_for_internal_use_only_8, {}, nil )
createEntry    ( 12345, -1, random_string_for_internal_use_only_9, {}, nil )
createEntry    ( 12345, -1, random_string_for_internal_use_only_10, {}, nil )
createEntry    ( 1, -1, 2, {}, nil )
createEntry    ( 1, -1, 3, {}, nil )
createEntry    ( 1, -1, 4, {}, nil )
createEntry    ( 1, -1, 5, {}, nil )
createEntry    ( 1, -1, 6, {}, nil )
FredrikLindgren commented 3 years ago

Thanks for reporting. Will fix.