Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FUN_powergraph_score_and_civ_ranking()
- {
- score[8] = {0,0,0,0,0,0,0,0}; //number of civs
- max_score = 0;
- civ = 1;
- do
- {
- score[civ] = (money[civ]>>5)+total_population[civ]*8+number_of_techs[civ];
- unit_type = 0;
- do
- {
- score[civ] += unit_counter[civ][unit_type]*unit_cost[unit_type];
- unit_type++;
- }
- while (unit_type < 28); //types of units...
- if (civ_activity_flags&(1<<civ) == 0)
- score[civ] = 0; //why not check it _before_ though?
- if (civ != human_player_civ && score[civ] > max_score)
- max_score = score[civ]; //actually this result not used anywhere. This variable is set to -1 later anyway before it's used.
- if (game_turn < 600)
- {
- powgr_score = (score[civ]>>3);
- powgr_score = normalize_min_max(powgr_score,0,255);
- power_graph[(game_turn>>2)%150][civ] = powgr_score;
- //game actually writes graph data every turn,
- //but if turn is not divisible by 4, then game just re-writes a previous record...
- //that's why it looks like the game writes this data only every 4th turn
- //after 600 turn, game can start to write data from 0 position again, but it never happens because of condition above...
- //also power_graph data is stored in memory right after game_turn variable. You actually can
- //interpet game_turn as powergraph data from barbarians from turns 0-3...
- }
- peace_civ_flags = 0x00;
- civ2 = 0;
- do
- {
- if (diplomacy[civ][civ2]&3 != 0) //1 - contact 2 - peace 1+2 = 3
- peace_civ_flags |= (1<<civ2);
- civ2++;
- }
- while (civ2 < 8);
- if (turn < 600)
- {
- peace_data[(game_turn>>2)%150][civ] = peace_civ_flags;
- //peace data is stored in memory right after power graph data
- }
- civ++;
- }
- while (civ < 8);
- civ1 = 1;
- best_civ; //undefined
- //let's do some civ sorting...
- do
- {
- max_score = -1;
- civ2 = 1;
- do
- {
- if (score[civ2] > max_score_B)
- {
- best_civ = civ2;
- max_score = score[civ2];
- }
- civ2++;
- }
- while (civ2 < 8);
- civ_place[best_civ] = 8-civ1;
- score[best_civ] = -1;
- civ1++;
- }
- whie (civ1 < 8);
- gl_var_handicap = 0;
- if (civ_place[human_player_civ] == 7 && civ_cities[human_player_civ] > 4
- && unit_counter[human_player_civ][U_NUCLEAR] == 0 && game_turn > 200)
- {
- gl_var_handicap = 1; //it somehow changes ai behavior?.. used only in 2 places.
- //in one of them, if gl_var_handicap == 1 ai always selects republic gov't if ai_tech_counter < human_tech_counter?
- }
- civ = 1;
- while (civ < 8)
- {
- if (civ != human_player_civ && civ_cities[civ] > 1)
- {
- if ((diplomacy[civ][human_player_civ]&2) == 0) //at war?
- {
- diplomacy[civ][human_player_civ] |= 1; //has contact/at war?
- }
- else //at peace
- {
- diplomacy[civ][human_player_civ] |= 0x10; //??
- }
- }
- civ++;
- }
- return;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement