本文整理汇总了C++中CvPlot::isOwned方法的典型用法代码示例。如果您正苦于以下问题:C++ CvPlot::isOwned方法的具体用法?C++ CvPlot::isOwned怎么用?C++ CvPlot::isOwned使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CvPlot
的用法示例。
在下文中一共展示了CvPlot::isOwned方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: syncRandPlot
///Tks Med
CvPlot* CvMap::syncRandPlot(int iFlags, int iArea, int iMinUnitDistance, int iTimeout, bool bIgnoreNativeTeams)
{
///TKe
CvPlot* pPlot = NULL;
int iCount = 0;
while (iCount < iTimeout)
{
CvPlot* pTestPlot = plotSorenINLINE(GC.getGameINLINE().getSorenRandNum(getGridWidthINLINE(), "Rand Plot Width"), GC.getGameINLINE().getSorenRandNum(getGridHeightINLINE(), "Rand Plot Height"));
FAssertMsg(pTestPlot != NULL, "TestPlot is not assigned a valid value");
if ((iArea == -1) || (pTestPlot->getArea() == iArea))
{
bool bValid = true;
if (bValid)
{
if (iMinUnitDistance != -1)
{
for (int iDX = -(iMinUnitDistance); iDX <= iMinUnitDistance; iDX++)
{
for (int iDY = -(iMinUnitDistance); iDY <= iMinUnitDistance; iDY++)
{
CvPlot* pLoopPlot = plotXY(pTestPlot->getX_INLINE(), pTestPlot->getY_INLINE(), iDX, iDY);
if (pLoopPlot != NULL)
{
if (pLoopPlot->isUnit())
{
bValid = false;
}
}
}
}
}
}
if (bValid)
{
if (iFlags & RANDPLOT_LAND)
{
if (pTestPlot->isWater())
{
bValid = false;
}
}
}
if (bValid)
{
if (iFlags & RANDPLOT_UNOWNED)
{
if (pTestPlot->isOwned())
{
///Tks Med
if (bIgnoreNativeTeams)
{
if (!GET_PLAYER(pTestPlot->getOwnerINLINE()).isNative())
{
bValid = false;
}
}
else
{
bValid = false;
}
///TKe
}
}
}
if (bValid)
{
if (iFlags & RANDPLOT_ADJACENT_UNOWNED)
{
if (pTestPlot->isAdjacentOwned())
{
bValid = false;
}
}
}
if (bValid)
{
if (iFlags & RANDPLOT_ADJACENT_LAND)
{
if (!(pTestPlot->isAdjacentToLand()))
{
bValid = false;
}
}
}
if (bValid)
{
if (iFlags & RANDPLOT_PASSIBLE)
{
if (pTestPlot->isImpassable())
//.........这里部分代码省略.........
示例2: AddToDominanceZones
/// Add data for this cell into dominance zone information
void CvTacticalAnalysisMap::AddToDominanceZones(int iIndex, CvTacticalAnalysisCell* pCell)
{
CvPlot* pPlot = GC.getMap().plotByIndex(iIndex);
// Compute zone data for this cell
m_TempZone.SetAreaID(pPlot->getArea());
m_TempZone.SetOwner(pPlot->getOwner());
m_TempZone.SetWater(pPlot->isWater());
if(!pPlot->isOwned())
{
m_TempZone.SetTerritoryType(TACTICAL_TERRITORY_NO_OWNER);
}
else if(pPlot->getTeam() == m_pPlayer->getTeam())
{
m_TempZone.SetTerritoryType(TACTICAL_TERRITORY_FRIENDLY);
}
else if(GET_TEAM(m_pPlayer->getTeam()).isAtWar(pPlot->getTeam()))
{
m_TempZone.SetTerritoryType(TACTICAL_TERRITORY_ENEMY);
}
else
{
m_TempZone.SetTerritoryType(TACTICAL_TERRITORY_NEUTRAL);
}
m_TempZone.SetClosestCity(NULL);
if(m_TempZone.GetTerritoryType() == TACTICAL_TERRITORY_ENEMY ||
m_TempZone.GetTerritoryType() == TACTICAL_TERRITORY_NEUTRAL ||
m_TempZone.GetTerritoryType() == TACTICAL_TERRITORY_FRIENDLY)
{
int iLoop;
int iBestDistance = MAX_INT;
CvCity* pBestCity = NULL;
for(CvCity* pLoopCity = GET_PLAYER(m_TempZone.GetOwner()).firstCity(&iLoop); pLoopCity != NULL; pLoopCity = GET_PLAYER(m_TempZone.GetOwner()).nextCity(&iLoop))
{
int iDistance = plotDistance(pLoopCity->getX(), pLoopCity->getY(), pPlot->getX(), pPlot->getY());
if(iDistance < iBestDistance)
{
iBestDistance = iDistance;
pBestCity = pLoopCity;
}
}
if(pBestCity != NULL)
{
m_TempZone.SetClosestCity(pBestCity);
}
}
// Now see if we already have a matching zone
CvTacticalDominanceZone* pZone = FindExistingZone(pPlot);
if(!pZone)
{
// Data populated, now add to vector
m_TempZone.SetDominanceZoneID(m_DominanceZones.size());
m_DominanceZones.push_back(m_TempZone);
pZone = &m_DominanceZones[m_DominanceZones.size() - 1];
}
// If this isn't owned territory, update zone with military strength info
if(pZone->GetTerritoryType() == TACTICAL_TERRITORY_NO_OWNER ||
pZone->GetTerritoryType() == TACTICAL_TERRITORY_TEMP_ZONE)
{
CvUnit* pFriendlyUnit = pCell->GetFriendlyMilitaryUnit();
if(pFriendlyUnit)
{
if(pFriendlyUnit->getDomainType() == DOMAIN_AIR ||
(pFriendlyUnit->getDomainType() == DOMAIN_LAND && !pZone->IsWater()) ||
(pFriendlyUnit->getDomainType() == DOMAIN_SEA && pZone->IsWater()))
{
int iStrength = pFriendlyUnit->GetBaseCombatStrengthConsideringDamage();
if(iStrength == 0 && pFriendlyUnit->isEmbarked() && !pZone->IsWater())
{
iStrength = pFriendlyUnit->GetBaseCombatStrength(true);
}
pZone->AddFriendlyStrength(iStrength * m_iUnitStrengthMultiplier);
pZone->AddFriendlyRangedStrength(pFriendlyUnit->GetMaxRangedCombatStrength(NULL, /*pCity*/ NULL, true, true));
if(pFriendlyUnit->GetRange() > GetBestFriendlyRange())
{
SetBestFriendlyRange(pFriendlyUnit->GetRange());
}
if(pFriendlyUnit->IsRangeAttackIgnoreLOS())
{
SetIgnoreLOS(true);
}
pZone->AddFriendlyUnitCount(1);
if(pFriendlyUnit->isRanged())
{
pZone->AddFriendlyRangedUnitCount(1);
}
}
}
CvUnit* pEnemyUnit = pCell->GetEnemyMilitaryUnit();
if(pEnemyUnit)
{
if(pEnemyUnit->getDomainType() == DOMAIN_AIR ||
(pEnemyUnit->getDomainType() == DOMAIN_LAND && !pZone->IsWater()) ||
(pEnemyUnit->getDomainType() == DOMAIN_SEA && pZone->IsWater()))
//.........这里部分代码省略.........