本文整理汇总了C++中Town::mobilize_town_people方法的典型用法代码示例。如果您正苦于以下问题:C++ Town::mobilize_town_people方法的具体用法?C++ Town::mobilize_town_people怎么用?C++ Town::mobilize_town_people使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Town
的用法示例。
在下文中一共展示了Town::mobilize_town_people方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: think_succeed_king
//.........这里部分代码省略.........
if( firmPtr->firm_id == FIRM_CAMP )
{
Worker* workerPtr = firmPtr->worker_array;
for(int j=1 ; j<=firmPtr->worker_count ; j++, workerPtr++ )
{
if( !workerPtr->race_id )
continue;
curRating = 0;
if( workerPtr->race_id == race_id )
curRating += 50;
if( workerPtr->rank_id == RANK_GENERAL )
curRating += 50;
if( workerPtr->skill_id == SKILL_LEADING )
curRating += workerPtr->skill_level;
if( curRating > bestRating )
{
bestRating = curRating;
bestUnitPtr = NULL;
bestFirmPtr = firmPtr;
bestWorkerId = j;
}
}
}
}
//------- if the best successor is a mobile unit -------//
if( bestUnitPtr )
{
//-- if the unit is in a command base or seat of power, mobilize it --//
if( !bestUnitPtr->is_visible() )
{
err_when( bestUnitPtr->unit_mode != UNIT_MODE_OVERSEE );
firm_array[bestUnitPtr->unit_mode_para]->mobilize_overseer();
err_when( bestUnitPtr->skill.combat_level<= 0 );
}
//---------- succeed the king -------------//
if( bestUnitPtr->is_visible() ) // it may still be not visible if there is no space for the unit to be mobilized
{
if( bestUnitPtr->spy_recno && bestUnitPtr->true_nation_recno() == nation_recno ) // if this is a spy and he's our spy
spy_array[bestUnitPtr->spy_recno]->drop_spy_identity(); // revert the spy to a normal unit
succeed_king( bestUnitPtr->sprite_recno );
return 1;
}
}
//------- if the best successor is a soldier in a camp -------//
if( bestFirmPtr )
{
int unitRecno = bestFirmPtr->mobilize_worker(bestWorkerId, COMMAND_AI);
if( unitRecno )
{
succeed_king( unitRecno );
return 1;
}
}
//--- if stil not found here, then try to locate the sucessor from villages ---//
Town* townPtr;
for( i=town_array.size() ; i>0 ; i-- )
{
if( town_array.is_deleted(i) )
continue;
townPtr = town_array[i];
if( townPtr->nation_recno != nation_recno )
continue;
if( townPtr->recruitable_race_pop(race_id, 0) > 0 ) // if this town has people with the same race as the original king
{
int unitRecno = townPtr->mobilize_town_people(race_id, 1, 0); // 1-dec pop, 0-don't mobilize spies
if( unitRecno )
{
succeed_king( unitRecno );
return 1;
}
}
}
return 0;
}