本文整理汇总了C++中CvPlot::getFeatureType方法的典型用法代码示例。如果您正苦于以下问题:C++ CvPlot::getFeatureType方法的具体用法?C++ CvPlot::getFeatureType怎么用?C++ CvPlot::getFeatureType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CvPlot
的用法示例。
在下文中一共展示了CvPlot::getFeatureType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PlotFoundValue
//.........这里部分代码省略.........
// this tile is so bad it gets negatives
iPlotValue -= iRingModifier * GC.getSETTLER_FOOD_MULTIPLIER() * 2;
}
iPlotValue += iStrategicValue;
// if this tile is a NW boost the value just so that we force the AI to claim them (if we can work it)
#if defined(MOD_GLOBAL_CITY_WORKING)
if (pLoopPlot->IsNaturalWonder() && iDistance > 0 && iDistance <= pPlayer->getWorkPlotDistance())
#else
if (pLoopPlot->IsNaturalWonder() && iDistance > 0 && iDistance <= NUM_CITY_RINGS)
#endif
{
//iPlotValue += iPlotValue * 2 + 10;
iPlotValue += iPlotValue * 2 + 500;
}
// lower value a lot if we already own this tile
if (iPlotValue > 0 && pLoopPlot->getOwner() == pPlayer->GetID())
{
#if defined(MOD_BALANCE_CORE_SETTLER)
if (MOD_BALANCE_CORE_SETTLER)
{
iPlotValue *= 2;
iPlotValue /= 3;
}
#else
iPlotValue /= 4;
#endif
}
// add this plot into the total
rtnValue += iPlotValue;
FeatureTypes ePlotFeature = pLoopPlot->getFeatureType();
ImprovementTypes ePlotImprovement = pLoopPlot->getImprovementType();
ResourceTypes ePlotResource = pLoopPlot->getResourceType();
if (ePlotFeature == FEATURE_FOREST)
{
if (iDistance <= 5)
{
++iIroquoisForestCount;
if (iDistance == 1)
{
if (ePlotImprovement == NO_IMPROVEMENT)
{
++iCelticForestCount;
}
}
}
}
else if (ePlotFeature == FEATURE_JUNGLE)
{
#if defined(MOD_GLOBAL_CITY_WORKING)
if (iDistance <= pPlayer->getWorkPlotDistance())
#else
if (iDistance <= NUM_CITY_RINGS)
#endif
{
++iBrazilJungleCount;
}
}
else if (ePlotFeature == FEATURE_MARSH || ePlotFeature == FEATURE_FLOOD_PLAINS)
{
#if defined(MOD_GLOBAL_CITY_WORKING)
if (iDistance <= pPlayer->getWorkPlotDistance())
示例2: createInfo
//.........这里部分代码省略.........
++iPlayerIndex;
PlayerInfo playerInfo;
playerInfo.m_eLeader = player.getLeaderType();
playerInfo.m_eCivilization = player.getCivilizationType();
playerInfo.m_eDifficulty = player.getHandicapType();
playerInfo.m_strCustomLeaderName = player.getName();
playerInfo.m_strCustomCivilizationName = player.getCivilizationDescription();
playerInfo.m_strCustomCivilizationShortName = player.getCivilizationShortDescription();
playerInfo.m_strCustomCivilizationAdjective = player.getCivilizationAdjective();
playerInfo.m_ePlayerColor = player.getPlayerColor();
TurnDataSets dataSet(m_dataSetMap.size());
unsigned int uiNumDataSets = player.getNumReplayDataSets();
for(unsigned int uiPlayerDataSet = 0; uiPlayerDataSet < uiNumDataSets; ++uiPlayerDataSet)
{
// First, Locate the index of the dataset
std::string playerDataSetName = player.getReplayDataSetName(uiPlayerDataSet);
unsigned int uiDataSet = 0;
bool bFound = false;
for(uiDataSet = 0; uiDataSet < m_dataSetMap.size(); ++uiDataSet)
{
const std::string& dataSetName = m_dataSetMap[uiDataSet];
if(dataSetName == playerDataSetName)
{
bFound = true;
break;
}
}
// Add a new index if one doesn't exist.
if(!bFound)
{
m_dataSetMap.push_back(playerDataSetName);
dataSet.push_back(TurnData());
uiDataSet = m_dataSetMap.size() - 1;
}
CvPlayer::TurnData playerData = player.getReplayDataHistory(uiPlayerDataSet);
TurnData turnData;
for(CvPlayer::TurnData::iterator it = playerData.begin(); it != playerData.end(); ++it)
{
turnData[(*it).first - m_iInitialTurn] = (*it).second;
}
dataSet[uiDataSet] = turnData;
}
m_listPlayerDataSets.push_back(dataSet);
m_listPlayerInfo.push_back(playerInfo);
}
}
m_listReplayMessages.clear();
const uint nMessages = game.getNumReplayMessages();
m_listReplayMessages.reserve(nMessages);
for(uint i = 0; i < nMessages; ++i)
{
const CvReplayMessage* pMessage = game.getReplayMessage(i);
if(pMessage)
{
CvReplayMessage modifiedMessage = (*pMessage);
modifiedMessage.setPlayer((PlayerTypes)mapPlayers[modifiedMessage.getPlayer()]);
m_listReplayMessages.push_back(modifiedMessage);
}
}
CvMap& kMap = GC.getMap();
m_iMapWidth = kMap.getGridWidth();
m_iMapHeight = kMap.getGridHeight();
int numPlots = kMap.numPlots();
m_listPlots.clear();
m_listPlots.reserve(numPlots);
for(int i = 0; i < numPlots; i++)
{
PlotState plotState;
CvPlot* pkPlot = kMap.plotByIndexUnchecked(i);
plotState.m_ePlotType = pkPlot->getPlotType();
plotState.m_eTerrain = pkPlot->getTerrainType();
plotState.m_eFeature = pkPlot->getFeatureType();
plotState.m_bNEOfRiver = pkPlot->isNEOfRiver();
plotState.m_bWOfRiver = pkPlot->isWOfRiver();
plotState.m_bNWOfRiver = pkPlot->isNWOfRiver();
PlotStatePerTurn plotStatePerTurn;
plotStatePerTurn[m_iFinalTurn] = plotState;
m_listPlots.push_back(plotStatePerTurn);
}
}
示例3: addEurope
//.........这里部分代码省略.........
bEurope = (pPlot->getY_INLINE() > (100 - iWidthPercent) * iGridHeight / 100 && pPlot->getX_INLINE() > iWidthPercent * iGridWidth / 100 && pPlot->getX_INLINE() < (100 - iWidthPercent) * iGridWidth / 100);
break;
case DIRECTION_SOUTH:
bEurope = (pPlot->getY_INLINE() < iWidthPercent * iGridHeight / 100 && pPlot->getX_INLINE() > iWidthPercent * iGridWidth / 100 && pPlot->getX_INLINE() < (100 - iWidthPercent) * iGridWidth / 100);
break;
default:
FAssertMsg(false, "Invalid direction");
break;
}
}
if (bEurope)
{
if (kEurope.getDomainsValid(DOMAIN_SEA))
{
for (int i = -iMinLandDistance; i <= iMinLandDistance && bEurope; i++)
{
for (int j = -iMinLandDistance; j <= iMinLandDistance && bEurope; j++)
{
CvPlot* pLoopPlot = ::plotXY(pPlot->getX_INLINE(), pPlot->getY_INLINE(), i, j);
if (pLoopPlot != NULL)
{
if (!pLoopPlot->isWater())
{
bEurope = false;
}
}
}
}
if (bEurope)
{
if (pPlot->getFeatureType() != NO_FEATURE && GC.getFeatureInfo(pPlot->getFeatureType()).isImpassable())
{
pPlot->setFeatureType(NO_FEATURE);
}
if (pPlot->isImpassable())
{
bEurope = false;
}
}
if (bEurope)
{
if (!pPlot->isEurope())
{
pPlot->setEurope(eEurope);
}
pPlot->setTradeScreenAccess(eEurope);
bAnyEuropeFound = true;
}
bEurope = true;
}
if (kEurope.getDomainsValid(DOMAIN_LAND))
{
switch ((DirectionTypes)iDir)
{
case DIRECTION_EAST:
if (pPlot->getX_INLINE() < (iGridWidth - kEurope.getMaxLandCoverage()))
{
bEurope = false;
示例4: FindBestArtistTargetPlot
CvPlot* CvPlayerAI::FindBestArtistTargetPlot(CvUnit* pGreatArtist, int& iResultScore)
{
CvAssertMsg(pGreatArtist, "pGreatArtist is null");
if(!pGreatArtist)
{
return NULL;
}
iResultScore = 0;
CvPlotsVector& m_aiPlots = GetPlots();
CvPlot* pBestPlot = NULL;
int iBestScore = 0;
// loop through plots and wipe out ones that are invalid
const uint nPlots = m_aiPlots.size();
for(uint ui = 0; ui < nPlots; ui++)
{
if(m_aiPlots[ui] == -1)
{
continue;
}
CvPlot* pPlot = GC.getMap().plotByIndex(m_aiPlots[ui]);
if(pPlot->isWater())
{
continue;
}
if(!pPlot->IsAdjacentOwnedByOtherTeam(getTeam()))
{
continue;
}
// don't build over luxury resources
ResourceTypes eResource = pPlot->getResourceType();
if(eResource != NO_RESOURCE)
{
CvResourceInfo* pkResource = GC.getResourceInfo(eResource);
if(pkResource != NULL)
{
if (pkResource->getResourceUsage() == RESOURCEUSAGE_LUXURY)
{
continue;
}
}
}
// if no improvement can be built on this plot, then don't consider it
FeatureTypes eFeature = pPlot->getFeatureType();
if (eFeature != NO_FEATURE && GC.getFeatureInfo(eFeature)->isNoImprovement())
{
continue;
}
// Improvement already here?
ImprovementTypes eImprovement = (ImprovementTypes)pPlot->getImprovementType();
if (eImprovement != NO_IMPROVEMENT)
{
CvImprovementEntry* pkImprovementInfo = GC.getImprovementInfo(eImprovement);
if(pkImprovementInfo)
{
if (pkImprovementInfo->GetCultureBombRadius() > 0)
{
continue;
}
}
}
int iScore = 0;
for(int iI = 0; iI < NUM_DIRECTION_TYPES; ++iI)
{
CvPlot* pAdjacentPlot = plotDirection(pPlot->getX(), pPlot->getY(), ((DirectionTypes)iI));
// if there's no plot, bail
if(pAdjacentPlot == NULL)
{
continue;
}
// if the plot is ours or no one's, bail
if(pAdjacentPlot->getTeam() == NO_TEAM || pAdjacentPlot->getTeam() == getTeam())
{
continue;
}
// don't evaluate city plots since we don't get ownership of them with the bomb
if(pAdjacentPlot->getPlotCity())
{
continue;
}
const PlayerTypes eOtherPlayer = pAdjacentPlot->getOwner();
if(GET_PLAYER(eOtherPlayer).isMinorCiv())
{
MinorCivApproachTypes eMinorApproach = GetDiplomacyAI()->GetMinorCivApproach(eOtherPlayer);
// if we're friendly or protective, don't be a jerk. Bail out.
if(eMinorApproach != MINOR_CIV_APPROACH_CONQUEST && eMinorApproach != MINOR_CIV_APPROACH_IGNORE)
//.........这里部分代码省略.........
示例5: PlotFoundValue
//.........这里部分代码省略.........
}
iTotalFoodValue += iFoodValue;
iTotalHappinessValue += iHappinessValue;
iTotalProductionValue += iProductionValue;
iTotalGoldValue += iGoldValue;
iTotalScienceValue += iScienceValue;
iTotalFaithValue += iFaithValue;
iTotalResourceValue += iResourceValue;
iTotalStrategicValue += iStrategicValue;
iPlotValue += iRingModifier * ( iFoodValue + iHappinessValue + iProductionValue + iGoldValue + iScienceValue + iFaithValue + iResourceValue ) + iStrategicValue;
}
// for the central plot
if (iDistance==0)
vQualifiersPositive.push_back( CvString::format("raw plot value %d", iPlotValue).c_str() );
if (iDistance==1 && !pPlot->isCoastalLand(GC.getMIN_WATER_SIZE_FOR_OCEAN()) && pLoopPlot->isCoastalLand(GC.getMIN_WATER_SIZE_FOR_OCEAN()))
bIsAlmostCoast = true;
// if this tile is a NW boost the value just so that we force the AI to claim them (if we can work it)
if (pLoopPlot->IsNaturalWonder() && iPlotValue>0)
iPlotValue *= 15;
// lower value a lot if we already own this tile
if (iPlotValue > 0 && pLoopPlot->getOwner() == ePlayer && ePlayer != NO_PLAYER)
iPlotValue /= 2;
// add this plot into the total
workablePlots.push_back( SPlotWithScore(pLoopPlot,iPlotValue) );
// some civ-specific checks
FeatureTypes ePlotFeature = pLoopPlot->getFeatureType();
ImprovementTypes ePlotImprovement = pLoopPlot->getImprovementType();
ResourceTypes ePlotResource = pLoopPlot->getResourceType();
if (ePlotFeature == FEATURE_FOREST)
{
if (iDistance <= 5)
{
++iIroquoisForestCount;
if (iDistance == 1)
if (ePlotImprovement == NO_IMPROVEMENT)
++iCelticForestCount;
}
}
else if (ePlotFeature == FEATURE_JUNGLE)
{
if (iDistance <= iRange)
++iBrazilJungleCount;
}
else if (ePlotFeature == FEATURE_MARSH || ePlotFeature == FEATURE_FLOOD_PLAINS)
{
if (iDistance <= iRange)
++iWetlandsCount;
}
if (pLoopPlot->IsNaturalWonder())
{
if (iDistance <= iRange)
++iNaturalWonderCount;
}
if (pLoopPlot->isLake())
{
示例6: PlotFoundValue
//.........这里部分代码省略.........
iTotalFoodValue += iFoodValue;
iTotalHappinessValue += iHappinessValue;
iTotalProductionValue += iProductionValue;
iTotalGoldValue += iGoldValue;
iTotalScienceValue += iScienceValue;
iTotalFaithValue += iFaithValue;
iTotalResourceValue += iResourceValue;
iTotalStrategicValue += iStrategicValue;
int iPlotValue = iFoodValue + iHappinessValue + iProductionValue + iGoldValue + iScienceValue + iFaithValue + iResourceValue;
if (iPlotValue == 0)
{
// this tile is so bad it gets negatives
iPlotValue -= iRingModifier * GC.getSETTLER_FOOD_MULTIPLIER() * 2;
}
iPlotValue += iStrategicValue;
// if this tile is a NW boost the value just so that we force the AI to claim them (if we can work it)
if (pLoopPlot->IsNaturalWonder() && iDistance > 0 && iDistance <= NUM_CITY_RINGS)
{
iPlotValue += iPlotValue * 2 + 10;
}
// lower value a lot if we already own this tile
if (iPlotValue > 0 && pLoopPlot->getOwner() == pPlayer->GetID())
{
iPlotValue /= 4;
}
// add this plot into the total
rtnValue += iPlotValue;
if (pLoopPlot->getFeatureType() == FEATURE_FOREST)
{
if (iDistance <= 5)
{
++iIroquoisForestCount;
if (iDistance == 1)
{
if (pLoopPlot->getImprovementType() == NO_IMPROVEMENT)
{
++iCelticForestCount;
}
}
}
}
}
}
else // this tile is owned by someone else
{
// See if there are other cities nearby (only count major civs)
if (iClosestEnemyCity > iDistance)
{
if (pLoopPlot->isCity() && (pLoopPlot->getOwner() < MAX_MAJOR_CIVS))
{
iClosestEnemyCity = iDistance;
}
}
}
}
}
}
}
if (pPlayer->GetPlayerTraits()->IsFaithFromUnimprovedForest())