本文整理汇总了C++中Nation::add_caravan_info方法的典型用法代码示例。如果您正苦于以下问题:C++ Nation::add_caravan_info方法的具体用法?C++ Nation::add_caravan_info怎么用?C++ Nation::add_caravan_info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nation
的用法示例。
在下文中一共展示了Nation::add_caravan_info方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init_ai
//--------- Begin of function Unit::init_ai ---------//
//
void Unit::init_ai()
{
is_ai = nation_recno && nation_array[nation_recno]->nation_type == NATION_AI;
if( nation_recno )
{
Nation* nationPtr = nation_array[nation_recno];
if( rank_id==RANK_GENERAL || rank_id==RANK_KING )
nationPtr->add_general_info(sprite_recno);
switch( unit_res[unit_id]->unit_class )
{
case UNIT_CLASS_CARAVAN:
nationPtr->add_caravan_info(sprite_recno);
break;
case UNIT_CLASS_SHIP:
nationPtr->add_ship_info(sprite_recno);
break;
}
}
}
示例2: change_nation
//--------- Begin of function Unit::change_nation ---------//
//
// This function is called when a unit change nation.
// It is not necessarily a result of betray, when a spy
// hands over his new nation to his parent nation, this
// function will also be called.
//
// <int> newNationRecno - change the nation of the unit.
//
void Unit::change_nation(int newNationRecno)
{
err_when( newNationRecno && nation_array.is_deleted(newNationRecno) );
err_when( unit_mode == UNIT_MODE_REBEL ); // rebels do not change nation
//--- special case: units in Monster Fortress cannot change nation ---//
if( unit_mode == UNIT_MODE_OVERSEE &&
firm_array[unit_mode_para]->firm_id == FIRM_FORTRESS )
{
return;
}
//---------------------------------//
int oldAiUnit = is_ai;
int oldNationRecno = nation_recno;
//-- if the player is giving a command to this unit, cancel the command --//
if( nation_recno == nation_array.player_recno &&
sprite_recno == unit_array.selected_recno &&
power.command_id )
{
power.command_id = 0;
}
//---------- stop all action to attack this unit ------------//
unit_array.stop_attack_obj(base_obj_recno);
//---- update nation_unit_count_array[] ----//
unit_res[unit_id]->unit_change_nation(newNationRecno, nation_recno, rank_id);
//------- if the nation has an AI action -------//
stop_order(); // clear the existing order
//---------------- update vars ----------------//
// unit_group_id = unit_array.cur_group_id++; // separate from the current group
nation_recno = newNationRecno;
home_camp_firm_recno = 0; // reset it
if( race_id )
{
nation_contribution = 0; // contribution to the nation
total_reward = 0;
}
// #### begin Gilbert 24/12 #######//
// -------- reset royal -------//
is_royal = 0;
// #### end Gilbert 24/12 #######//
//-------- if change to one of the existing nations ------//
is_ai = nation_recno && nation_array[nation_recno]->is_ai();
//------------ update AI info --------------//
if( oldNationRecno )
{
Nation* nationPtr = nation_array[oldNationRecno];
if( rank_id == RANK_GENERAL || rank_id == RANK_KING )
nationPtr->del_general_info(sprite_recno);
else if( unit_res[unit_id]->unit_class == UNIT_CLASS_CARAVAN )
nationPtr->del_caravan_info(sprite_recno);
else if( unit_res[unit_id]->unit_class == UNIT_CLASS_SHIP )
nationPtr->del_ship_info(sprite_recno);
}
if( nation_recno )
{
Nation* nationPtr = nation_array[nation_recno];
if( rank_id == RANK_GENERAL || rank_id == RANK_KING )
nationPtr->add_general_info(sprite_recno);
else if( unit_res[unit_id]->unit_class == UNIT_CLASS_CARAVAN )
nationPtr->add_caravan_info(sprite_recno);
else if( unit_res[unit_id]->unit_class == UNIT_CLASS_SHIP )
//.........这里部分代码省略.........