Bazaar developer reference

CvUnit::canChangeAdmiralPort(const CvPlot *) const

Defined in
CvUnit.cpp, line 6938
Class
CvUnit
Hook name
CivHooks::CvUnit_canChangeAdmiralPort

Hooks

static bool BeforeCvUnit_canChangeAdmiralPort(const CvUnit* self, const CvPlot* pPlot, bool& result);static void AfterCvUnit_canChangeAdmiralPort(const CvUnit* self, const CvPlot* pPlot, bool& result);static bool ReplaceCvUnit_canChangeAdmiralPort(bool (*original)(const CvUnit*, const CvPlot*), const CvUnit* self, const CvPlot* pPlot);CivRegisterBefore<CivHooks::CvUnit_canChangeAdmiralPort>(host, &BeforeCvUnit_canChangeAdmiralPort);CivRegisterAfter<CivHooks::CvUnit_canChangeAdmiralPort>(host, &AfterCvUnit_canChangeAdmiralPort);CivRegisterReplace<CivHooks::CvUnit_canChangeAdmiralPort>(host, &ReplaceCvUnit_canChangeAdmiralPort);

Code

6938bool CvUnit::canChangeAdmiralPort(const CvPlot* pPlot) const6939{6940#if defined(MOD_GLOBAL_SEPARATE_GREAT_ADMIRAL)6941	bool bHasSkill = !MOD_GLOBAL_SEPARATE_GREAT_ADMIRAL && IsGreatAdmiral();6942	bHasSkill = bHasSkill || (MOD_GLOBAL_SEPARATE_GREAT_ADMIRAL && m_pUnitInfo->IsCanChangePort());6943	if (!bHasSkill)6944#else6945	if (!IsGreatAdmiral())6946#endif6947	{6948		return false;6949	}69506951	if (pPlot == NULL)6952	{6953		return false;6954	}69556956	CvCity* pCity = pPlot->getPlotCity();6957	if (pCity == NULL)6958	{6959		return false;6960	}69616962	if (pCity->getOwner() != getOwner())6963	{6964		return false;6965	}69666967	if (!pCity->isCoastal())6968	{6969		return false;6970	}69716972	return true;6973}

Calls

Called by