In: data/scripts/dlcsupport.lua:
function GetOfficialCharacterList() local list = MAIN_CHARACTERLIST if IsDLCEnabled(REIGN_OF_GIANTS) then list = JoinArrays(list, ROG_CHARACTERLIST) end if IsDLCEnabled(CAPY_DLC) then if IsDLCInstalled(REIGN_OF_GIANTS) then list = JoinArrays(list, ROG_CHARACTERLIST) end list = JoinArrays(list, SHIPWRECKED_CHARACTERLIST) end if IsDLCEnabled(PORKLAND_DLC) then if IsDLCInstalled(REIGN_OF_GIANTS) then list = JoinArrays(list, ROG_CHARACTERLIST) end if IsDLCInstalled(CAPY_DLC) then list = JoinArrays(list, SHIPWRECKED_CHARACTERLIST) end list = JoinArrays(list, PORKLAND_CHARACTERLIST) end return list end
This function is repeatedly joining arrays to the return value multiple times.
Output:
Spoiler
1 wilson 2 willow 3 wolfgang 4 wendy 5 wx78 6 wickerbottom 7 woodie 8 wes 9 waxwell 10 wathgrithr 11 webber 12 wathgrithr 13 webber 14 walani 15 warly 16 wilbur 17 woodlegs 18 wathgrithr 19 webber 20 walani 21 warly 22 wilbur 23 woodlegs 24 warbucks 25 wilba
Note the repeats of the DLC characters.
To fix, the function should be:
function GetOfficialCharacterList() local list = MAIN_CHARACTERLIST if IsDLCEnabled(REIGN_OF_GIANTS) then list = JoinArrays(list, ROG_CHARACTERLIST) end if IsDLCEnabled(CAPY_DLC) then list = JoinArrays(list, SHIPWRECKED_CHARACTERLIST) end if IsDLCEnabled(PORKLAND_DLC) then list = JoinArrays(list, PORKLAND_CHARACTERLIST) end return list end
Side note the function 'GetActiveCharacterListForSelection' right below this one should be calling this function for its initial list generation- it's copy paste code and both need to be in sync.
Example:
Spoiler
function GetActiveCharacterListForSelection() local list = GetOfficialCharacterList() for i=#list,1,-1 do for t,rchar in ipairs(RETIRED_CHARACTERLIST)do if rchar == list[i] then table.remove(list,i) end end end return JoinArrays(list, MODCHARACTERLIST) end
Steps to Reproduce
Read the files and/or use the functions. They're not right.
Read the files and/or use the functions. They're not right.
-
1
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now