[BTS] 3.19 Several missionaries airlifted to the same city

Pep

King
Joined
May 28, 2002
Messages
688
Location
Spain
I played a game with the menu option "Missionaries and Executives start automated" and I noticed that two of my executives where airlifted to the same city. This happened after my two cities auto-building Mining Inc Executives spreaded the corporation to all my cities in the continent.

The bug seems to be in function bool CvUnitAI::AI_spreadCorporationAirlift(). When two or more cities are building executives that can only spread corporation by airlifting, this function chooses always the same city (until the corporation is spreaded into it). I think this can be fixed by checking that there's no executive of the same type present in a city before the airlift.

Same behaviour happens with bool CvUnitAI::AI_spreadReligionAirlift().

A fix for this bug in bool CvUnitAI::AI_spreadReligionAirlift() could be:
Spoiler :

if (GET_PLAYER(getOwnerINLINE()).AI_plotTargetMissionAIs(pLoopCity->plot(), MISSIONAI_SPREAD, getGroup()) == 0)
{
// fix begin
CLLNode<IDInfo>* pUnitNode = pLoopCity->plot()->headUnitNode();
bool bAnotherMissionary = false;
while (pUnitNode != NULL)
{
CvUnit* pLoopUnit = ::getUnit(pUnitNode->m_data);
pUnitNode = pLoopCity->plot()->nextUnitNode(pUnitNode);
if ((pLoopUnit->getOwner() == getOwner()) && (pLoopUnit->getUnitType() == getUnitType()) && (pLoopUnit->getGroup()->getMissionType(0) == NO_MISSION))
{
bAnotherMissionary = true;
break;
}
}
if (!bAnotherMissionary)
{
// end of fix
iValue = (7 + (pLoopCity->getPopulation() * 4));
...
}

}
 
Back
Top Bottom