本文整理汇总了C++中Town::linked_camp_count方法的典型用法代码示例。如果您正苦于以下问题:C++ Town::linked_camp_count方法的具体用法?C++ Town::linked_camp_count怎么用?C++ Town::linked_camp_count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Town
的用法示例。
在下文中一共展示了Town::linked_camp_count方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: commander_power
//--------- Begin of function Unit::commander_power ---------//
//
// A commander's power is determined:
//
// -Population of the towns he controls
// -The employment rate of the towns he controls, the higher the
// employment rate, the higher his power is
// -If there are any other commanders controls the towns at the same time.
// -the no. of soldiers led by the commander and their combat levels.
//
int Unit::commander_power()
{
//---- if the commander is in a military camp -----//
int commanderPower=0;
if( unit_mode == UNIT_MODE_OVERSEE )
{
Firm* firmPtr = firm_array[unit_mode_para];
if( firmPtr->cast_to_FirmCamp() )
{
Town* townPtr;
for( int i=firmPtr->linked_town_count-1 ; i>=0 ; i-- )
{
if( firmPtr->linked_town_enable_array[i] == LINK_EE )
{
townPtr = town_array[firmPtr->linked_town_array[i]];
int linkedCampCount = townPtr->linked_camp_count(true);
if( linkedCampCount > 0 )
commanderPower += townPtr->population / linkedCampCount;
}
}
commanderPower += firmPtr->cast_to_FirmCamp()->soldier_count*3; // 0 to 24
}
else if( firmPtr->firm_id == FIRM_BASE )
{
commanderPower = 60;
}
}
else
{
commanderPower = team_info->member_count*3; // 0 to 24
}
return commanderPower;
}