xienwolf
Deity
The proper fix would be:
I swear that was in there once upon a time, but quite possibly it wasn't. That section of the code was an afterthought to be honest.
What it is doing is keeping the AI from thinking that explorable lairs are Goody Tiles (and thus aiming to walk to them) if they meet the conditions which block the AI from exploration in Python (basically the lair is too close to their undefended cities to be safe to explore). If they don't have ANY cities ANYWHERE, you want to tell them to ignore the lair and move elsewhere (it ignores settlements because it doesn't matter much if you lose those to Barbarian lair spawns)
Nice, second page with the other crash analyzed. Still not quite the ideal solution, mainly due to the comment for the import being somewhat misleading. (UnitTypes)iI does not even come close to matching up nicely with (UnitClass)iI. But this entire function is in horrible need of a re-write from the ground up (just look at how horribly it would select an ideal city defender and the lack of Archers defending cities becomes alarmingly obvious). But the other fix is pretty much spot-on (doesn't actually matter what you divide by since if you get a 0 in that denominator it means you had a 0 in the numerator as well)
Code:
CvCity* pCity = GC.getMapINLINE().findCity(getX_INLINE(), getY_INLINE(), NO_PLAYER, eTeam, false, false, NO_TEAM, NO_DIRECTION, 0, true);
if (pCity == NULL)
{
return false;
}
if (plotDistance(getX_INLINE(), getY_INLINE(), pCity->getX(), pCity->getY()) < 10)
I swear that was in there once upon a time, but quite possibly it wasn't. That section of the code was an afterthought to be honest.
What it is doing is keeping the AI from thinking that explorable lairs are Goody Tiles (and thus aiming to walk to them) if they meet the conditions which block the AI from exploration in Python (basically the lair is too close to their undefended cities to be safe to explore). If they don't have ANY cities ANYWHERE, you want to tell them to ignore the lair and move elsewhere (it ignores settlements because it doesn't matter much if you lose those to Barbarian lair spawns)
Nice, second page with the other crash analyzed. Still not quite the ideal solution, mainly due to the comment for the import being somewhat misleading. (UnitTypes)iI does not even come close to matching up nicely with (UnitClass)iI. But this entire function is in horrible need of a re-write from the ground up (just look at how horribly it would select an ideal city defender and the lack of Archers defending cities becomes alarmingly obvious). But the other fix is pretty much spot-on (doesn't actually matter what you divide by since if you get a 0 in that denominator it means you had a 0 in the numerator as well)