//Infrastructure SLIC v1.01 //file: infras.slc //by player1 // //Installation: // //Put this file in yours ..\ctp2_data\default\gamedata\ folder //and add #include "infras.slc" line in script.slc file. // //This code fixes AI bug in which AI players, when trying //to use Infrastructure or Capitalization, leave build queue empty. //It detects cities with empty build queues and gives them //15 per city pop PW and 10 per city pop gold bonus, //lowered by PW tax percent value. // //Example: // City size 28, PW tax 20% // gives 28*15*(1-0.2)=336 PW and 28*10*(1-0.2)=224 gold bonus // HandleEvent(AIFinishBeginTurn) 'Infras' post { if(!IsHumanPlayer(player[0])) { // not human int_t i; int_t my_tax; //PW tax int_t my_pw; //toloal PW int_t my_capit; //gold from cities int_t my_infras; //PW from cities city_t my_city; player[0] = g.player; my_tax = player[0].publicworkstax; for(i = 0; i < player[0].cities; i = i + 1) { GetCityByIndex(player[0], i, my_city); if (!my_city.buildqueuelength && (HasAdvance(player[0], ID_ADVANCE_MASS_PRODUCTION) || HasAdvance(player[0], ID_ADVANCE_GLOBAL_ECONOMICS))) { my_infras = my_city.population * 15 * (100 - my_tax) / 100; my_pw = player[0].publicworkslevel; my_pw = my_pw + my_infras; SetPW(player[0], my_pw); //add pw my_capit = my_city.population * (100 - my_tax) / 10; AddGold(player[0], my_capit); //add gold } } } }