Bonus Prereq for Projects

Tholish

Emperor
Joined
Jul 5, 2002
Messages
1,344
Location
Japan
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;
	}
 
A xml-tag for this would be great. So you could a project require a certain resource to make it available and another to give it a speedbonus.
I.e. the Manhattan-project requires uranium to be built while iron could give it a 25% speedbonus.
 
Top Bottom