Hi,
part of the AI's decision making progress when it comes to research is invoking CvGameInterface.py. All that FFH does in there is tell certain civs to research certain techs (Khazad beeline Runes etc). Finally, if the civ doesn't have exploration, it's pushed onto the queue (why? it's not THAT important, is it? Workers having trouble when they can't build roads?) So far, so good.
Now comes the interesting bit.
The problem is with the return 1. Everything up to that point is just fine; if a tech was selected and if the player's team doesn't have it, push it onto the queue. But then the function returns a one. Let's look at where it's called:
(this is CvPlayerAI.cpp)
What happens is that AI_chooseTech is called as it should be and pushes what it should push (mostly that's exploration), but then lResult is 1. (TechTypes)1 is not NO_TECH; it's Alchemy. So eBestTech is not NO_TECH, it is TECH_ALCHEMY, and that gets pushed as well.
I am reasonably sure this is not the intended behaviour
part of the AI's decision making progress when it comes to research is invoking CvGameInterface.py. All that FFH does in there is tell certain civs to research certain techs (Khazad beeline Runes etc). Finally, if the civ doesn't have exploration, it's pushed onto the queue (why? it's not THAT important, is it? Workers having trouble when they can't build roads?) So far, so good.
Now comes the interesting bit.
Code:
if iTech != -1:
if eTeam.isHasTech(iTech) == False:
pPlayer.pushResearch(iTech, False)
return 1
The problem is with the return 1. Everything up to that point is just fine; if a tech was selected and if the player's team doesn't have it, push it onto the queue. But then the function returns a one. Let's look at where it's called:
(this is CvPlayerAI.cpp)
Code:
if (getCurrentResearch() == NO_TECH)
{
CyArgsList argsList;
long lResult;
argsList.add(getID());
argsList.add(false);
lResult = -1;
gDLL->getPythonIFace()->callFunction(PYGameModule, "AI_chooseTech", argsList.makeFunctionArgs(), &lResult);
eBestTech = ((TechTypes)lResult);
if (eBestTech == NO_TECH)
{
eBestTech = AI_bestTech((isHuman()) ? 1 : 3);
}
if (eBestTech != NO_TECH)
{
pushResearch(eBestTech);
}
}
What happens is that AI_chooseTech is called as it should be and pushes what it should push (mostly that's exploration), but then lResult is 1. (TechTypes)1 is not NO_TECH; it's Alchemy. So eBestTech is not NO_TECH, it is TECH_ALCHEMY, and that gets pushed as well.
I am reasonably sure this is not the intended behaviour
