davidlallen
Deity
I have just added some projects in xml, which require other projects as prerequisites. In vanilla, for example, the spaceship part projects require the apollo project to be complete first:
I have a line of four projects, each requiring the previous. So at the start of the game, only the first one should be available to be built and the others should not be. But, in my city build queue, I see all four available to be built. This is wrong.
Looking into CvPlayer::canCreate(), I see that there is a loop to check this:
This loop is inside a test !bTestVisible, which I see in many such canXxx() functions. Can anybody help me understand what this flag is for, and why this loop should only be checked when this flag is false?
The only reason I can think of for all my projects to appear in the queue, is if CvPlayer::canCreate() is called with bTestVisible true. If that is the problem, then other projects like the space ship parts should be available without their prerequisites. I cannot quite follow the call stack all the way up, to figure it out.
Code:
<PrereqProjects>
<PrereqProject>
<ProjectType>PROJECT_APOLLO_PROGRAM</ProjectType>
<iNeeded>1</iNeeded>
</PrereqProject>
</PrereqProjects>
I have a line of four projects, each requiring the previous. So at the start of the game, only the first one should be available to be built and the others should not be. But, in my city build queue, I see all four available to be built. This is wrong.
Looking into CvPlayer::canCreate(), I see that there is a loop to check this:
Code:
for (iI = 0; iI < GC.getNumProjectInfos(); iI++)
{
if (GET_TEAM(getTeam()).getProjectCount((ProjectTypes)iI) < GC.getProjectInfo(eProject).getProjectsNeeded(iI))
{
return false;
}
}
The only reason I can think of for all my projects to appear in the queue, is if CvPlayer::canCreate() is called with bTestVisible true. If that is the problem, then other projects like the space ship parts should be available without their prerequisites. I cannot quite follow the call stack all the way up, to figure it out.