Manco Capac
Friday,13 June,I Collapse
- Joined
- Mar 1, 2010
- Messages
- 8,051
First I have to say I'm bad beyond human imagination in regards to code reading...
I think I might found the string of code ruling the AI behaviour about city gift or liberating.
It was found in the following directory:
C:\Program Files\2K Games\...\Beyond the Sword\CvGameCoreDLL
The file in question is CvPlayerAI.cpp.
All I can say if I understood...a big if rly...the green colored lines seem to be meaningful:
if (!(GET_TEAM(getTeam()).isAtWar(GET_PLAYER((PlayerTypes)iI).getTeam())))
seems to say not under war state...
pDiplo->setDiploComment((DiploCommentTypes)GC.getInfoTypeForString("AI_DIPLOCOMMENT_OFFER_CITY"));
I have seen the corresponding XML file and the AI diplo response was about city gift.
If I understand, a CAUTIOUS AI may give cities.
It looks like the orange section is about the inner mechanism...city condition for city gift?
May a new generation DanF5771-like people helps me...pleaaase.
I expect no answer, but if some people may give some pointers, I will glad to receive it.
I think I might found the string of code ruling the AI behaviour about city gift or liberating.
It was found in the following directory:
C:\Program Files\2K Games\...\Beyond the Sword\CvGameCoreDLL
The file in question is CvPlayerAI.cpp.
Spoiler :
if (!(GET_TEAM(getTeam()).isAtWar(GET_PLAYER((PlayerTypes)iI).getTeam())))
{
if (AI_getAttitude((PlayerTypes)iI) >= ATTITUDE_CAUTIOUS)
{
for (pLoopCity = firstCity(&iLoop); pLoopCity != NULL; pLoopCity = nextCity(&iLoop))
{
if (pLoopCity->getPreviousOwner() != ((PlayerTypes)iI))
{
if (((pLoopCity->getGameTurnAcquired() + 4) % 20) == (GC.getGameINLINE().getGameTurn() % 20))
{
iCount = 0;
iPossibleCount = 0;
for (iJ = 0; iJ < NUM_CITY_PLOTS; iJ++)
{
pLoopPlot = plotCity(pLoopCity->getX_INLINE(), pLoopCity->getY_INLINE(), iJ);
if (pLoopPlot != NULL)
{
if (pLoopPlot->getOwnerINLINE() == iI)
{
iCount++;
}
iPossibleCount++;
}
}
if (iCount >= (iPossibleCount / 2))
{
setTradeItem(&item, TRADE_CITIES, pLoopCity->getID());
if (canTradeItem(((PlayerTypes)iI), item, true))
{
ourList.clear();
ourList.insertAtEnd(item);
if (GET_PLAYER((PlayerTypes)iI).isHuman())
{
//if (!(abContacted[GET_PLAYER((PlayerTypes)iI).getTeam()]))
{
pDiplo = new CvDiploParameters(getID());
FAssertMsg(pDiplo != NULL, "pDiplo must be valid");
pDiplo->setDiploComment((DiploCommentTypes)GC.getInfoTypeForString("AI_DIPLOCOMMENT_OFFER_CITY"));
pDiplo->setAIContact(true);
pDiplo->setTheirOfferList(ourList);
gDLL->beginDiplomacy(pDiplo, (PlayerTypes)iI);
abContacted[GET_PLAYER((PlayerTypes)iI).getTeam()] = true;
}
}
else
{
GC.getGameINLINE().implementDeal(getID(), ((PlayerTypes)iI), &ourList, NULL);
}
}
}
}
}
}
}
{
if (AI_getAttitude((PlayerTypes)iI) >= ATTITUDE_CAUTIOUS)
{
for (pLoopCity = firstCity(&iLoop); pLoopCity != NULL; pLoopCity = nextCity(&iLoop))
{
if (pLoopCity->getPreviousOwner() != ((PlayerTypes)iI))
{
if (((pLoopCity->getGameTurnAcquired() + 4) % 20) == (GC.getGameINLINE().getGameTurn() % 20))
{
iCount = 0;
iPossibleCount = 0;
for (iJ = 0; iJ < NUM_CITY_PLOTS; iJ++)
{
pLoopPlot = plotCity(pLoopCity->getX_INLINE(), pLoopCity->getY_INLINE(), iJ);
if (pLoopPlot != NULL)
{
if (pLoopPlot->getOwnerINLINE() == iI)
{
iCount++;
}
iPossibleCount++;
}
}
if (iCount >= (iPossibleCount / 2))
{
setTradeItem(&item, TRADE_CITIES, pLoopCity->getID());
if (canTradeItem(((PlayerTypes)iI), item, true))
{
ourList.clear();
ourList.insertAtEnd(item);
if (GET_PLAYER((PlayerTypes)iI).isHuman())
{
//if (!(abContacted[GET_PLAYER((PlayerTypes)iI).getTeam()]))
{
pDiplo = new CvDiploParameters(getID());
FAssertMsg(pDiplo != NULL, "pDiplo must be valid");
pDiplo->setDiploComment((DiploCommentTypes)GC.getInfoTypeForString("AI_DIPLOCOMMENT_OFFER_CITY"));
pDiplo->setAIContact(true);
pDiplo->setTheirOfferList(ourList);
gDLL->beginDiplomacy(pDiplo, (PlayerTypes)iI);
abContacted[GET_PLAYER((PlayerTypes)iI).getTeam()] = true;
}
}
else
{
GC.getGameINLINE().implementDeal(getID(), ((PlayerTypes)iI), &ourList, NULL);
}
}
}
}
}
}
}
All I can say if I understood...a big if rly...the green colored lines seem to be meaningful:
if (!(GET_TEAM(getTeam()).isAtWar(GET_PLAYER((PlayerTypes)iI).getTeam())))
seems to say not under war state...
pDiplo->setDiploComment((DiploCommentTypes)GC.getInfoTypeForString("AI_DIPLOCOMMENT_OFFER_CITY"));
I have seen the corresponding XML file and the AI diplo response was about city gift.
If I understand, a CAUTIOUS AI may give cities.
It looks like the orange section is about the inner mechanism...city condition for city gift?
May a new generation DanF5771-like people helps me...pleaaase.
I expect no answer, but if some people may give some pointers, I will glad to receive it.
