本文整理汇总了C++中Town::think_independent_town方法的典型用法代码示例。如果您正苦于以下问题:C++ Town::think_independent_town方法的具体用法?C++ Town::think_independent_town怎么用?C++ Town::think_independent_town使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Town
的用法示例。
在下文中一共展示了Town::think_independent_town方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process
//--------- Begin of function TownArray::process ---------//
//
// Process all town in town_array for action and movement for next frame
//
void TownArray::process()
{
//----- call Town::next_day --------//
int i;
Town *townPtr;
for( i=size() ; i>0 ; i-- )
{
townPtr = (Town*) get_ptr(i);
if( !townPtr )
continue;
//------- if all the population are gone --------//
if( townPtr->population==0 )
{
del_town(i);
continue;
}
//-------------------------------//
err_when(town_array.is_deleted(i));
err_when( townPtr->town_recno==0 );
if( i%FRAMES_PER_DAY == int(sys.frame_count%FRAMES_PER_DAY) ) // only process each firm once per day
{
err_when( townPtr->town_recno==0 );
if( townPtr->nation_recno==0 )
{
townPtr->think_independent_town();
}
else
{
#ifdef DEBUG
if(!config.disable_ai_flag && townPtr->ai_town)
#else
if( townPtr->ai_town )
#endif
{
#ifdef DEBUG
unsigned long profileStartTime = m.get_time();
#endif
townPtr->process_ai();
#ifdef DEBUG
town_profile_time += m.get_time() - profileStartTime;
#endif
}
}
if( town_array.is_deleted(i) )
continue;
err_when( townPtr->town_recno==0 );
//### begin alex 20/9 ###//
#ifdef DEBUG
unsigned long profileStartTime = m.get_time();
#endif
townPtr->next_day();
#ifdef DEBUG
town_profile_time += m.get_time() - profileStartTime;
#endif
//#### end alex 20/9 ####//
}
}
//------ distribute demand -------//
if( sys.day_frame_count==0 && info.game_date%15==0 ) // distribute demand every 15 days
distribute_demand();
//------ create new independent town -----//
if( info.game_date%30==0 && sys.frame_count%FRAMES_PER_DAY==0 )
think_new_independent_town();
}