本文整理汇总了C++中Nation::action_count方法的典型用法代码示例。如果您正苦于以下问题:C++ Nation::action_count方法的具体用法?C++ Nation::action_count怎么用?C++ Nation::action_count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nation
的用法示例。
在下文中一共展示了Nation::action_count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: del_talk_msg
//------ Begin of function TalkRes::del_talk_msg ------//
//
void TalkRes::del_talk_msg(int talkMsgRecno)
{
err_when( is_talk_msg_deleted(talkMsgRecno) );
TalkMsg* talkMsg = get_talk_msg(talkMsgRecno);
//--- if this message is sent to an AI nation ---//
Nation* nationPtr = nation_array[talkMsg->to_nation_recno];
if( nationPtr->nation_type == NATION_AI &&
(talkMsg->reply_type == REPLY_NOT_NEEDED || // even if a reply is not needed, the message will still be sent to the AI for notification.
talkMsg->reply_type == REPLY_WAITING) )
{
//--- it may still have the message in its action queue ---//
ActionNode* actionNode;
for( int i=nationPtr->action_count() ; i>0 ; i-- )
{
if( nationPtr->is_action_deleted(i) )
continue;
actionNode = nationPtr->get_action(i);
if( actionNode->action_mode == ACTION_AI_PROCESS_TALK_MSG &&
actionNode->action_para == talkMsgRecno )
{
nationPtr->del_action(i);
break;
}
}
}
//----- delete the message from the news array -----//
if( talkMsg->to_nation_recno == nation_array.player_recno ||
talkMsg->from_nation_recno == nation_array.player_recno )
{
news_array.remove( NEWS_DIPLOMACY, talkMsgRecno );
}
//----- link it out from talk_msg_array -----//
talk_msg_array.linkout(talkMsgRecno);
}
示例2: next_day
//.........这里部分代码省略.........
err_when( unique_id != spyPtr->unique_id );
// ####### end Gilbert 24/2 ########//
}
//------ debug: team ----------//
if( leader_unit_recno )
{
Unit* unitPtr = unit_array[leader_unit_recno];
err_when( unitPtr->rank_id != RANK_GENERAL && unitPtr->rank_id != RANK_KING );
}
err_when( (rank_id == RANK_GENERAL || rank_id == RANK_KING) &&
!team_info );
if( team_info )
{
for( int i=0 ; i<team_info->member_count ; i++ )
{
Unit* unitPtr = unit_array[team_info->member_unit_array[i]];
if( unitPtr->sprite_recno == sprite_recno ) // the same unit
continue;
err_when( unitPtr->leader_unit_recno != sprite_recno );
}
}
if( leader_unit_recno && unit_mode != UNIT_MODE_REBEL ) // in rebel mode, the leader_unit_recno is not linked to team_info
{
Unit* leaderUnit = unit_array[leader_unit_recno];
err_when( !leaderUnit->team_info );
for( int i=0 ; i<leaderUnit->team_info->member_count ; i++ )
{
if( leaderUnit->team_info->member_unit_array[i] == sprite_recno )
break;
}
err_when( i==leaderUnit->team_info->member_count ); // not found
err_when( unit_array.is_truly_deleted(leader_unit_recno) );
err_when( unit_array[leader_unit_recno]->nation_recno != nation_recno );
// err_when( unit_array[leader_unit_recno]->team_id != team_id );
}
//------ debug: AI action ----------//
if( cur_order.ai_action_id )
{
Nation* nationPtr = nation_array[nation_recno];
for( int actionRecno=nationPtr->action_count() ; actionRecno>0 ; actionRecno-- )
{
if( nationPtr->is_action_deleted(actionRecno) )
continue;
ActionNode* actionNode = nationPtr->get_action(actionRecno);
if( cur_order.ai_action_id == actionNode->action_id )
{
err_when( actionNode->processing_instance_count<1 );
break;
}
}
}
//---------------------------------//
err_when( hit_points > max_hit_points() );
err_when( max_hit_points() == 0 );
err_when( combat_level()<0 );
err_when( combat_level()>1000 );
err_when( unit_mode==UNIT_MODE_REBEL && spy_recno ); // no rebel spies
err_when( unit_mode==UNIT_MODE_REBEL && nation_recno ); // all rebels must be independent units
err_when( unit_mode==UNIT_MODE_TOWN_DEFENDER && spy_recno ); // no rebel spies
err_when( loyalty < 0 || loyalty > 100 );
err_when( nation_contribution < 0 );
err_when( nation_contribution > MAX_NATION_CONTRIBUTION );
err_when( is_ai && ( !nation_recno || !nation_array[nation_recno]->is_ai() ) );
#else // fix bug on fly in the release version
// ######## begin Gilbert 5/2 #####//
// if( combat_level() > skill.max_combat_level )
// combat_level() = skill.max_combat_level;
if( skill.actual_combat_level(NULL) > skill.max_combat_level ) // raw combat level
set_combat_level( skill.max_combat_level );
// ######## end Gilbert 5/2 #####//
#endif
}