Bazaar developer reference

CvUnitMovement::CostsOnlyOne(const CvUnit *, const CvPlot *, const CvPlot *)

Defined in
CvUnitMovement.cpp, line 260
Class
CvUnitMovement
Hook name
CivHooks::CvUnitMovement_CostsOnlyOne

Hooks

static bool BeforeCvUnitMovement_CostsOnlyOne(const CvUnit* pUnit, const CvPlot* pFromPlot, const CvPlot* pToPlot, bool& result);static void AfterCvUnitMovement_CostsOnlyOne(const CvUnit* pUnit, const CvPlot* pFromPlot, const CvPlot* pToPlot, bool& result);static bool ReplaceCvUnitMovement_CostsOnlyOne(bool (*original)(const CvUnit*, const CvPlot*, const CvPlot*), const CvUnit* pUnit, const CvPlot* pFromPlot, const CvPlot* pToPlot);CivRegisterBefore<CivHooks::CvUnitMovement_CostsOnlyOne>(host, &BeforeCvUnitMovement_CostsOnlyOne);CivRegisterAfter<CivHooks::CvUnitMovement_CostsOnlyOne>(host, &AfterCvUnitMovement_CostsOnlyOne);CivRegisterReplace<CivHooks::CvUnitMovement_CostsOnlyOne>(host, &ReplaceCvUnitMovement_CostsOnlyOne);

Code

260bool CvUnitMovement::CostsOnlyOne(const CvUnit* pUnit, const CvPlot* pFromPlot, const CvPlot* pToPlot)261{262	if(!pToPlot->isValidDomainForAction(*pUnit))263	{264		// If we are a land unit that can embark, then do further tests.265		if(pUnit->getDomainType() != DOMAIN_LAND || pUnit->IsHoveringUnit() || pUnit->canMoveAllTerrain() || !pUnit->CanEverEmbark())266			return true;267	}268269	CvAssert(!pUnit->IsImmobile());270271	if(pUnit->flatMovementCost() || pUnit->getDomainType() == DOMAIN_AIR)272	{273		return true;274	}275276	// Is the unit from a civ that can disembark for just 1 MP?277	if(!pToPlot->isWater() && pFromPlot->isWater() && pUnit->isEmbarked() && GET_PLAYER(pUnit->getOwner()).GetPlayerTraits()->IsEmbarkedToLandFlatCost())278	{279		return true;280	}281282	return false;283}

Calls

Called by