Bazaar developer reference

CvDiplomacyAI::IsValidUIDiplomacyTarget(PlayerTypes)

Defined in
CvDiplomacyAI.cpp, line 28377
Class
CvDiplomacyAI
Hook name
CivHooks::CvDiplomacyAI_IsValidUIDiplomacyTarget

Hooks

static bool BeforeCvDiplomacyAI_IsValidUIDiplomacyTarget(CvDiplomacyAI* self, PlayerTypes eTargetPlayer, bool& result);static void AfterCvDiplomacyAI_IsValidUIDiplomacyTarget(CvDiplomacyAI* self, PlayerTypes eTargetPlayer, bool& result);static bool ReplaceCvDiplomacyAI_IsValidUIDiplomacyTarget(bool (*original)(CvDiplomacyAI*, PlayerTypes), CvDiplomacyAI* self, PlayerTypes eTargetPlayer);CivRegisterBefore<CivHooks::CvDiplomacyAI_IsValidUIDiplomacyTarget>(host, &BeforeCvDiplomacyAI_IsValidUIDiplomacyTarget);CivRegisterAfter<CivHooks::CvDiplomacyAI_IsValidUIDiplomacyTarget>(host, &AfterCvDiplomacyAI_IsValidUIDiplomacyTarget);CivRegisterReplace<CivHooks::CvDiplomacyAI_IsValidUIDiplomacyTarget>(host, &ReplaceCvDiplomacyAI_IsValidUIDiplomacyTarget);

Code

28375//	Returns true if the target is valid to show a UI to immediately.28376//	This will return true if the source and destination are both AI.28377bool CvDiplomacyAI::IsValidUIDiplomacyTarget(PlayerTypes eTargetPlayer)28378{28379	if(eTargetPlayer != NO_PLAYER)28380	{28381		CvPlayer& kTarget = GET_PLAYER(eTargetPlayer);28382#if defined(MOD_AI_MP_DIPLOMACY)28383		bool bValid;28384		if (MOD_AI_MP_DIPLOMACY) {28385			bValid = (m_eTargetPlayer == DIPLO_ALL_PLAYERS || m_eTargetPlayer == eTargetPlayer || ((DiplomacyPlayerType)m_eTargetPlayer == DIPLO_AI_PLAYERS && !kTarget.isHuman()) || ((DiplomacyPlayerType)m_eTargetPlayer == DIPLO_HUMAN_PLAYERS && kTarget.isHuman()));28386		} else {28387			bValid = (m_eTargetPlayer == NO_PLAYER || m_eTargetPlayer == eTargetPlayer || ((DiplomacyPlayerType)m_eTargetPlayer == DIPLO_AI_PLAYERS && !kTarget.isHuman()) || ((DiplomacyPlayerType)m_eTargetPlayer == DIPLO_HUMAN_PLAYERS && kTarget.isHuman()));28388		}28389		28390		if (bValid)28391#else28392		if(m_eTargetPlayer == NO_PLAYER || m_eTargetPlayer == eTargetPlayer || ((DiplomacyPlayerType)m_eTargetPlayer == DIPLO_AI_PLAYERS && !kTarget.isHuman()) || ((DiplomacyPlayerType)m_eTargetPlayer == DIPLO_HUMAN_PLAYERS && kTarget.isHuman()))28393#endif28394			return true;28395	}2839628397	return false;28398}

Calls

Called by