//------- Begin of function FirmMarket::process_ai -----------// // void FirmMarket::process_ai() { //---- think about deleting this firm ----// if( info.game_date%30==firm_recno%30 ) { if( think_del() ) return; } //----- think about demand trade treaty -----// if( info.game_date%30==firm_recno%30 ) think_demand_trade_treaty(); //----- think about building a factory next to this market ----// if( info.game_date%60==firm_recno%60 ) think_market_build_factory(); //-------- think about new trading routes --------// if( info.game_date < last_import_new_goods_date+60 ) // don't new imports until it's 60 days after the last one was imported return; if( can_hire_caravan() ) { Nation* ownNation = nation_array[nation_recno]; int thinkInterval = 10 + (100-ownNation->pref_trading_tendency)/5; // think once every 10 to 30 days if( is_market_linked_to_town() ) { if( info.game_date%thinkInterval==firm_recno%thinkInterval ) think_import_new_product(); if( info.game_date%60 == (firm_recno+20)%60 ) { //------------------------------------------------------// // Don't think about increaseing existing product supply // if we have just import a new goods, it takes time // to transport and pile up goods. //------------------------------------------------------// if( !last_import_new_goods_date || info.game_date > last_import_new_goods_date+180 ) // only think increase existing supply 180 days after importing a new one { think_increase_existing_product_supply(); } } } if( info.game_date%thinkInterval == firm_recno%thinkInterval ) think_export_product(); } }
void FirmWar::process_ai() { //---- think about which technology to research ----// if( !build_unit_id ) think_new_production(); //------- recruit workers ---------// if( info.game_date%15==firm_recno%15 ) { if( worker_count < MAX_WORKER ) ai_recruit_worker(); } //----- think about closing down this firm -----// if( info.game_date%30==firm_recno%30 ) { if( think_del() ) return; } }