当前位置: 首页>>代码示例>>C++>>正文


C++ CvPlot::getTerrainType方法代码示例

本文整理汇总了C++中CvPlot::getTerrainType方法的典型用法代码示例。如果您正苦于以下问题:C++ CvPlot::getTerrainType方法的具体用法?C++ CvPlot::getTerrainType怎么用?C++ CvPlot::getTerrainType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CvPlot的用法示例。


在下文中一共展示了CvPlot::getTerrainType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: 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);
	}
}
开发者ID:Creosteanu,项目名称:nqmod-vs2008,代码行数:101,代码来源:CvReplayInfo.cpp

示例2: PlotFoundValue


//.........这里部分代码省略.........
								}
							}
							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())
#else	
								if (iDistance <= NUM_CITY_RINGS)
#endif
								{
									++iWetlandsCount;
								}
							}

							if (pLoopPlot->IsNaturalWonder())
							{
								if (iDistance <= 1)
								{
									++iNaturalWonderCount;
								}
							}

							if (pLoopPlot->getTerrainType() == TERRAIN_DESERT)
							{
#if defined(MOD_GLOBAL_CITY_WORKING)
								if (iDistance <= pPlayer->getWorkPlotDistance())
#else	
								if (iDistance <= NUM_CITY_RINGS)
#endif
								{
									if (ePlotResource == NO_RESOURCE)
									{
										++iDesertCount;
									}
								}
							}

							if (bIsInca)
							{
								if (pLoopPlot->isHills())
								{
#if defined(MOD_GLOBAL_CITY_WORKING)
								if (iDistance <= pPlayer->getWorkPlotDistance())
#else	
								if (iDistance <= NUM_CITY_RINGS)
#endif
									{
										iAdjacentMountains = pLoopPlot->GetNumAdjacentMountains();
										if (iAdjacentMountains > 0 && iAdjacentMountains < 6)
										{
											//give the bonus if it's hills, with additional if bordered by mountains
											rtnValue += m_iIncaMultiplier + (iAdjacentMountains * m_iIncaMultiplier);
										}
									}
									
开发者ID:rmarquis,项目名称:Community-Patch-DLL,代码行数:66,代码来源:CvSiteEvaluationClasses.cpp

示例3: PlotFoundValue


//.........这里部分代码省略.........
					{
						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())
					{
						if (iDistance <= iRange)
							++iLakeCount;
					}
					if (pLoopPlot->getResourceType(NO_TEAM) != NO_RESOURCE)
					{
						ResourceTypes eResource = pLoopPlot->getResourceType(eTeam);
						if(eResource != NO_RESOURCE && GC.getResourceInfo(eResource)->getResourceUsage() == RESOURCEUSAGE_LUXURY)
						{
							if (iDistance <= iRange)
							{
								++iLuxuryCount;
							}
						}
					}

					if (pLoopPlot->getTerrainType() == TERRAIN_DESERT)
					{
						if (iDistance <= iRange)
						{
							if (ePlotResource == NO_RESOURCE)
							{
								++iDesertCount;
							}
						}
					}

					if (bIsInca)
					{
						if (pLoopPlot->isHills() && iDistance <= iRange)
						{
							iAdjacentMountains = pLoopPlot->GetNumAdjacentMountains();
							if (iAdjacentMountains > 0 && iAdjacentMountains < 6)
							{
								//give the bonus if it's hills, with additional if bordered by mountains
								iCivModifier += (iAdjacentMountains+1) * m_iIncaMultiplier;
								vQualifiersPositive.push_back("(C) incan hills");
							}
						}
					}
				}
			}
		}
	}	

	//take into account only the best 70% of the plots - in the near term the city will not work all plots anyways
	std::stable_sort( workablePlots.begin(), workablePlots.end() );
	size_t iIrrelevantPlots = workablePlots.size()*30/100;
	for (size_t idx=iIrrelevantPlots; idx<workablePlots.size(); idx++)
开发者ID:Ninakoru,项目名称:Community-Patch-DLL,代码行数:67,代码来源:CvSiteEvaluationClasses.cpp


注:本文中的CvPlot::getTerrainType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。