//---- Begin of function CampaignEastWest::stage_19_create_game ----// // // Vars defined in event functions before calling this function: // // -eastern_nation_recno // -attack_state_recno // -target_state_recno // int CampaignEastWest::stage_19_create_game() { // ###### begin Gilbert 1/4 ########// init_random_plot('C'); // ###### end Gilbert 1/4 ########// if( !stage_19_create_nation() ) return 0; if( !stage_19_create_town() ) return 0; if( !stage_19_create_firm() ) return 0; //----- create offensive structures ---------// if( m.random(2)==0 ) create_offensive_structure( STAGE_19_EASTERN_NATION_RECNO, 1 + campaign_difficulty/2 ); // build 2 structures if the difficulty > 3 //------ create the player troop -------// create_troop(PLAYER_NATION_RECNO, 86-campaign_difficulty*6); //------ init stage 1 vars -------// stage_19_init_vars(); //---- generate plants and other objects on the map -----// world.gen_rocks(); world.generate_map2(); //------- create additional raw sites ----------// create_raw_site(); //------- init relationship -------// stage_19_init_relation(); // ####### begin Gilbert 9/4 ########// // ----- create royal units ------// create_royal_units(CAMPAIGN_PLAYER_NATION_RECNO); // ####### end Gilbert 9/4 ########// // ###### begin Gilbert 1/4 ########// (this->*plot_create_game_FP)(); // ###### end Gilbert 1/4 ########// return 1; }
int CampaignEastWest::stage_23_create_firm() { //----- create firms around established towns -----// Nation* nationPtr = nation_array[STAGE_23_EASTERN_NATION_RECNO]; int townRecno1 = king_oversee_town_recno(STAGE_23_EASTERN_NATION_RECNO); int townRecno2 = random_pick_town_with_camp(STAGE_23_EASTERN_NATION_RECNO, 2); // only pick towns with <= 2 links if( townRecno2 && misc.random(2)==0 ) // swap the town in 50% chance { int t=townRecno1; townRecno1 = townRecno2; townRecno2 = t; } //--- while the races of towns are random, the two main towns' race has to be the king's race ---// town_array[townRecno1]->set_race(nationPtr->race_id); if( townRecno2 ) town_array[townRecno2]->set_race(nationPtr->race_id); create_economic_firm(townRecno1); create_offensive_structure(townRecno1); if( townRecno2 ) { create_military_firm(townRecno2); create_offensive_structure(townRecno2); } //----- four possible situations -------// int eastSituation = misc.random(2)+1; //-------------------------------------------------// // The target state has an emphasis on weapon // development and production. There are a number // of war factories and a large number of weapons. //-------------------------------------------------// if( eastSituation==1 ) { //---- build a war factory next to the town with mostly economic facilities. create_work_firm( town_array[townRecno1], FIRM_WAR_FACTORY ); //-- fill most of the forts with weapons -----// for( int i=0 ; i<nationPtr->ai_camp_count ; i++ ) { FirmCamp* firmCamp = firm_array[ nationPtr->ai_camp_array[i] ]->cast_to_FirmCamp(); int addCount = MAX_SOLDIER - firmCamp->soldier_count - misc.random(3); // don't always full up, sometimes leave a free slots empty for( int j=addCount ; j>0 ; j-- ) add_weapon_to_camp( firmCamp->firm_recno ); } //---- give it more cash upfront ------// nationPtr->cash += 2300 + 1000 * campaign_difficulty; } //-------------------------------------------------// // The target state has an emphasis on economic // development, it is vastly rich. And can use money // to boost up its military rapidly. //-------------------------------------------------// if( eastSituation==2 ) { //--- create one more series of economic buildings ---// int townRecno2 = random_pick_town_with_camp(STAGE_23_EASTERN_NATION_RECNO, 2); // only pick towns with <= 2 links if( townRecno2 ) create_economic_firm(townRecno2); //---- give it more cash upfront ------// nationPtr->cash += 3000 + 2300 * campaign_difficulty; } //------- add more groups of economy and military structures ---// int townRecno; if( campaign_difficulty >= 3 ) { townRecno = random_pick_town_with_camp(STAGE_23_EASTERN_NATION_RECNO, 2); // only pick towns with <= 2 links if( townRecno ) { town_array[townRecno]->set_race(nationPtr->race_id); create_military_firm(townRecno); create_offensive_structure(townRecno); } } if( campaign_difficulty >= 4 ) { townRecno = random_pick_town_with_camp(STAGE_23_EASTERN_NATION_RECNO, 2); // only pick towns with <= 2 links if( townRecno ) { town_array[townRecno]->set_race(nationPtr->race_id); create_economic_firm(townRecno); create_offensive_structure(townRecno); } } if( campaign_difficulty >= 5 ) { townRecno = random_pick_town_with_camp(STAGE_23_EASTERN_NATION_RECNO, 2); // only pick towns with <= 2 links if( townRecno ) { town_array[townRecno]->set_race(nationPtr->race_id); create_military_firm(townRecno); create_offensive_structure(townRecno); } } return 1; }