Bazaar developer reference

CvDiplomacyAI::DoUpdateVictoryDisputeLevels()

Defined in
CvDiplomacyAI.cpp, line 8650
Class
CvDiplomacyAI
Hook name
CivHooks::CvDiplomacyAI_DoUpdateVictoryDisputeLevels

Hooks

static bool BeforeCvDiplomacyAI_DoUpdateVictoryDisputeLevels(CvDiplomacyAI* self);static void AfterCvDiplomacyAI_DoUpdateVictoryDisputeLevels(CvDiplomacyAI* self);static void ReplaceCvDiplomacyAI_DoUpdateVictoryDisputeLevels(void (*original)(CvDiplomacyAI*), CvDiplomacyAI* self);CivRegisterBefore<CivHooks::CvDiplomacyAI_DoUpdateVictoryDisputeLevels>(host, &BeforeCvDiplomacyAI_DoUpdateVictoryDisputeLevels);CivRegisterAfter<CivHooks::CvDiplomacyAI_DoUpdateVictoryDisputeLevels>(host, &AfterCvDiplomacyAI_DoUpdateVictoryDisputeLevels);CivRegisterReplace<CivHooks::CvDiplomacyAI_DoUpdateVictoryDisputeLevels>(host, &ReplaceCvDiplomacyAI_DoUpdateVictoryDisputeLevels);

Code

8649/// Updates what is our level of Dispute with a player is over Victory8650void CvDiplomacyAI::DoUpdateVictoryDisputeLevels()8651{8652	AIGrandStrategyTypes eMyGrandStrategy = GetPlayer()->GetGrandStrategyAI()->GetActiveGrandStrategy();86538654	PlayerTypes ePlayer;86558656	DisputeLevelTypes eDisputeLevel;86578658	int iVictoryDisputeWeight;86598660	// Loop through all (known) Players8661	for(int iPlayerLoop = 0; iPlayerLoop < MAX_CIV_PLAYERS; iPlayerLoop++)8662	{8663		ePlayer = (PlayerTypes) iPlayerLoop;86648665		if(IsPlayerValid(ePlayer))8666		{8667			eDisputeLevel = DISPUTE_LEVEL_NONE;86688669			// Minors can't really be an issue with Victory!8670			if(!GET_PLAYER(ePlayer).isMinorCiv())8671			{8672				iVictoryDisputeWeight = 0;86738674				// Does the other player's (estimated) Grand Strategy match our own?8675				if(GetPlayer()->GetGrandStrategyAI()->GetGuessOtherPlayerActiveGrandStrategy(ePlayer) == eMyGrandStrategy)8676				{8677					switch(GetPlayer()->GetGrandStrategyAI()->GetGuessOtherPlayerActiveGrandStrategyConfidence(ePlayer))8678					{8679					case GUESS_CONFIDENCE_POSITIVE:8680						iVictoryDisputeWeight += /*14*/ GC.getVICTORY_DISPUTE_GRAND_STRATEGY_MATCH_POSITIVE();8681						break;8682					case GUESS_CONFIDENCE_LIKELY:8683						iVictoryDisputeWeight += /*10*/ GC.getVICTORY_DISPUTE_GRAND_STRATEGY_MATCH_LIKELY();8684						break;8685					case GUESS_CONFIDENCE_UNSURE:8686						iVictoryDisputeWeight += /*6*/ GC.getVICTORY_DISPUTE_GRAND_STRATEGY_MATCH_UNSURE();8687						break;8688					}8689				}86908691				// Add weight for Player's competitiveness (0 - 10)8692				iVictoryDisputeWeight *= GetVictoryCompetitiveness();86938694				// Grand Strategy Matches: 108695				// VictoryCompetitiveness 10	: 1008696				// VictoryCompetitiveness 5		: 508697				// VictoryCompetitiveness 1		: 1086988699				// Now See what our new Dispute Level should be8700				if(iVictoryDisputeWeight >= /*80*/ GC.getVICTORY_DISPUTE_FIERCE_THRESHOLD())8701					eDisputeLevel = DISPUTE_LEVEL_FIERCE;8702				else if(iVictoryDisputeWeight >= /*50*/ GC.getVICTORY_DISPUTE_STRONG_THRESHOLD())8703					eDisputeLevel = DISPUTE_LEVEL_STRONG;8704				else if(iVictoryDisputeWeight >= /*30*/ GC.getVICTORY_DISPUTE_WEAK_THRESHOLD())8705					eDisputeLevel = DISPUTE_LEVEL_WEAK;8706			}87078708			// Actually set the Level8709			SetVictoryDisputeLevel(ePlayer, eDisputeLevel);8710		}8711	}8712}

Calls

Called by