In my FutureMod, I had a problem with AI Civs on future era starts lavishing produciton on Spaceship Parts right out of the gate, before even building basic infrastructure. So, I looked for the simplest way to correct this behavior and modified the DLL so that Projects cannot be built unless they get a plus to production of the project from a bonus. Thus, I piggyback an existing XML tag and the bonuses don't just help you build the project faster you absolutely must have them or the project is not available. If anyone is interested, I can make this a general purpose modcomp with entire modified source file and dll. Anyway, here's the changed code
Code:
bool CvCity::canCreate(ProjectTypes eProject, bool bContinue, bool bTestVisible) const
{
CyCity* pyCity = new CyCity((CvCity*)this);
CyArgsList argsList;
argsList.add(gDLL->getPythonIFace()->makePythonObject(pyCity)); // pass in city class
argsList.add(eProject);
argsList.add(bContinue);
argsList.add(bTestVisible);
long lResult=0;
gDLL->getPythonIFace()->callFunction(PYGameModule, "canCreate", argsList.makeFunctionArgs(), &lResult);
delete pyCity; // python fxn must not hold on to this pointer
//tholish's check to require bonuses for projects
int iMultiplier=0;
for (int iI = 0; iI < GC.getNumBonusInfos(); iI++)
{
if (hasBonus((BonusTypes)iI))
{
iMultiplier += GC.getProjectInfo(eProject).getBonusProductionModifier(iI);
}
}
if (iMultiplier < 1)
{
return false;
}