本文整理汇总了C++中CvPlot::isRevealed方法的典型用法代码示例。如果您正苦于以下问题:C++ CvPlot::isRevealed方法的具体用法?C++ CvPlot::isRevealed怎么用?C++ CvPlot::isRevealed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CvPlot
的用法示例。
在下文中一共展示了CvPlot::isRevealed方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindBestMerchantTargetPlot
CvPlot* CvPlayerAI::FindBestMerchantTargetPlot(CvUnit* pGreatMerchant, bool bOnlySafePaths)
{
CvAssertMsg(pGreatMerchant, "pGreatMerchant is null");
if(!pGreatMerchant)
{
return NULL;
}
int iBestTurnsToReach = MAX_INT;
CvPlot* pBestTargetPlot = NULL;
int iPathTurns;
UnitHandle pMerchant = UnitHandle(pGreatMerchant);
CvTeam& kTeam = GET_TEAM(getTeam());
// Loop through each city state
for(int iI = 0; iI < MAX_PLAYERS; iI++)
{
CvPlayer& kPlayer = GET_PLAYER((PlayerTypes)iI);
if(kPlayer.isMinorCiv())
{
CvPlot* pCSPlot = kPlayer.getStartingPlot();
if(pCSPlot)
{
if(pCSPlot->isRevealed(getTeam()))
{
// Is this a minor we are friendly with?
if(GetDiplomacyAI()->GetMinorCivApproach(kPlayer.GetID()) != MINOR_CIV_APPROACH_CONQUEST &&
!kTeam.isAtWar(kPlayer.getTeam()) && GetDiplomacyAI()->GetWarGoal(kPlayer.GetID()) == NO_WAR_GOAL_TYPE)
{
// Search all the plots adjacent to this city (since can't enter the minor city plot itself)
for(int jJ = 0; jJ < NUM_DIRECTION_TYPES; jJ++)
{
CvPlot* pAdjacentPlot = plotDirection(pCSPlot->getX(), pCSPlot->getY(), ((DirectionTypes)jJ));
if(pAdjacentPlot != NULL)
{
// Make sure this is still owned by the city state and is revealed to us and isn't a water tile
if(pAdjacentPlot->getOwner() == (PlayerTypes)iI && pAdjacentPlot->isRevealed(getTeam())
&& !pAdjacentPlot->isWater())
{
iPathTurns = TurnsToReachTarget(pMerchant, pAdjacentPlot, true /*bReusePaths*/, !bOnlySafePaths/*bIgnoreUnits*/);
if(iPathTurns < iBestTurnsToReach)
{
iBestTurnsToReach = iPathTurns;
pBestTargetPlot = pAdjacentPlot;
}
}
}
}
}
}
}
}
}
return pBestTargetPlot;
}
示例2: AI_updateFoundValues
void CvPlayerAI::AI_updateFoundValues(bool bStartingLoc)
{
int iGoodEnoughToBeWorthOurTime = GC.getAI_STRATEGY_MINIMUM_SETTLE_FERTILITY();
int iLoop;
const int iNumPlots = GC.getMap().numPlots();
for(CvArea* pLoopArea = GC.getMap().firstArea(&iLoop); pLoopArea != NULL; pLoopArea = GC.getMap().nextArea(&iLoop))
{
pLoopArea->setTotalFoundValue(0);
}
const PlayerTypes eID = GetID();
if(bStartingLoc)
{
for(int iI = 0; iI < iNumPlots; iI++)
{
GC.getMap().plotByIndexUnchecked(iI)->setFoundValue(eID, -1);
}
}
else
{
const TeamTypes eTeam = getTeam();
GC.getGame().GetSettlerSiteEvaluator()->ComputeFlavorMultipliers(this);
for (int iI = 0; iI < iNumPlots; iI++)
{
CvPlot* pLoopPlot = GC.getMap().plotByIndexUnchecked(iI);
if (pLoopPlot->isRevealed(eTeam))
{
const int iValue = GC.getGame().GetSettlerSiteEvaluator()->PlotFoundValue(pLoopPlot, this, NO_YIELD, false);
pLoopPlot->setFoundValue(eID, iValue);
if (iValue >= iGoodEnoughToBeWorthOurTime)
{
CvArea* pLoopArea = GC.getMap().getArea(pLoopPlot->getArea());
if(pLoopArea && !pLoopArea->isWater())
{
pLoopArea->setTotalFoundValue(pLoopArea->getTotalFoundValue() + iValue);
}
}
}
else
{
pLoopPlot->setFoundValue(eID, -1);
}
}
}
}
示例3: AI_updateFoundValues
void CvPlayerAI::AI_updateFoundValues(bool bStartingLoc)
{
int iLoop;
const int iNumPlots = GC.getMap().numPlots();
for(CvArea *pLoopArea = GC.getMap().firstArea(&iLoop); pLoopArea != NULL; pLoopArea = GC.getMap().nextArea(&iLoop))
{
pLoopArea->setTotalFoundValue(0);
}
const PlayerTypes eID = GetID();
if (bStartingLoc)
{
for (int iI = 0; iI < iNumPlots; iI++)
{
GC.getMap().plotByIndexUnchecked(iI)->setFoundValue(eID, -1);
}
}
else
{
const TeamTypes eTeam = getTeam();
for (int iI = 0; iI < iNumPlots; iI++)
{
CvPlot* pLoopPlot = GC.getMap().plotByIndexUnchecked(iI);
if (pLoopPlot->isRevealed(eTeam))
{
const int iValue = AI_foundValue(pLoopPlot->getX(), pLoopPlot->getY());
pLoopPlot->setFoundValue(eID, iValue);
CvArea *pLoopArea = GC.getMap().getArea(pLoopPlot->getArea());
if (pLoopArea && !pLoopArea->isWater())
{
pLoopArea->setTotalFoundValue(pLoopArea->getTotalFoundValue() + iValue);
}
}
else
{
pLoopPlot->setFoundValue(eID, -1);
}
}
}
}
示例4: FindBestMusicianTargetPlot
CvPlot* CvPlayerAI::FindBestMusicianTargetPlot(CvUnit* pGreatMusician, bool bOnlySafePaths)
{
CvAssertMsg(pGreatMusician, "pGreatMusician is null");
if(!pGreatMusician)
{
return NULL;
}
int iBestTurnsToReach = MAX_INT;
CvPlot* pBestTargetPlot = NULL;
CvCity* pBestTargetCity = NULL;
int iPathTurns;
UnitHandle pMusician = UnitHandle(pGreatMusician);
// Find target civ
PlayerTypes eTargetPlayer = GetCulture()->GetCivLowestInfluence(true /*bCheckOpenBorders*/);
if (eTargetPlayer == NO_PLAYER)
{
return NULL;
}
CvPlayer &kTargetPlayer = GET_PLAYER(eTargetPlayer);
// Loop through each of that player's cities
int iLoop;
CvCity *pLoopCity;
for(pLoopCity = kTargetPlayer.firstCity(&iLoop); pLoopCity != NULL; pLoopCity = kTargetPlayer.nextCity(&iLoop))
{
// Search all the plots adjacent to this city
for(int jJ = 0; jJ < NUM_DIRECTION_TYPES; jJ++)
{
CvPlot* pAdjacentPlot = plotDirection(pLoopCity->getX(), pLoopCity->getY(), ((DirectionTypes)jJ));
if(pAdjacentPlot != NULL)
{
// Make sure this is still owned by target and is revealed to us
bool bRightOwner = (pAdjacentPlot->getOwner() == eTargetPlayer);
bool bIsRevealed = pAdjacentPlot->isRevealed(getTeam());
if(bRightOwner && bIsRevealed)
{
iPathTurns = TurnsToReachTarget(pMusician, pAdjacentPlot, true /*bReusePaths*/, !bOnlySafePaths/*bIgnoreUnits*/);
if(iPathTurns < iBestTurnsToReach)
{
iBestTurnsToReach = iPathTurns;
pBestTargetCity = pLoopCity;
}
}
}
}
}
// Found a city now look at ALL the plots owned by that player near that city
if (pBestTargetCity)
{
iBestTurnsToReach = MAX_INT;
CvPlot *pLoopPlot;
for(int iJ = 0; iJ < NUM_CITY_PLOTS; iJ++)
{
pLoopPlot = plotCity(pBestTargetCity->getX(), pBestTargetCity->getY(), iJ);
if(pLoopPlot != NULL)
{
// Make sure this is still owned by target and is revealed to us
bool bRightOwner = (pLoopPlot->getOwner() == eTargetPlayer);
bool bIsRevealed = pLoopPlot->isRevealed(getTeam());
if(bRightOwner && bIsRevealed)
{
iPathTurns = TurnsToReachTarget(pMusician, pLoopPlot, true /*bReusePaths*/, !bOnlySafePaths/*bIgnoreUnits*/);
if(iPathTurns < iBestTurnsToReach)
{
iBestTurnsToReach = iPathTurns;
pBestTargetPlot = pLoopPlot;
}
}
}
}
}
return pBestTargetPlot;
}
示例5: FindBestMerchantTargetPlot
CvPlot* CvPlayerAI::FindBestMerchantTargetPlot(CvUnit* pGreatMerchant, bool bOnlySafePaths)
{
CvAssertMsg(pGreatMerchant, "pGreatMerchant is null");
if(!pGreatMerchant)
{
return NULL;
}
int iBestTurnsToReach = MAX_INT;
CvPlot* pBestTargetPlot = NULL;
int iPathTurns;
UnitHandle pMerchant = UnitHandle(pGreatMerchant);
CvTeam& kTeam = GET_TEAM(getTeam());
//bool bIsVenice = GetPlayerTraits()->IsNoAnnexing();
//bool bWantsCash = GreatMerchantWantsCash();
// Loop through each city state
for(int iI = 0; iI < MAX_PLAYERS; iI++)
{
CvPlayer& kPlayer = GET_PLAYER((PlayerTypes)iI);
if (!kPlayer.isMinorCiv())
{
continue;
}
// if I'm Venice, I don't want to send a Merchant of Venice to a buy a city that I have trade routes
// with because it's probably more valuable as a trade partner than as an owned entity
//if (!bWantsCash)
//{
// if (bIsVenice)
// {
// if (GetTrade()->IsConnectedToPlayer(kPlayer.GetID()))
// {
// continue;
// }
// }
//}
CvPlot* pCSPlot = kPlayer.getStartingPlot();
if (!pCSPlot)
{
continue;
}
if (!pCSPlot->isRevealed(getTeam()))
{
continue;
}
// Is this a minor we are friendly with?
bool bMinorCivApproachIsCorrect = (GetDiplomacyAI()->GetMinorCivApproach(kPlayer.GetID()) != MINOR_CIV_APPROACH_CONQUEST);
bool bNotAtWar = !kTeam.isAtWar(kPlayer.getTeam());
bool bNotPlanningAWar = GetDiplomacyAI()->GetWarGoal(kPlayer.GetID()) == NO_WAR_GOAL_TYPE;
if(bMinorCivApproachIsCorrect && bNotAtWar && bNotPlanningAWar)
{
// Search all the plots adjacent to this city (since can't enter the minor city plot itself)
for(int jJ = 0; jJ < NUM_DIRECTION_TYPES; jJ++)
{
CvPlot* pAdjacentPlot = plotDirection(pCSPlot->getX(), pCSPlot->getY(), ((DirectionTypes)jJ));
if(pAdjacentPlot != NULL)
{
// Make sure this is still owned by the city state and is revealed to us and isn't a water tile
//if(pAdjacentPlot->getOwner() == (PlayerTypes)iI && pAdjacentPlot->isRevealed(getTeam()) && !pAdjacentPlot->isWater())
bool bRightOwner = (pAdjacentPlot->getOwner() == (PlayerTypes)iI);
bool bIsRevealed = pAdjacentPlot->isRevealed(getTeam());
if(bRightOwner && bIsRevealed)
{
iPathTurns = TurnsToReachTarget(pMerchant, pAdjacentPlot, true /*bReusePaths*/, !bOnlySafePaths/*bIgnoreUnits*/);
if(iPathTurns < iBestTurnsToReach)
{
iBestTurnsToReach = iPathTurns;
pBestTargetPlot = pAdjacentPlot;
}
}
}
}
}
}
return pBestTargetPlot;
}