//--------- Begin of function FirmCamp::next_day ---------// // void FirmCamp::next_day() { //----- call next_day() of the base class -----// Firm::next_day(); //----- update the patrol_unit_array -----// validate_patrol_unit(); validate_soldier(); //------- update loyalty --------// if( info.game_date%30 == firm_recno%30 ) update_loyalty(); //-------- consume food --------// if( soldier_count>0 ) consume_food(); // ------- process train ---------// if( config.fast_build && is_own() ) { for( int i=0 ; i<100 ; i++ ) basic_train(); } else basic_train(); //--------------------------------------// if( info.game_date%30 == firm_recno%30 ) // once a week { advanced_train(); } if( info.game_date%8 == firm_recno%8 ) { recover_hit_point(); } // ------ process item --------// Soldier* soldierPtr = soldier_array; for( int i=0 ; i<soldier_count ; i++, soldierPtr++ ) { soldierPtr->item.next_day(); } //----------- debugging code -----------// err_when( overseer_recno && unit_array[overseer_recno]->skill_level()==0 ); err_when( overseer_recno && unit_array[overseer_recno]->nation_recno != nation_recno ); }
//--------- Begin of function FirmCamp::assign_worker --------// // // Increase armed unit count of the race of the worker assigned, // as when a unit is assigned to a camp, Unit::deinit() will decrease // the counter, so we need to increase it back here. // void FirmCamp::assign_worker(int workerUnitRecno) { Firm::assign_worker(workerUnitRecno); //--- remove the unit from patrol_unit_array when it returns to the base ---// validate_patrol_unit(); //-------- sort soldiers ---------// sort_soldier(); }
//--------- Begin of function FirmMonster::next_day ---------// // void FirmMonster::next_day() { //-------- validate patrol unit --------// validate_patrol_unit(); //---- the monster boss recruit new monsters ----// if( info.game_date%10 == firm_recno%10 ) recruit_soldier(); //----- monsters recover hit points -------// if( info.game_date%15 == firm_recno%15 ) // once a week recover_hit_points(); //------ monster thinks about expansion -------// if( config.monster_type == OPTION_MONSTER_OFFENSIVE ) { if( info.game_date%30 == firm_recno%30 && m.random(3)==0 ) recruit_general(); /* if( info.game_date%90 == firm_recno%90 ) think_attack_neighbor(); */ //------ attack human towns and firms randomly -----// if( info.game_date > info.game_start_date + 1000 && // only start attacking 3 years after the game starts so the human can build up things info.game_date%30 == firm_recno%30 && m.random( firm_res[FIRM_MONSTER]->total_firm_count*6 )==0 ) // it will expand slower when there are already a lot of the monster structures on the map { think_attack_human(); } //--------- think expansion ---------// if( info.game_date%180 == firm_recno%180 && m.random( firm_res[FIRM_MONSTER]->total_firm_count*10 )==0 ) // it will expand slower when there are already a lot of the monster structures on the map { think_expansion(); } } }
//--------- Begin of function FirmCamp::next_day ---------// // void FirmCamp::next_day() { //----- call next_day() of the base class -----// Firm::next_day(); //----- update the patrol_unit_array -----// validate_patrol_unit(); //--------------------------------------// if( info.game_date%15 == firm_recno%15 ) // once a week { train_unit(); recover_hit_point(); } //--- if there are weapons in the firm, pay for their expenses ---// pay_weapon_expense(); }