Bazaar developer reference

CvGame::CityPurchase(CvCity *, UnitTypes, BuildingTypes, ProjectTypes, YieldTypes)

Defined in
CvGame.cpp, line 2683
Class
CvGame
Hook name
CivHooks::CvGame_CityPurchase

Hooks

static bool BeforeCvGame_CityPurchase(CvGame* self, CvCity* pCity, UnitTypes eUnitType, BuildingTypes eBuildingType, ProjectTypes eProjectType, YieldTypes ePurchaseYield);static void AfterCvGame_CityPurchase(CvGame* self, CvCity* pCity, UnitTypes eUnitType, BuildingTypes eBuildingType, ProjectTypes eProjectType, YieldTypes ePurchaseYield);static void ReplaceCvGame_CityPurchase(void (*original)(CvGame*, CvCity*, UnitTypes, BuildingTypes, ProjectTypes, YieldTypes), CvGame* self, CvCity* pCity, UnitTypes eUnitType, BuildingTypes eBuildingType, ProjectTypes eProjectType, YieldTypes ePurchaseYield);CivRegisterBefore<CivHooks::CvGame_CityPurchase>(host, &BeforeCvGame_CityPurchase);CivRegisterAfter<CivHooks::CvGame_CityPurchase>(host, &AfterCvGame_CityPurchase);CivRegisterReplace<CivHooks::CvGame_CityPurchase>(host, &ReplaceCvGame_CityPurchase);

Code

2683void CvGame::CityPurchase(CvCity* pCity, UnitTypes eUnitType, BuildingTypes eBuildingType, ProjectTypes eProjectType, YieldTypes ePurchaseYield)2684{2685	CvAssert(pCity);2686	if(!pCity) return;26872688	// we're trying to buy a unit2689	if(eUnitType >= 0)2690	{2691		// if there's a unit of the same type in the tile, BAIL!2692		if(!pCity->CanPlaceUnitHere(eUnitType))2693		{2694			return;2695		}2696	}26972698	gDLL->sendPurchase(pCity->GetID(), eUnitType, eBuildingType, eProjectType, ePurchaseYield);2699}

Calls

Called by