Afforess
The White Wizard
Jdog, I've caught a minor bug in your function in "int CvPlot::calculateImprovementYieldChange(ImprovementTypes eImprovement, YieldTypes eYield, PlayerTypes ePlayer, bool bOptimal, bool bBestRoute) const".
It calculates the yield that the improvement will change on this plot. What it doesn't account for is that the minimum yield on a plot is 0. If I have a plot producing no hammers, and my improvement subtracts a hammer, your function returns -1 (causing the AI to avoid it, when it doesn't actually matter), when in reality, the improvement doesn't affect production. I suggest you return this instead:
Which would return 0 instead of -1.
It calculates the yield that the improvement will change on this plot. What it doesn't account for is that the minimum yield on a plot is 0. If I have a plot producing no hammers, and my improvement subtracts a hammer, your function returns -1 (causing the AI to avoid it, when it doesn't actually matter), when in reality, the improvement doesn't affect production. I suggest you return this instead:
Code:
int iCurrYield = calculateNatureYield(eYield, ePlayer == NO_PLAYER ? NO_TEAM : GET_PLAYER(ePlayer).getTeam(), bOptimal);
if (iCurrYield + iYield <= 0)
{
return -iCurrYield;
}
return iYield;
Which would return 0 instead of -1.