@Cybah
I had a quick view at the code. The code is not optimal. It can produces stupid results in many cases. Here an example:
PHP:bool CvUnitAI::AI_patrolBorders() { PROFILE_FUNC(); CvPlot* pBestPlot; int iValue; int iBestValue; iBestValue = 0; pBestPlot = NULL; int iDX, iDY; int iSearchRange = baseMoves(); for (iDX = -(iSearchRange); iDX <= iSearchRange; iDX++) { for (iDY = -(iSearchRange); iDY <= iSearchRange; iDY++) { CvPlot* pLoopPlot = plotXY(getX_INLINE(), getY_INLINE(), iDX, iDY); if (pLoopPlot != NULL) { if (canMoveInto(pLoopPlot)) { DirectionTypes eNewDirection = estimateDirection(plot(), pLoopPlot); iValue = GC.getGameINLINE().getSorenRandNum(1000, "AI Border Patrol"); if (pLoopPlot->isBorder(true)) { iValue += GC.getGameINLINE().getSorenRandNum(1000, "AI Border Patrol"); } else if (pLoopPlot->isBorder(false)) { iValue += GC.getGameINLINE().getSorenRandNum(500, "AI Border Patrol"); } //Avoid heading backwards, we want to circuit our borders, if possible. if (eNewDirection == getOppositeDirection(getFacingDirection(false))) { iValue /= 25; } else if (isAdjacentDirection(getOppositeDirection(getFacingDirection(false)), eNewDirection)) { iValue /= 10; } if (pLoopPlot->getOwnerINLINE() != getOwnerINLINE()) { iValue /= 10; } if (iValue > iBestValue) { iBestValue = iValue; pBestPlot = pLoopPlot; } } } } } if (pBestPlot != NULL) { FAssert(!atPlot(pBestPlot)); getGroup()->pushMission(MISSION_MOVE_TO, pBestPlot->getX_INLINE(), pBestPlot->getY_INLINE()); return true; } return false; }
The start value is a random number from 0 to 999. And this value can be divided by 250. So all start values from 0 to 249 can give you a value of int 0 at the end. And because of iValue > iBestValue (initial 0) many valid plots different from NULL are simply ignored.
To fix it search through the code and add offsets.
Here for example:
PHP:iValue = 1000 + GC.getGameINLINE().getSorenRandNum(1000, "AI Border Patrol");
Is now soon enough?
<TEXT>
<Tag>TXT_KEY_MISSION_ESPIONAGE_SLEEP</Tag>
<English>Gather Intel</English>
<French>Récolte d'Infos</French>
<German>Sammle Informationen</German>
<Italian>Gather Intel</Italian>
<Spanish>Gather Intel</Spanish>
</TEXT>
<TEXT>
<Tag>TXT_KEY_MISSION_ESPIONAGE_SLEEP_HELP</Tag>
<English>This unit will gather intelligence and not awaken until it reaches the maximum espionage bonus</English>
<French>Cette Unité va récolter des Informations et devenir à nouveau active lorsqu'elle aura atteint son bonus maximum d'espionnage.</French>
<German>Diese Einheit wird Informationen sammeln und nicht aufwachen bis sie ihr Maximum an Spionagepunkten erreicht hat</German>
<Italian>This unit will gather intelligence and not awaken until it reaches the maximum espionage bonus</Italian>
<Spanish>This unit will gather intelligence and not awaken until it reaches the maximum espionage bonus</Spanish>
</TEXT>
bool AI_huntRange(int iRange, int iOddsThreshold, bool bStayInBorders, int iMinValue);
CvXMLLoadUtilitySetMod.cpp(22) : error C2039: 'resetModLoadControlVector' : is not a member of 'CvGlobals'
CvXMLLoadUtilitySetMod.cpp(25) : error C2039: 'setModLoadControlVector' : is not a member of 'CvGlobals'
CvXMLLoadUtilitySetMod.cpp(32) : error C2065: 'CvXMLLoadUtilityModTools' : undeclared identifier
CvXMLLoadUtilitySetMod.cpp(32) : error C2065: 'p_szDirName' : undeclared identifier
CvXMLLoadUtilitySetMod.cpp(32) : error C2061: syntax error : identifier 'CvXMLLoadUtilityModTools'
CvXMLLoadUtilitySetMod.cpp(34) : error C2227: left of '->GetProgramDir' must point to class/struct/union
CvXMLLoadUtilitySetMod.cpp(34) : error C3861: 'p_szDirName': identifier not found, even with argument-dependent lookup
CvXMLLoadUtilitySetMod.cpp(41) : error C2039: 'logMLF' : is not a member of 'CvXMLLoadUtility'
Trying to compile this on its own, errors in CvXMLLoadUtilitySetMod.cpp.
Heres a few:
Code:CvXMLLoadUtilitySetMod.cpp(22) : error C2039: 'resetModLoadControlVector' : is not a member of 'CvGlobals' CvXMLLoadUtilitySetMod.cpp(25) : error C2039: 'setModLoadControlVector' : is not a member of 'CvGlobals' CvXMLLoadUtilitySetMod.cpp(32) : error C2065: 'CvXMLLoadUtilityModTools' : undeclared identifier CvXMLLoadUtilitySetMod.cpp(32) : error C2065: 'p_szDirName' : undeclared identifier CvXMLLoadUtilitySetMod.cpp(32) : error C2061: syntax error : identifier 'CvXMLLoadUtilityModTools' CvXMLLoadUtilitySetMod.cpp(34) : error C2227: left of '->GetProgramDir' must point to class/struct/union CvXMLLoadUtilitySetMod.cpp(34) : error C3861: 'p_szDirName': identifier not found, even with argument-dependent lookup CvXMLLoadUtilitySetMod.cpp(41) : error C2039: 'logMLF' : is not a member of 'CvXMLLoadUtility'