CvUnit* enemy = pLoopPlot->getBestDefender(NO_PLAYER,getOwnerINLINE()); //wish I could use the summoned unit here
// Smarter Ocs start- crash fix.
if (enemy != NULL)
{
if (((pPlotCity != NULL) && GET_TEAM(getTeam()).isHasTech((TechTypes)(GC.getBonusInfo(eNonObsoleteBonus).getTechCityTrade()))) ||
// if (GET_TEAM(getTeam()).isHasTech((TechTypes)(GC.getBonusInfo(eNonObsoleteBonus).getTechCityTrade()))) // BetterAI // Smarter Orcs - defective; reverted to older code.
// {
// if (pPlotCity != NULL || // BetterAI// Smarter Orcs - defective; reverted to older code.
iValue /= (max(0, (iDifferentAreaTile - ((iNumCityPlots * 2) / 3))) + 2);
iValue /= (max(1, (iDifferentAreaTile - ((iNumCityPlots * 2) / 3))) + 2); // Smarter Orcs fix
iValue /= (max(0, (iBadTile - (iNumCityPlots / 4))) + 3);
iValue /= (max(1, (iBadTile - (iNumCityPlots / 4))) + 3); // Smarter Orcs fix.
if (GET_PLAYER(getOwnerINLINE()).AI_getAttitude(pLoopPlot->getOwnerINLINE()) == ATTITUDE_FRIENDLY)
{
iValue /= 10;
}
if (GET_PLAYER(getOwnerINLINE()).AI_getAttitude(pLoopPlot->getOwnerINLINE()) == ATTITUDE_FRIENDLY)
{
iTempValue /= 10; // Smarter Orcs defect fix.
}
if ((iTempValue > 80) && (pLoopPlot->getOwnerINLINE() == getID()))
{
//captured territory special case
iTempValue *= (100 - iTempValue);
iTempValue /= 100;
}
// Smarter Orcs start
if ((iTempValue > 80) && (pLoopPlot->findHighestCultureTeam() != getTeam()) &&
(pLoopPlot->getTeam() != pLoopPlot->findHighestCultureTeam()))
{
//captured territory special case
iTempValue *= (100 - iPlotOwnedPercent);
// Smarter Orcs end
iTempValue /= 100;
}
iProductionAdvantage = ((iProductionAdvantage * (iNumCities - 1) + 200) / (iNumCities + 1));
//Smarter Orcs start - patch to prevent crash
if (iProductionAdvantage <= 0)
{
iProductionAdvantage = 1;
}
// Smarter Orcs end
iProductionMultiplier *= iProductionAdvantage;
iProductionMultiplier /= 100;
iCommerceMultiplier *= 100;
iCommerceMultiplier /= iProductionAdvantage;
int iGreatPeopleAdvantage = 100 * getTotalGreatPeopleRateModifier();
iGreatPeopleAdvantage /= GET_PLAYER(getOwnerINLINE()).AI_averageGreatPeopleMultiplier();
iGreatPeopleAdvantage = ((iGreatPeopleAdvantage * (iNumCities - 1) + 200) / (iNumCities + 1));
iGreatPeopleAdvantage += 200; //gpp multipliers are larger than others so lets not go overboard
iGreatPeopleAdvantage /= 3;
//Smarter Orcs start - patch to prevent crash
if (iGreatPeopleAdvantage <= 0)
{
iGreatPeopleAdvantage = 1;
}
// Smarter Orcs end
//With great people we want to slightly increase food priority at the expense of commerce
//this gracefully handles both wonder and specialist based GPP...
iCommerceMultiplier *= 100;
iCommerceMultiplier /= iGreatPeopleAdvantage;
/********************************************************************************/
/** BETTER_BTS_AI_MOD 8/16/08 Dresden & jdog5000 */
/** */
/** Bugfix */
/********************************************************************************/
/* original BTS code
iCultureAmount /= 10000;
*/
iCultureAmount /= 100;
/********************************************************************************/
/** BETTER_BTS_AI_MOD END */