本文整理汇总了C++中Town::needed_anti_spy_level方法的典型用法代码示例。如果您正苦于以下问题:C++ Town::needed_anti_spy_level方法的具体用法?C++ Town::needed_anti_spy_level怎么用?C++ Town::needed_anti_spy_level使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Town
的用法示例。
在下文中一共展示了Town::needed_anti_spy_level方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: think_assign_spy_own_town
//-------- Begin of function Nation::think_assign_spy_own_town --------//
//
// Think about planting spies into independent towns and enemy towns.
//
int Nation::think_assign_spy_own_town(int raceId, int regionId)
{
Town *townPtr;
int townCount = town_array.size();
int townRecno = m.random(townCount)+1;
int spyCount;
for( int i=town_array.size() ; i>0 ; i-- )
{
if( ++townRecno > townCount )
townRecno = 1;
if( town_array.is_deleted(townRecno) )
continue;
townPtr = town_array[townRecno];
if( townPtr->nation_recno != nation_recno ) // only assign to own firm
continue;
if( townPtr->region_id != regionId )
continue;
if( townPtr->population > MAX_TOWN_POPULATION-5 )
continue;
if( townPtr->majority_race() != raceId )
continue;
int curSpyLevel = spy_array.total_spy_skill_level( SPY_TOWN, townRecno, nation_recno, spyCount );
int neededSpyLevel = townPtr->needed_anti_spy_level();
if( neededSpyLevel > curSpyLevel + 30 )
return townRecno;
}
return 0;
}