本文整理汇总了C++中CvCity::GetBorderObstacleWater方法的典型用法代码示例。如果您正苦于以下问题:C++ CvCity::GetBorderObstacleWater方法的具体用法?C++ CvCity::GetBorderObstacleWater怎么用?C++ CvCity::GetBorderObstacleWater使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CvCity
的用法示例。
在下文中一共展示了CvCity::GetBorderObstacleWater方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetCostsForMove
//.........这里部分代码省略.........
else if((eToFeature == NO_FEATURE) ? pUnit->isTerrainDoubleMove(eToTerrain) : pUnit->isFeatureDoubleMove(eToFeature))
{
iRegularCost /= 2;
}
#if defined(MOD_PROMOTIONS_HALF_MOVE)
else if((pToPlot->getFeatureType() == NO_FEATURE) ? pUnit->isTerrainHalfMove(pToPlot->getTerrainType()) : pUnit->isFeatureHalfMove(pToPlot->getFeatureType()))
{
iRegularCost *= 2;
}
#endif
}
//check routes
if( !bHover &&
(bRouteFrom || bFakeRouteFrom) &&
(bRouteTo || bFakeRouteTo) &&
(!bRiverCrossing || kUnitTeam.isBridgeBuilding() || bAmphibious) )
{
RouteTypes eFromRoute = bFakeRouteFrom ? ROUTE_ROAD : pFromPlot->getRouteType();
CvRouteInfo* pFromRouteInfo = GC.getRouteInfo(eFromRoute);
int iFromMovementCost = pFromRouteInfo ? pFromRouteInfo->getMovementCost() : 0;
int iFromFlatMovementCost = pFromRouteInfo ? pFromRouteInfo->getFlatMovementCost() : 0;
RouteTypes eToRoute = bFakeRouteTo ? ROUTE_ROAD : pToPlot->getRouteType();
CvRouteInfo* pToRouteInfo = GC.getRouteInfo(eToRoute);
int iToMovementCost = pToRouteInfo ? pToRouteInfo->getMovementCost() : 0;
int iToFlatMovementCost = pToRouteInfo ? pToRouteInfo->getFlatMovementCost() : 0;
//routes only on land
int iBaseMoves = pUnit->baseMoves(DOMAIN_LAND);
int iRouteCost = std::max(iFromMovementCost + kUnitTeam.getRouteChange(eFromRoute), iToMovementCost + kUnitTeam.getRouteChange(eToRoute));
int iRouteFlatCost = std::max(iFromFlatMovementCost * iBaseMoves, iToFlatMovementCost * iBaseMoves);
iRegularCost = std::min(iRegularCost, std::min(iRouteCost,iRouteFlatCost));
}
//check border obstacles
TeamTypes eTeam = pToPlot->getTeam();
if(eTeam != NO_TEAM)
{
CvTeam* pPlotTeam = &GET_TEAM(eTeam);
CvPlayer* pPlotPlayer = &GET_PLAYER(pToPlot->getOwner());
// Great Wall increases movement cost by 1
if(pPlotTeam->isBorderObstacle() || pPlotPlayer->isBorderObstacle())
{
if(!pToPlot->isWater() && pUnit->getDomainType() == DOMAIN_LAND)
{
// Don't apply penalty to OUR team or teams we've given open borders to
if(eUnitTeam != eTeam && !pPlotTeam->IsAllowsOpenBordersToTeam(eUnitTeam))
{
iRegularCost += iMoveDenominator;
}
}
}
#if defined(MOD_BALANCE_CORE)
else if (eUnitTeam != eTeam)
{
//cheap checks first
if(!pToPlot->isWater() && pUnit->getDomainType() == DOMAIN_LAND)
{
//Plots worked by city with movement debuff reduce movement speed.
CvCity* pCity = pToPlot->getWorkingCity();
if(pCity != NULL)
{
if(pCity->GetBorderObstacleCity() > 0)
{
// Don't apply penalty to OUR team or teams we've given open borders to
if(!pPlotTeam->IsAllowsOpenBordersToTeam(eUnitTeam))
{
iRegularCost += iMoveDenominator;
}
}
}
}
if(pToPlot->isWater() && (pUnit->getDomainType() == DOMAIN_SEA || pToPlot->needsEmbarkation(pUnit)))
{
//Plots worked by city with movement debuff reduce movement speed.
CvCity* pCity = pToPlot->getWorkingCity();
if(pCity != NULL)
{
if(pCity->GetBorderObstacleWater() > 0)
{
// Don't apply penalty to OUR team or teams we've given open borders to
if(!pPlotTeam->IsAllowsOpenBordersToTeam(eUnitTeam))
{
iRegularCost += iMoveDenominator;
}
}
}
}
}
#endif
}
return iRegularCost;
}