<div class='quotetop'>Цитата</div>
Вот полная функция по ядерному удару

[codebox]void CvPlot::nukeExplosion(int iRange, CvUnit* pNukeUnit)
{
CLLNode<IDInfo>* pUnitNode;
CvCity* pLoopCity;
CvUnit* pLoopUnit;
CvPlot* pLoopPlot;
CLinkList<IDInfo> oldUnits;
CvWString szBuffer;
int iNukeDamage;
int iNukedPopulation;
int iDX, iDY;
int iI;

GC.getGameINLINE().changeNukesExploded(1);

for (iDX = -(iRange); iDX <= iRange; iDX++)
{
for (iDY = -(iRange); iDY <= iRange; iDY++)
{
pLoopPlot = plotXY(getX_INLINE(), getY_INLINE(), iDX, iDY);

if (pLoopPlot != NULL)
{
// if we remove roads, don&#39;t remove them on the city... XXX

pLoopCity = pLoopPlot->getPlotCity();

if (pLoopCity == NULL)
{
if (!(pLoopPlot->isWater()) && !(pLoopPlot->isImpassable()))
{
if (NO_FEATURE == pLoopPlot->getFeatureType() || !GC.getFeatureInfo(pLoopPlot->getFeatureType()).isNukeImmune())
{
if (GC.getGameINLINE().getSorenRandNum(100, "Nuke Fallout") < GC.getDefineINT("NUKE_FALLOUT_PROB"))
{
pLoopPlot->setImprovementType(NO_IMPROVEMENT);
pLoopPlot->setFeatureType((FeatureTypes)(GC.getDefineINT("NUKE_FEATURE")));
}
}
}
}

oldUnits.clear();

pUnitNode = pLoopPlot->headUnitNode();

while (pUnitNode != NULL)
{
oldUnits.insertAtEnd(pUnitNode->m_data);
pUnitNode = pLoopPlot->nextUnitNode(pUnitNode);
}

pUnitNode = oldUnits.head();

while (pUnitNode != NULL)
{
pLoopUnit = ::getUnit(pUnitNode->m_data);
pUnitNode = oldUnits.next(pUnitNode);

if (pLoopUnit != NULL)
{
if (pLoopUnit != pNukeUnit)
{
if (!pLoopUnit->isNukeImmune() && !pLoopUnit->isDelayedDeath())
{
iNukeDamage = (GC.getDefineINT("NUKE_UNIT_DAMAGE_BASE") + GC.getGameINLINE().getSorenRandNum(GC.getDefineINT("NUKE_UNIT_DAMAGE_RAND_1"), "Nuke Damage 1") + GC.getGameINLINE().getSorenRandNum(GC.getDefineINT("NUKE_UNIT_DAMAGE_RAND_2"), "Nuke Damage 2"));

if (pLoopCity != NULL)
{
iNukeDamage *= max(0, (pLoopCity->getNukeModifier() + 100));
iNukeDamage /= 100;
}

if (pLoopUnit->canFight() || pLoopUnit->airBaseCombatStr() > 0)
{
pLoopUnit->changeDamage(iNukeDamage, ((pNukeUnit != NULL) ? pNukeUnit->getOwnerINLINE() : NO_PLAYER));
}
else if (iNukeDamage >= GC.getDefineINT("NUKE_NON_COMBAT_DEATH_THRESHOLD"))
{
pLoopUnit->kill(false, ((pNukeUnit != NULL) ? pNukeUnit->getOwnerINLINE() : NO_PLAYER));
}
}
}
}
}

if (pLoopCity != NULL)
{
for (iI = 0; iI < GC.getNumBuildingInfos(); ++iI)
{
if (pLoopCity->getNumRealBuilding((BuildingTypes)iI) > 0)
{
if (!(GC.getBuildingInfo((BuildingTypes) iI).isNukeImmune()))
{
if (GC.getGameINLINE().getSorenRandNum(100, "Building Nuked") < GC.getDefineINT("NUKE_BUILDING_DESTRUCTION_PROB"))
{
pLoopCity->setNumRealBuilding(((BuildingTypes)iI), pLoopCity->getNumRealBuilding((BuildingTypes)iI) - 1);
}
}
}
}

iNukedPopulation = ((pLoopCity->getPopulation() * (GC.getDefineINT("NUKE_POPULATION_DEATH_BASE") + GC.getGameINLINE().getSorenRandNum(GC.getDefineINT("NUKE_POPULATION_DEATH_RAND_1"), "Population Nuked 1") + GC.getGameINLINE().getSorenRandNum(GC.getDefineINT("NUKE_POPULATION_DEATH_RAND_2"), "Population Nuked 2"))) / 100);

iNukedPopulation *= max(0, (pLoopCity->getNukeModifier() + 100));
iNukedPopulation /= 100;

pLoopCity->changePopulation(-(min((pLoopCity->getPopulation() - 1), iNukedPopulation)));

}
}
}
}

gDLL->getEventReporterIFace()->nukeExplosion(this, pNukeUnit);
}[/codebox]

По населению:
- Базовые потери - процент 30+R1(20)+R2(20) от населения города, R - случайные числа из 20.
- Бобмбоубежище снижает полученное число на 50%

Итого: потери населения при ядерном ударе варьируются в пределах 30-70%, и 15-35% - в городе с бомбоубежищем. При этом город не может быть уничтожен, т.е население не опускается ниже 1.[/b]
NUKE_FALLOUT_PROB - вероятность появления радиации (загрязнения) на тайле в зоне ядерного взрыва.