Bazaar developer reference

CvDiplomacyAI::DoPlayerMetSomeone(PlayerTypes, PlayerTypes)

Defined in
CvDiplomacyAI.cpp, line 9876
Class
CvDiplomacyAI
Hook name
CivHooks::CvDiplomacyAI_DoPlayerMetSomeone

Hooks

static bool BeforeCvDiplomacyAI_DoPlayerMetSomeone(CvDiplomacyAI* self, PlayerTypes ePlayer, PlayerTypes eOtherPlayer);static void AfterCvDiplomacyAI_DoPlayerMetSomeone(CvDiplomacyAI* self, PlayerTypes ePlayer, PlayerTypes eOtherPlayer);static void ReplaceCvDiplomacyAI_DoPlayerMetSomeone(void (*original)(CvDiplomacyAI*, PlayerTypes, PlayerTypes), CvDiplomacyAI* self, PlayerTypes ePlayer, PlayerTypes eOtherPlayer);CivRegisterBefore<CivHooks::CvDiplomacyAI_DoPlayerMetSomeone>(host, &BeforeCvDiplomacyAI_DoPlayerMetSomeone);CivRegisterAfter<CivHooks::CvDiplomacyAI_DoPlayerMetSomeone>(host, &AfterCvDiplomacyAI_DoPlayerMetSomeone);CivRegisterReplace<CivHooks::CvDiplomacyAI_DoPlayerMetSomeone>(host, &ReplaceCvDiplomacyAI_DoPlayerMetSomeone);

Code

9875/// Someone met a new player9876void CvDiplomacyAI::DoPlayerMetSomeone(PlayerTypes ePlayer, PlayerTypes eOtherPlayer)9877{9878	// Have to have met both players (since this function is called upon EVERY contact)9879	if(IsPlayerValid(ePlayer) && IsPlayerValid(eOtherPlayer))9880	{9881		if(!GET_PLAYER(ePlayer).isMinorCiv())9882		{9883			// Catch up on Public Declarations9884			PublicDeclarationTypes eDeclaration;9885			int iData1;9886			int iData2;9887			bool bActive;98889889			for(int iLoop = 0; iLoop < MAX_DIPLO_LOG_STATEMENTS; iLoop++)9890			{9891				// Did ePlayer just meet the person this declaration is about?9892				if(GetDeclarationLogMustHaveMetPlayerForIndex(iLoop) == eOtherPlayer)9893				{9894					eDeclaration = GetDeclarationLogTypeForIndex(iLoop);98959896					// Does this entry in the log exist?9897					if(eDeclaration != NO_PUBLIC_DECLARATION_TYPE)9898					{9899						bActive = IsDeclarationLogForIndexActive(iLoop);99009901						// Is this still an active Declaration?9902						if(bActive)9903						{9904							iData1 = GetDeclarationLogData1ForIndex(iLoop);9905							iData2 = GetDeclarationLogData2ForIndex(iLoop);99069907							DoMakePublicDeclaration(eDeclaration, iData1, iData2, eOtherPlayer, ePlayer);9908						}9909					}9910				}9911			}9912		}9913	}9914}

Calls

Called by