I just come across a potential show stopper if you don't have your Yields set up correctly.. which I apprently didn't or I would not be posting this.
But for the AI to use YieldsConsumed you have to make sure that if a Yield is not considered a final product in CvPlayerAI code "AI_isYieldFinalProduct" then its needs be set as the First Yield consumed for at least one profession Profession. Cause after 50 turns the AI does a check for MaintainLevel in CvPlayer::AI_doTradeRoutes and if there is no Profession Consuming the yield... Crash, Booom, bam... WTH!#@$?#$??
And make sure you have your Yield placed correctly in the CvPlayerAI::AI_isYieldFinalProduct. If its not a final product like Cotton or Ore there needs to be a check to see if a City needs the Yield as in the code below where I added in Coal. Lumber is ok not being checked cause you always produce one lumber.
Code:
bool CvPlayerAI::AI_isYieldFinalProduct(YieldTypes eYield) const
{
if (!GC.getYieldInfo(eYield).isCargo())
{
return false;
}
bool bFinal = true;
switch (eYield)
{
case YIELD_FOOD:
case YIELD_LUMBER:
bFinal = false;
break;
case YIELD_SILVER:
bFinal = true;
break;
case YIELD_COTTON:
case YIELD_FUR:
case YIELD_SUGAR:
case YIELD_TOBACCO:
case YIELD_ORE:
///TKs
case YIELD_COAL:
///TKe
{
int iLoop;
CvCity* pLoopCity = NULL;
for (pLoopCity = firstCity(&iLoop); pLoopCity != NULL; pLoopCity = nextCity(&iLoop))
{
if (pLoopCity->AI_getNeededYield(eYield) > 0)
{
bFinal = false;
break;
}
}
}
break;