Skip to content
This repository has been archived by the owner on Dec 18, 2017. It is now read-only.

Autoplay mod compatibility #498

Closed
JackalWorks opened this issue Apr 15, 2017 · 2 comments
Closed

Autoplay mod compatibility #498

JackalWorks opened this issue Apr 15, 2017 · 2 comments

Comments

@JackalWorks
Copy link

JackalWorks commented Apr 15, 2017

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

@chaorace
Copy link
Member

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

@chaorace chaorace changed the title A few easy fixes to make it compatible with the autoplay mod Autoplay mod compatibility Apr 16, 2017
@JackalWorks
Copy link
Author

Credit is not a big deal, but I created a pull request anyway

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants