void CvTeam::setHasTech(TechTypes eIndex, bool bNewValue, PlayerTypes ePlayer, bool bFirst, bool bAnnounce)
{
...
if (bFirst)
{
if (GC.getGameINLINE().countKnownTechNumTeams(eIndex) == 1)
{
CyArgsList argsList;
argsList.add(getID());
argsList.add(ePlayer);
argsList.add(eIndex);
argsList.add(bFirst);
long lResult=0;
gDLL->getPythonIFace()->callFunction(PYGameModule, "doHolyCityTech", argsList.makeFunctionArgs(), &lResult);
if (lResult != 1)
{
[COLOR=Red] int iCounter = 0;
for (iI = 0; iI < GC.getNumReligionInfos(); iI++)
{
if (GC.getGameINLINE().isReligionFounded((ReligionTypes)iI))
{
iCounter++;
}
}
if (iCounter <= GC.getWorldInfo(GC.getMapINLINE().getWorldSize()).getMaxReligions())
{[/COLOR]
for (iI = 0; iI < GC.getNumReligionInfos(); iI++)
{
if (GC.getReligionInfo((ReligionTypes)iI).getTechPrereq() == eIndex)
{
iBestValue = MAX_INT;
eBestPlayer = NO_PLAYER;
for (iJ = 0; iJ < MAX_PLAYERS; iJ++)
{
if (GET_PLAYER((PlayerTypes)iJ).isAlive())
{
if (GET_PLAYER((PlayerTypes)iJ).getTeam() == getID())
{
iValue = 10;
iValue += GC.getGameINLINE().getSorenRandNum(10, "Found Religion (Player)");
for (iK = 0; iK < GC.getNumReligionInfos(); iK++)
{
iValue += (GET_PLAYER((PlayerTypes)iJ).getHasReligionCount((ReligionTypes)iK) * 10);
}
if (GET_PLAYER((PlayerTypes)iJ).getCurrentResearch() != eIndex)
{
iValue *= 10;
}
if (iValue < iBestValue)
{
iBestValue = iValue;
eBestPlayer = ((PlayerTypes)iJ);
}
}
}
}
if (eBestPlayer != NO_PLAYER)
{
GC.getGameINLINE().setReligionSlotTaken((ReligionTypes)iI, true);
if (GC.getGameINLINE().isOption(GAMEOPTION_PICK_RELIGION))
{
if (GET_PLAYER(eBestPlayer).isHuman())
{
CvPopupInfo* pInfo = new CvPopupInfo(BUTTONPOPUP_FOUND_RELIGION, iI);
if (NULL != pInfo)
{
gDLL->getInterfaceIFace()->addPopup(pInfo, eBestPlayer);
}
}
else
{
ReligionTypes eReligion = GET_PLAYER(eBestPlayer).AI_chooseReligion();
if (NO_RELIGION != eReligion)
{
GET_PLAYER(eBestPlayer).foundReligion(eReligion, (ReligionTypes)iI, true);
}
}
}
else
{
GET_PLAYER(eBestPlayer).foundReligion((ReligionTypes)iI, (ReligionTypes)iI, true);
}
bReligionFounded = true;
bFirstBonus = true;
}
}
}
[COLOR=Red] }[/COLOR]
...