[DLL] Making puppets purchase according to "automatic faith selection"?

Decker87

Chieftain
Joined
Oct 28, 2010
Messages
46
I've created a mod I call "Smart Puppets", where puppeted cities will build more things according to how much benefit they will provide. Gone are the days of watching my Egypt puppets not build burial tombs or my Mayan puppets not build pyramids.

The next step I'd like to do is make puppets purchase religious buildings according to the "automatic faith selection" that is in-game. I'm looking around line 900 of CvCityStrategyAI.cpp, where build orders are pushed for puppets.

However, I don't see any clear interface or example on how to make automatic faith selections extend to puppeted cities. Can anyone provide a tip on how to do this?
 
I believe line 40 of CvCity.cpp is my ticket:

// Is this city allowed to purchase something right now?
bool CvCity::IsCanPurchase(bool bTestPurchaseCost, bool bTestTrainable, UnitTypes eUnitType, BuildingTypes eBuildingType, ProjectTypes eProjectType, YieldTypes ePurchaseYield)
{
CvAssertMsg(eUnitType >= 0 || eBuildingType >= 0 || eProjectType >= 0, "No valid passed in");
CvAssertMsg(!(eUnitType >= 0 && eBuildingType >= 0) && !(eUnitType >= 0 && eProjectType >= 0) && !(eBuildingType >= 0 && eProjectType >= 0), "Only one being passed");

// Can't purchase anything in a puppeted city
if (IsPuppet())
{
return false;
}
 
Back
Top Bottom