Kael
Deity
This is from CvSelectionGroupAI.cpp. Where the AI checks to see what its odds are of attacking a an emeny stack. The following is exactly as the function appears in BtS escept the bold part which I have added.
According to how I read this the function returns 100% attack success probability to the AI if there isnt a unit that can defend in the tile. But otherwise it always returns 0% success odds.
As far as I can tell this would make the AI less aggresive than it should be and the function it should be the following:
Code:
int CvSelectionGroupAI::AI_attackOdds(const CvPlot* pPlot, bool bPotentialEnemy) const
{
CvUnit* pAttacker;
FAssert(getOwnerINLINE() != NO_PLAYER);
if (pPlot->getBestDefender(NO_PLAYER, getOwnerINLINE(), NULL, !bPotentialEnemy, bPotentialEnemy) == NULL)
{
return 100;
}
int iOdds = 0;
pAttacker = AI_getBestGroupAttacker(pPlot, bPotentialEnemy, iOdds);
if (pAttacker == NULL)
{
return 0;
}
return iOdds;
}
According to how I read this the function returns 100% attack success probability to the AI if there isnt a unit that can defend in the tile. But otherwise it always returns 0% success odds.
As far as I can tell this would make the AI less aggresive than it should be and the function it should be the following:
Code:
int CvSelectionGroupAI::AI_attackOdds(const CvPlot* pPlot, bool bPotentialEnemy) const
{
CvUnit* pAttacker;
FAssert(getOwnerINLINE() != NO_PLAYER);
if (pPlot->getBestDefender(NO_PLAYER, getOwnerINLINE(), NULL, !bPotentialEnemy, bPotentialEnemy) == NULL)
{
return 100;
}
int iOdds = 0;
pAttacker = AI_getBestGroupAttacker(pPlot, bPotentialEnemy, iOdds);
if (pAttacker == NULL)
{
return 0;
}
[b]//FfH: Added by Kael 04/11/2008
iOdds = pAttacker->AI_attackOdds(pPlot, bPotentialEnemy);
//FfH: End Add[/b]
return iOdds;
}