Bazaar developer reference

CvDiplomacyAI::DoShareIntrigueStatement(PlayerTypes, DiploStatementTypes &)

Defined in
CvDiplomacyAI.cpp, line 14242
Class
CvDiplomacyAI
Hook name
CivHooks::CvDiplomacyAI_DoShareIntrigueStatement

Hooks

static bool BeforeCvDiplomacyAI_DoShareIntrigueStatement(CvDiplomacyAI* self, PlayerTypes ePlayer, DiploStatementTypes& eStatement);static void AfterCvDiplomacyAI_DoShareIntrigueStatement(CvDiplomacyAI* self, PlayerTypes ePlayer, DiploStatementTypes& eStatement);static void ReplaceCvDiplomacyAI_DoShareIntrigueStatement(void (*original)(CvDiplomacyAI*, PlayerTypes, DiploStatementTypes&), CvDiplomacyAI* self, PlayerTypes ePlayer, DiploStatementTypes& eStatement);CivRegisterBefore<CivHooks::CvDiplomacyAI_DoShareIntrigueStatement>(host, &BeforeCvDiplomacyAI_DoShareIntrigueStatement);CivRegisterAfter<CivHooks::CvDiplomacyAI_DoShareIntrigueStatement>(host, &AfterCvDiplomacyAI_DoShareIntrigueStatement);CivRegisterReplace<CivHooks::CvDiplomacyAI_DoShareIntrigueStatement>(host, &ReplaceCvDiplomacyAI_DoShareIntrigueStatement);

Code

14242void CvDiplomacyAI::DoShareIntrigueStatement(PlayerTypes ePlayer, DiploStatementTypes& eStatement)14243{14244	CvAssertMsg(ePlayer >= 0, "DIPLOMACY_AI: Invalid Player Index.  Please send slewis your save file and version.");14245	CvAssertMsg(ePlayer < MAX_MAJOR_CIVS, "DIPLOMACY_AI: Invalid Player Index.  Please send slewis your save file and version.");1424614247	if(eStatement == NO_DIPLO_STATEMENT_TYPE)14248	{14249		IntrigueNotificationMessage* pNotificationMessage = m_pPlayer->GetEspionage()->GetRecentIntrigueInfo(ePlayer);14250		if (pNotificationMessage)14251		{14252			// if this player has an untold plot against a player14253			if(pNotificationMessage->m_eSourcePlayer != NO_PLAYER)14254			{14255				bool bIsNewIntrigue = true;14256				// has any other player told the player about this plot?14257				for(uint ui = 0; ui < MAX_MAJOR_CIVS; ui++)14258				{14259					PlayerTypes eOtherPlayer = (PlayerTypes)ui;14260					// don't evalute the plotting player14261					if(eOtherPlayer == pNotificationMessage->m_eSourcePlayer)14262					{14263						continue;14264					}1426514266					if(GET_PLAYER(eOtherPlayer).GetEspionage()->HasSharedIntrigue(ePlayer, pNotificationMessage->m_eSourcePlayer, (CvIntrigueType)(pNotificationMessage->m_iIntrigueType)))14267					{14268						bIsNewIntrigue = false;14269						break;14270					}14271				}1427214273				if(bIsNewIntrigue)14274				{14275					MajorCivApproachTypes eApproachType = m_pPlayer->GetDiplomacyAI()->GetMajorCivApproach(ePlayer, false);14276					if (eApproachType != MAJOR_CIV_APPROACH_GUARDED && eApproachType != MAJOR_CIV_APPROACH_HOSTILE && eApproachType != MAJOR_CIV_APPROACH_WAR)14277					{14278						DiploStatementTypes eTempStatement = DIPLO_STATEMENT_SHARE_INTRIGUE;14279						int iTurnsBetweenStatements = 1;14280						if(GetNumTurnsSinceStatementSent(ePlayer, eTempStatement) > iTurnsBetweenStatements)14281						{14282							eStatement = eTempStatement;14283						}14284					}14285				}14286				else14287				{14288					// mark this as shared so it doesn't try to interrupt the player14289					m_pPlayer->GetEspionage()->MarkRecentIntrigueAsShared(ePlayer, pNotificationMessage->m_eSourcePlayer, (CvIntrigueType)(pNotificationMessage->m_iIntrigueType));14290				}14291			}14292		}14293	}14294}

Calls

Called by