Code
6370/// Updates what the Goal of war is with all Players6371void CvDiplomacyAI::DoUpdateWarGoals()6372{6373 // Are we going for World conquest? If so, then we want to fight our wars to the death6374 bool bWorldConquest = false;63756376 if(IsGoingForWorldConquest())6377 {6378 bWorldConquest = true;6379 }63806381 int iWarGoalValue;6382 WarGoalTypes eWarGoal;63836384 //PlayerTypes eLoopOtherPlayer;6385 //int iOtherPlayerLoop;6386 bool bHigherUpsWantWar;63876388 bool bIsMinor;63896390 WarProjectionTypes eProjection;63916392 // Loop through all (known) Players6393 PlayerTypes eLoopPlayer;6394 for(int iPlayerLoop = 0; iPlayerLoop < MAX_CIV_PLAYERS; iPlayerLoop++)6395 {6396 eLoopPlayer = (PlayerTypes) iPlayerLoop;63976398 if(IsPlayerValid(eLoopPlayer))6399 {6400 eWarGoal = NO_WAR_GOAL_TYPE;64016402 if(GET_TEAM(GetTeam()).isAtWar(GET_PLAYER(eLoopPlayer).getTeam()))6403 {6404 bIsMinor = (GET_PLAYER(eLoopPlayer).isMinorCiv());64056406 iWarGoalValue = 0;6407 bHigherUpsWantWar = false;64086409 // Higher ups want war with this Minor Civ6410 if(bIsMinor)6411 bHigherUpsWantWar = GetMinorCivApproach(eLoopPlayer) == MINOR_CIV_APPROACH_CONQUEST;6412 // Higher ups want war with this Major Civ6413 else6414 bHigherUpsWantWar = GetMajorCivApproach(eLoopPlayer, /*bHideTrueFeelings*/ false) == MAJOR_CIV_APPROACH_WAR;64156416 eProjection = GetWarProjection(eLoopPlayer);64176418 //////////////////////////////6419 // Higher ups want war, figure out what kind we're waging6420 if(bHigherUpsWantWar)6421 {6422 // Minor Civs6423 if(bIsMinor)64246425 // If we're going for the conquest victory, conquest is our goal with minors6426 if(bWorldConquest)6427 eWarGoal = WAR_GOAL_CONQUEST;6428 else6429 eWarGoal = WAR_GOAL_DAMAGE;64306431 // Major Civs - depends on how things are going6432 else6433 {6434 // Default goal is Damage6435 eWarGoal = WAR_GOAL_DAMAGE;64366437 // If we're locked into a coop war, we're out for conquest6438 if(IsLockedIntoCoopWar(eLoopPlayer))6439 eWarGoal = WAR_GOAL_CONQUEST;64406441 // If we think the war will go well, we can aim for conquest, which means we will not make peace6442 if(eProjection >= WAR_PROJECTION_UNKNOWN)6443 {6444 // If they're unforgivable we're out to destroy them, no less6445 if(GetMajorCivOpinion(eLoopPlayer) == MAJOR_CIV_OPINION_UNFORGIVABLE)6446 eWarGoal = WAR_GOAL_CONQUEST;64476448 // Out for world conquest?6449 else if(bWorldConquest)6450 eWarGoal = WAR_GOAL_CONQUEST;6451 }6452 }6453 }64546455 //////////////////////////////6456 // Higher ups don't want to be at war, figure out how bad things are6457 else6458 {6459 // If we're about to cause some mayhem then hold off on the peace stuff for a bit - not against Minors though6460 if(!bIsMinor && GetWarState(eLoopPlayer) == WAR_STATE_NEARLY_WON && GetStateAllWars() != STATE_ALL_WARS_LOSING)\6461 {6462 eWarGoal = WAR_GOAL_DAMAGE;6463 }6464 // War isn't decisively in our favor, so we'll make peace if possible6465 else6466 {6467 eWarGoal = WAR_GOAL_PEACE;6468 }6469 }6470 }6471 // Getting ready to attack6472 else if(GetWarGoal(eLoopPlayer) == WAR_GOAL_PREPARE)6473 eWarGoal = WAR_GOAL_PREPARE;6474 // Getting ready to make a forceful demand6475 else if(GetWarGoal(eLoopPlayer) == WAR_GOAL_DEMAND)6476 eWarGoal = WAR_GOAL_DEMAND;647764786479 // Update the counter for how long we've wanted peace for (used to determine when to ask for peace)6480 if(eWarGoal == WAR_GOAL_PEACE)6481 ChangeWantPeaceCounter(eLoopPlayer, 1);6482 else6483 SetWantPeaceCounter(eLoopPlayer, 0);64846485 // Set the War Goal6486 SetWarGoal(eLoopPlayer, eWarGoal);6487 }6488 }6489}