Bazaar developer reference

CvCity::DoCreatePuppet()

Defined in
CvCity.cpp, line 9633
Class
CvCity
Hook name
CivHooks::CvCity_DoCreatePuppet

Hooks

static bool BeforeCvCity_DoCreatePuppet(CvCity* self);static void AfterCvCity_DoCreatePuppet(CvCity* self);static void ReplaceCvCity_DoCreatePuppet(void (*original)(CvCity*), CvCity* self);CivRegisterBefore<CivHooks::CvCity_DoCreatePuppet>(host, &BeforeCvCity_DoCreatePuppet);CivRegisterAfter<CivHooks::CvCity_DoCreatePuppet>(host, &AfterCvCity_DoCreatePuppet);CivRegisterReplace<CivHooks::CvCity_DoCreatePuppet>(host, &ReplaceCvCity_DoCreatePuppet);

Code

9632/// Turn this City into a puppet9633void CvCity::DoCreatePuppet()9634{9635	VALIDATE_OBJECT96369637	// Turn this off - used to display info for annex/puppet/raze popup9638	SetIgnoreCityForHappiness(false);96399640	SetPuppet(true);96419642	setProductionAutomated(true, true);96439644	int iForceWorkingPuppetRange = 2;96459646	CvPlot* pLoopPlot;96479648	// Loop through all plots near this City9649#if defined(MOD_GLOBAL_CITY_WORKING)9650	for(int iPlotLoop = 0; iPlotLoop < GetNumWorkablePlots(); iPlotLoop++)9651#else9652	for(int iPlotLoop = 0; iPlotLoop < NUM_CITY_PLOTS; iPlotLoop++)9653#endif9654	{9655		pLoopPlot = plotCity(getX(), getY(), iPlotLoop);96569657		if(pLoopPlot != NULL)9658		{9659			// Cut off areas around the city we don't care about9660			pLoopPlot = plotXYWithRangeCheck(pLoopPlot->getX(), pLoopPlot->getY(), getX(), getY(), iForceWorkingPuppetRange);96619662			if(pLoopPlot != NULL)9663			{9664				pLoopPlot->setWorkingCityOverride(this);9665			}9666		}9667	}96689669	// Remove any buildings that are not applicable to puppets (but might have been earned through traits/policies)9670	for (int iI = 0; iI < GC.getNumBuildingInfos(); iI++)9671	{9672		BuildingTypes eBuilding = (BuildingTypes) iI;9673		CvBuildingEntry* pkBuildingInfo = GC.getBuildingInfo(eBuilding);9674		if(pkBuildingInfo)9675		{9676			if (pkBuildingInfo->IsNoOccupiedUnhappiness())9677			{9678				GetCityBuildings()->SetNumFreeBuilding(eBuilding, 0);9679			}9680		}9681	}96829683	GET_PLAYER(getOwner()).DoUpdateHappiness();9684	GET_PLAYER(getOwner()).DoUpdateNextPolicyCost();96859686	DLLUI->setDirty(CityInfo_DIRTY_BIT, true);9687	DLLUI->setDirty(GameData_DIRTY_BIT, true);9688}

Calls

Called by