What we are referring is the popup enabling the choice of razing a city. Nonetheless, on special conditions, that doesn't happen and the city is automatically captured without choice whatsoever.
In
CvPlayer.cpp, the concerned function is
acquireCity().
Code:
if (lResult == 1)
{
//auto raze based on game rules
if (pNewCity->isAutoRaze())
{
if (iCaptureGold > 0)
{
szBuffer = gDLL->getText("TXT_KEY_MISC_PILLAGED_CITY", iCaptureGold, pNewCity->getNameKey());
gDLL->getInterfaceIFace()->addMessage(getID(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_CITYRAZE", MESSAGE_TYPE_MAJOR_EVENT, ARTFILEMGR.getInterfaceArtInfo("WORLDBUILDER_CITY_EDIT")->getPath(), (ColorTypes)GC.getInfoTypeForString("COLOR_GREEN"), pNewCity->getX_INLINE(), pNewCity->getY_INLINE(), true, true);
}
pNewCity->doTask(TASK_RAZE);
}
else if (!isHuman())
{
AI_conquerCity(pNewCity); // could delete the pointer...
}
else
{
//popup raze option
eHighestCulturePlayer = pNewCity->getLiberationPlayer(true);
bRaze = canRaze(pNewCity);
bGift = ((eHighestCulturePlayer != NO_PLAYER)
&& (eHighestCulturePlayer != getID())
&& ((getTeam() == GET_PLAYER(eHighestCulturePlayer).getTeam())
|| GET_TEAM(getTeam()).isOpenBorders(GET_PLAYER(eHighestCulturePlayer).getTeam())
|| GET_TEAM(GET_PLAYER(eHighestCulturePlayer).getTeam()).isVassal(getTeam())));
if (bRaze || bGift)
{
CvPopupInfo* pInfo = new CvPopupInfo(BUTTONPOPUP_RAZECITY);
pInfo->setData1(pNewCity->getID());
pInfo->setData2(eHighestCulturePlayer);
pInfo->setData3(iCaptureGold);
gDLL->getInterfaceIFace()->addPopup(pInfo, getID());
}
else
{
pNewCity->chooseProduction();
CvEventReporter::getInstance().cityAcquiredAndKept(getID(), pNewCity);
}
}
}
There are three situations:
1) Autorazing is the most preponderant condition. Simply if the city never reached size 2, thus the city is autorazed. Even if you rushed a wonder in that city because culture is irrelevant.
2) The second condition is attributed to AI choices, thus irrelevant here.
3) This is the conditional structure we care about. It has two checks of different nature:
bcanRaze and
bGift.
bGift:
That one is related to team play or vassals doing some captured around your cities. It is seen pretty rarely because of team play option being a rare setting and vassals getting enemy cities pressured culturally by your cities are often sign of neglect.
Basically, if you're the culturally dominant in that border city, the team friend will liberate to the player (or other team partner). If the cultural dominance isn't checked, then it checks about Open Borders (which one I'm unsure what it means) and if that fails too, if the friend is your vassal, it's his/her duty to give back the city.
bcanRaze:
This is the situation of both human an AI allowing them to practically perform city razing.
The function is pretty simple:
Code:
bool CvPlayer::canRaze(CvCity* pCity) const
{
if (!pCity->isAutoRaze())
{
if (GC.getGameINLINE().isOption(GAMEOPTION_NO_CITY_RAZING))
{
return false;
}
if (pCity->getOwnerINLINE() != getID())
{
return false;
}
if (pCity->calculateTeamCulturePercent(getTeam()) >= GC.getDefineINT("RAZING_CULTURAL_PERCENT_THRESHOLD"))
{
return false;
}
}
It first checks if No City Razing Option wasn't checked.
Then the second condition puzzles me...
And the last is about a threshold of your own culture (team culture) over the enemy's.
More specifically
Code:
<Define>
<DefineName>RAZING_CULTURAL_PERCENT_THRESHOLD</DefineName>
<iDefineIntVal>25</iDefineIntVal>
</Define>
If you got equal or more than 25% of your team culture, then the city is peacefully returned without option of disbanding it.
Whatever.