CvUnit::baseMoves(DomainTypes) const
- Defined in
- CvUnit.cpp, line 11593
- Class
- CvUnit
- Hook name
CivHooks::CvUnit_baseMoves
Hooks
static bool BeforeCvUnit_baseMoves(const CvUnit* self, DomainTypes eIntoDomain, int& result);static void AfterCvUnit_baseMoves(const CvUnit* self, DomainTypes eIntoDomain, int& result);static int ReplaceCvUnit_baseMoves(int (*original)(const CvUnit*, DomainTypes), const CvUnit* self, DomainTypes eIntoDomain);CivRegisterBefore<CivHooks::CvUnit_baseMoves>(host, &BeforeCvUnit_baseMoves);CivRegisterAfter<CivHooks::CvUnit_baseMoves>(host, &AfterCvUnit_baseMoves);CivRegisterReplace<CivHooks::CvUnit_baseMoves>(host, &ReplaceCvUnit_baseMoves);
Code
11587// Get the base movement points for the unit.11588// Parameters:11589// eIntoDomain - If NO_DOMAIN, this will use the units current domain.11590// This can give different results based on whether the unit is currently embarked or not.11591// Passing in DOMAIN_SEA will return the units baseMoves as if it were already embarked.11592// Passing in DOMAIN_LAND will return the units baseMoves as if it were on land, even if it is currently embarked.11593int CvUnit::baseMoves(DomainTypes eIntoDomain /* = NO_DOMAIN */) const11594{11595 VALIDATE_OBJECT11596 CvTeam& thisTeam = GET_TEAM(getTeam());11597 CvPlayer& thisPlayer = GET_PLAYER(getOwner());11598 CvPlayerTraits* pTraits = thisPlayer.GetPlayerTraits();11599 DomainTypes eDomain = getDomainType();1160011601#if defined(MOD_PATHFINDER_DEEP_WATER_EMBARKATION)11602 bool bWantEmbarkedMovement = (eIntoDomain == DOMAIN_SEA && CanEverEmbark()) || (eIntoDomain == NO_DOMAIN && isEmbarked());11603 bWantEmbarkedMovement = bWantEmbarkedMovement || (eIntoDomain == DOMAIN_SEA && IsHoveringUnit() && IsEmbarkDeepWater());11604 if(bWantEmbarkedMovement)11605#else11606 if((eIntoDomain == DOMAIN_SEA && CanEverEmbark()) || (eIntoDomain == NO_DOMAIN && isEmbarked()))11607#endif11608 {11609 CvPlayerPolicies* pPolicies = thisPlayer.GetPlayerPolicies();11610 return GC.getEMBARKED_UNIT_MOVEMENT() + getExtraNavalMoves() + thisTeam.getEmbarkedExtraMoves() + thisTeam.getExtraMoves(eDomain) + pTraits->GetExtraEmbarkMoves() + pPolicies->GetNumericModifier(POLICYMOD_EMBARKED_EXTRA_MOVES);11611 }1161211613 int m_iExtraNavalMoves = 0;11614 if(eDomain == DOMAIN_SEA)11615 {11616 m_iExtraNavalMoves += getExtraNavalMoves();1161711618 // Work boats also get extra moves, and they don't have a combat class to receive a promotion from11619 if(m_iBaseCombat == 0)11620 {11621 m_iExtraNavalMoves += pTraits->GetExtraEmbarkMoves();11622 }11623 }1162411625 int iExtraGoldenAgeMoves = 0;11626 if(thisPlayer.isGoldenAge())11627 {11628 iExtraGoldenAgeMoves = pTraits->GetGoldenAgeMoveChange();11629 }1163011631 int iExtraUnitCombatTypeMoves = pTraits->GetMovesChangeUnitCombat((UnitCombatTypes)(m_pUnitInfo->GetUnitCombatType()));1163211633 return (m_pUnitInfo->GetMoves() + getExtraMoves() + thisTeam.getExtraMoves(eDomain) + m_iExtraNavalMoves + iExtraGoldenAgeMoves + iExtraUnitCombatTypeMoves);11634}
Calls
- CvGlobals::getEMBARKED_UNIT_MOVEMENT()
- CvPlayer::GetPlayerPolicies() const
- CvPlayer::GetPlayerTraits() const
- CvPlayer::isGoldenAge() const
- CvPlayerAI::getPlayer(PlayerTypes)
- CvPlayerPolicies::GetNumericModifier(PolicyModifierType)
- CvPlayerTraits::GetExtraEmbarkMoves() const
- CvPlayerTraits::GetGoldenAgeMoveChange() const
- CvPlayerTraits::GetMovesChangeUnitCombat(const int) const
- CvTeam::getEmbarkedExtraMoves() const
- CvTeam::getExtraMoves(DomainTypes) const
- CvTeam::getTeam(TeamTypes)
- CvUnit::CanEverEmbark() const
- CvUnit::getDomainType() const
- CvUnit::getExtraMoves() const
- CvUnit::getExtraNavalMoves() const
- CvUnit::getOwner() const
- CvUnit::getTeam() const
- CvUnit::IsEmbarkDeepWater() const
- CvUnit::isEmbarked() const
- CvUnit::IsHoveringUnit() const
- CvUnitEntry::GetMoves() const
- CvUnitEntry::GetUnitCombatType() const
FAutoVariable::operator const int &
Called by
- CvAIOperationNavalSuperiority::FindBestTarget()
- CvArmyAI::GetMovementRate()
- CanReachInXTurns(UnitHandle, CvPlot *, int, bool, int *)
- UnitPathInitialize(const void *, CvAStar *)
- CvDangerPlots::UpdateDanger(bool, bool)
- CvPlot::MovementCostNoZOC(const CvUnit *, const CvPlot *, int) const
- CvPlot::movementCost(const CvUnit *, const CvPlot *, int) const
- CvTacticalAI::FindBestBarbarianSeaMove(UnitHandle)
- CvTacticalAnalysisMap::MarkCellsNearEnemy()
- CvUnit::GetGreatGeneralStackMovement() const
- CvUnit::GetRangePlusMoveToshot() const
- CvUnit::SearchRange(int) const
- CvUnit::maxMoves() const