本文整理汇总了C++中Firm::is_human方法的典型用法代码示例。如果您正苦于以下问题:C++ Firm::is_human方法的具体用法?C++ Firm::is_human怎么用?C++ Firm::is_human使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Firm
的用法示例。
在下文中一共展示了Firm::is_human方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update_total_human_count
//------- Begin of function NationArray::update_total_human_count ------//
//
// Update total human count as there are some bugs in calculation of
// total human count. This function is used for on-fly correcting
// the problem.
//
void NationArray::update_total_human_count()
{
int totalHumanCountArray[MAX_NATION];
memset( totalHumanCountArray, 0, sizeof(totalHumanCountArray) );
//------ calculate firm statistic -------//
Firm* firmPtr;
int i;
for( i=firm_array.size() ; i>0 ; i-- )
{
if( firm_array.is_deleted(i) )
continue;
firmPtr = firm_array[i];
if( firmPtr->nation_recno == 0 || !firmPtr->is_human() )
continue;
if( firmPtr->cast_to_FirmCamp() )
{
FirmCamp *firmCamp = firmPtr->cast_to_FirmCamp();
for( int j=firmCamp->soldier_count-1 ; j>=0 ; j-- )
{
if( firmCamp->soldier_array[j].is_human() )
totalHumanCountArray[firmCamp->nation_recno-1]++;
}
}
if( firmPtr->cast_to_FirmTrain() )
{
FirmTrain *firmTrain = firmPtr->cast_to_FirmTrain();
totalHumanCountArray[firmTrain->nation_recno-1] += firmTrain->trainee_count;
}
}
//------ calculate unit statistic -------//
Unit* unitPtr;
for( i=unit_array.size() ; i>0 ; i-- )
{
if( unit_array.is_truly_deleted(i) )
continue;
unitPtr = unit_array[i];
if( unitPtr->nation_recno && unitPtr->is_human() &&
unitPtr->rank_id != RANK_KING ) // does not count kings
{
if( unitPtr->unit_id == UNIT_WAGON )
totalHumanCountArray[unitPtr->nation_recno-1] += unitPtr->cast_to_UnitWagon()->population;
else
totalHumanCountArray[unitPtr->nation_recno-1]++;
}
}
//------ update nation statistic ------//
for( i=size() ; i>0 ; i-- )
{
if( nation_array.is_deleted(i) )
continue;
nation_array[i]->total_human_count = totalHumanCountArray[i-1];
}
}