Bazaar developer reference

CvCity::doMeltdown()

Defined in
CvCity.cpp, line 15053
Class
CvCity
Hook name
CivHooks::CvCity_doMeltdown

Hooks

static bool BeforeCvCity_doMeltdown(CvCity* self);static void AfterCvCity_doMeltdown(CvCity* self);static void ReplaceCvCity_doMeltdown(void (*original)(CvCity*), CvCity* self);CivRegisterBefore<CivHooks::CvCity_doMeltdown>(host, &BeforeCvCity_doMeltdown);CivRegisterAfter<CivHooks::CvCity_doMeltdown>(host, &AfterCvCity_doMeltdown);CivRegisterReplace<CivHooks::CvCity_doMeltdown>(host, &ReplaceCvCity_doMeltdown);

Code

15053void CvCity::doMeltdown()15054{15055	VALIDATE_OBJECT15056	AI_PERF_FORMAT("City-AI-perf.csv", ("CvCity::doMeltdown, Turn %03d, %s, %s", GC.getGame().getElapsedGameTurns(), GetPlayer()->getCivilizationShortDescription(), getName().c_str()) );1505715058	int iNumBuildingInfos = GC.getNumBuildingInfos();15059	for(int iI = 0; iI < iNumBuildingInfos; iI++)15060	{15061		const BuildingTypes eBuilding = static_cast<BuildingTypes>(iI);15062		CvBuildingEntry* pkBuildingInfo = GC.getBuildingInfo(eBuilding);15063		if(NULL != pkBuildingInfo && m_pCityBuildings->GetNumBuilding((BuildingTypes)iI) > 0)15064		{15065			if(pkBuildingInfo->GetNukeExplosionRand() != 0)15066			{15067				if(GC.getGame().getJonRandNum(pkBuildingInfo->GetNukeExplosionRand(), "Meltdown!!!") == 0)15068				{15069					if(m_pCityBuildings->GetNumRealBuilding((BuildingTypes)iI) > 0)15070					{15071						m_pCityBuildings->SetNumRealBuilding(((BuildingTypes)iI), 0);15072					}1507315074					CvUnitCombat::ApplyNuclearExplosionDamage(plot(), 1);1507515076					if(getOwner() == GC.getGame().getActivePlayer())15077					{15078						Localization::String localizedText = Localization::Lookup("TXT_KEY_MISC_MELTDOWN_CITY");15079						localizedText << getNameKey();1508015081						DLLUI->AddCityMessage(0, GetIDInfo(), getOwner(), false, GC.getEVENT_MESSAGE_TIME(), localizedText.toUTF8()/*, "AS2D_MELTDOWN", MESSAGE_TYPE_MINOR_EVENT, NULL, (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), getX(), getY(), true, true*/);15082					}1508315084					break;15085				}15086			}15087		}15088	}15089}

Calls

Called by