Bazaar developer reference

CvUnit::canConstruct(const CvPlot *, BuildingTypes) const

Defined in
CvUnit.cpp, line 8105
Class
CvUnit
Hook name
CivHooks::CvUnit_canConstruct

Hooks

static bool BeforeCvUnit_canConstruct(const CvUnit* self, const CvPlot* pPlot, BuildingTypes eBuilding, bool& result);static void AfterCvUnit_canConstruct(const CvUnit* self, const CvPlot* pPlot, BuildingTypes eBuilding, bool& result);static bool ReplaceCvUnit_canConstruct(bool (*original)(const CvUnit*, const CvPlot*, BuildingTypes), const CvUnit* self, const CvPlot* pPlot, BuildingTypes eBuilding);CivRegisterBefore<CivHooks::CvUnit_canConstruct>(host, &BeforeCvUnit_canConstruct);CivRegisterAfter<CivHooks::CvUnit_canConstruct>(host, &AfterCvUnit_canConstruct);CivRegisterReplace<CivHooks::CvUnit_canConstruct>(host, &ReplaceCvUnit_canConstruct);

Code

8105bool CvUnit::canConstruct(const CvPlot* pPlot, BuildingTypes eBuilding) const8106{8107	VALIDATE_OBJECT8108	CvCity* pCity;81098110	if(eBuilding == NO_BUILDING)8111	{8112		return false;8113	}81148115	pCity = pPlot->getPlotCity();81168117	if(pCity == NULL)8118	{8119		return false;8120	}81218122	if(getTeam() != pCity->getTeam())8123	{8124		return false;8125	}81268127	if(pCity->GetCityBuildings()->GetNumRealBuilding(eBuilding) > 0)8128	{8129		return false;8130	}81318132	if(isDelayedDeath())8133	{8134		return false;8135	}81368137	return true;8138}

Calls

Called by