Autoplay mod compatibility
JackalWorks opened this issue · comments
When running in Autoplay using the autoplay mod, there are references to the LocalPlayer which will sometimes return -1 and thus nil in certain functions. I have found two places in this mods UnitFlagManager.lua and can be fixed like this:
In UnitFlag.SetColor (around lines 508) wrap the "War Check" with
if Game.GetLocalPlayer() > -1 then
-- War Check
[...]
end
and in OnPlayerTurnActivated (line 1464) after
local idLocalPlayer = Game.GetLocalPlayer();
insert
if idLocalPlayer < 0 then
return
end
Edit:
also line 163 and 187 should be changed to
if(CQUI_ShowPaths) and (Game.GetLocalPlayer() > -1) then
Alright, thanks for sharing! If you'd like to be properly credited for this fix, then please use the "Fork" button near the top and use the web editor to commit the changes. Finally, use the "Pull Request" button to submit your proposed changes. If that seems like altogether too much work, that's fine too, but you won't show up in the Github contributor list and it will be harder to claim credit for helping with this project as a result
Credit is not a big deal, but I created a pull request anyway