Bazaar developer reference

CvPlayerEspionage::GetIntrigueMessage(uint)

Defined in
CvEspionageClasses.cpp, line 3626
Class
CvPlayerEspionage
Hook name
CivHooks::CvPlayerEspionage_GetIntrigueMessage

Hooks

static bool BeforeCvPlayerEspionage_GetIntrigueMessage(CvPlayerEspionage* self, uint uiIndex, Localization::String& result);static void AfterCvPlayerEspionage_GetIntrigueMessage(CvPlayerEspionage* self, uint uiIndex, Localization::String& result);static Localization::String ReplaceCvPlayerEspionage_GetIntrigueMessage(Localization::String (*original)(CvPlayerEspionage*, uint), CvPlayerEspionage* self, uint uiIndex);CivRegisterBefore<CivHooks::CvPlayerEspionage_GetIntrigueMessage>(host, &BeforeCvPlayerEspionage_GetIntrigueMessage);CivRegisterAfter<CivHooks::CvPlayerEspionage_GetIntrigueMessage>(host, &AfterCvPlayerEspionage_GetIntrigueMessage);CivRegisterReplace<CivHooks::CvPlayerEspionage_GetIntrigueMessage>(host, &ReplaceCvPlayerEspionage_GetIntrigueMessage);

Code

3625/// GetIntrigueMessage - Getting the intrigue message in another text format for the intrigue message display3626Localization::String CvPlayerEspionage::GetIntrigueMessage(uint uiIndex)3627{3628	CvAssertMsg(uiIndex < m_aIntrigueNotificationMessages.size(), "uiIndex out of bounds");3629	if(uiIndex >= m_aIntrigueNotificationMessages.size())3630	{3631		return "";3632	}36333634	Localization::String strResult = "";36353636	// get the city if it exists3637	CvCity* pCity = NULL;3638	if(m_aIntrigueNotificationMessages[uiIndex].m_iCityX != -1 && m_aIntrigueNotificationMessages[uiIndex].m_iCityY)3639	{3640		CvPlot* pPlot = GC.getMap().plot(m_aIntrigueNotificationMessages[uiIndex].m_iCityX, m_aIntrigueNotificationMessages[uiIndex].m_iCityY);3641		if(pPlot)3642		{3643			pCity = pPlot->getPlotCity();3644		}3645	}36463647	switch(m_aIntrigueNotificationMessages[uiIndex].m_iIntrigueType)3648	{3649	case INTRIGUE_TYPE_DECEPTION:3650		if(m_aIntrigueNotificationMessages[uiIndex].m_eTargetPlayer == m_pPlayer->GetID())  // if we found intrigue related to us3651		{3652			strResult = Localization::Lookup("TXT_KEY_INTRIGUE_PLOTTING_AGAINST_YOU");3653			if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).isHuman())3654			{3655				strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNickName();3656			}3657			else3658			{3659				strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNameKey();3660			}3661		}3662		else if(m_aIntrigueNotificationMessages[uiIndex].m_eTargetPlayer == NO_PLAYER)  // if we don't know who the intrigue information is about3663		{3664			strResult = Localization::Lookup("TXT_KEY_INTRIGUE_PLOTTING_AGAINST_UNKNOWN");3665			if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).isHuman())3666			{3667				strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNickName();3668			}3669			else3670			{3671				strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNameKey();3672			}3673		}3674		else // if we found intrigue related to another player3675		{3676			strResult = Localization::Lookup("TXT_KEY_INTRIGUE_PLOTTING_AGAINST_KNOWN");3677			if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).isHuman())3678			{3679				strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNickName();3680			}3681			else3682			{3683				strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNameKey();3684			}36853686			if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eTargetPlayer).isHuman())3687			{3688				strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eTargetPlayer).getNickName();3689			}3690			else3691			{3692				strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eTargetPlayer).getNameKey();3693			}3694		}3695		break;3696	case INTRIGUE_TYPE_BUILDING_ARMY:3697		strResult = Localization::Lookup("TXT_KEY_INTRIGUE_BUILDING_ARMY");3698		if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).isHuman())3699		{3700			strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNickName();3701		}3702		else3703		{3704			strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNameKey();3705		}3706		break;3707	case INTRIGUE_TYPE_BUILDING_AMPHIBIOUS_ARMY:3708		strResult = Localization::Lookup("TXT_KEY_INTRIGUE_BUILDING_AMPHIBIOUS_ARMY");3709		if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).isHuman())3710		{3711			strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNickName();3712		}3713		else3714		{3715			strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNameKey();3716		}3717		break;3718	case INTRIGUE_TYPE_ARMY_SNEAK_ATTACK:3719		// player is target3720		if(m_aIntrigueNotificationMessages[uiIndex].m_eTargetPlayer == m_pPlayer->GetID())3721		{3722			if(pCity)3723			{3724				strResult = Localization::Lookup("TXT_KEY_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_YOU_CITY_KNOWN");3725				if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).isHuman())3726				{3727					strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNickName();3728				}3729				else3730				{3731					strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNameKey();3732				}3733				strResult << pCity->getNameKey();3734			}3735			else3736			{3737				strResult = Localization::Lookup("TXT_KEY_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_YOU_CITY_UNKNOWN");3738				if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).isHuman())3739				{3740					strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNickName();3741				}3742				else3743				{3744					strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNameKey();3745				}3746			}3747		}3748		// other player is target3749		else if(m_aIntrigueNotificationMessages[uiIndex].m_eTargetPlayer != NO_PLAYER && m_aIntrigueNotificationMessages[uiIndex].m_eTargetPlayer != MAX_MAJOR_CIVS)3750		{3751			if(pCity)3752			{3753				strResult = Localization::Lookup("TXT_KEY_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_KNOWN_CITY_KNOWN");3754				if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).isHuman())3755				{3756					strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNickName();3757				}3758				else3759				{3760					strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNameKey();3761				}3762				strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eTargetPlayer).getCivilizationAdjectiveKey();3763				strResult << pCity->getNameKey();3764			}3765			else3766			{3767				strResult = Localization::Lookup("TXT_KEY_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_KNOWN_CITY_UNKNOWN");3768				if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).isHuman())3769				{3770					strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNickName();3771				}3772				else3773				{3774					strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNameKey();3775				}37763777				if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eTargetPlayer).isHuman())3778				{3779					strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eTargetPlayer).getNickName();3780				}3781				else3782				{3783					strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eTargetPlayer).getNameKey();3784				}3785			}3786		}3787		// unknown player is target3788		else3789		{3790			if (m_aIntrigueNotificationMessages[uiIndex].m_eTargetPlayer == MAX_MAJOR_CIVS)3791			{3792				strResult = Localization::Lookup("TXT_KEY_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_SOMEONE");3793			}3794			else3795			{3796				strResult = Localization::Lookup("TXT_KEY_INTRIGUE_SNEAK_ATTACK_ARMY_AGAINST_UNKNOWN");3797			}3798			if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).isHuman())3799			{3800				strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNickName();3801			}3802			else3803			{3804				strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNameKey();3805			}3806		}3807		break;3808	case INTRIGUE_TYPE_AMPHIBIOUS_SNEAK_ATTACK:3809		// player is target3810		if(m_aIntrigueNotificationMessages[uiIndex].m_eTargetPlayer == m_pPlayer->GetID())3811		{3812			if(pCity)3813			{3814				strResult = Localization::Lookup("TXT_KEY_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_YOU_CITY_KNOWN");3815				if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).isHuman())3816				{3817					strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNickName();3818				}3819				else3820				{3821					strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNameKey();3822				}3823				strResult << pCity->getNameKey();3824			}3825			else3826			{3827				strResult = Localization::Lookup("TXT_KEY_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_YOU_CITY_UNKNOWN");3828				if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).isHuman())3829				{3830					strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNickName();3831				}3832				else3833				{3834					strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNameKey();3835				}3836			}3837		}3838		// other player is target3839		else if(m_aIntrigueNotificationMessages[uiIndex].m_eTargetPlayer != NO_PLAYER && m_aIntrigueNotificationMessages[uiIndex].m_eTargetPlayer != MAX_MAJOR_CIVS)3840		{3841			if(pCity)3842			{3843				strResult = Localization::Lookup("TXT_KEY_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_KNOWN_CITY_KNOWN");3844				if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).isHuman())3845				{3846					strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNickName();3847				}3848				else3849				{3850					strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNameKey();3851				}3852				strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eTargetPlayer).getCivilizationAdjectiveKey();3853				strResult << pCity->getNameKey();3854			}3855			else3856			{3857				strResult = Localization::Lookup("TXT_KEY_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_KNOWN_CITY_UNKNOWN");3858				if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).isHuman())3859				{3860					strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNickName();3861				}3862				else3863				{3864					strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNameKey();3865				}38663867				if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eTargetPlayer).isHuman())3868				{3869					strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eTargetPlayer).getNickName();3870				}3871				else3872				{3873					strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eTargetPlayer).getNameKey();3874				}3875			}3876		}3877		// unknown player is target3878		else3879		{3880			if (m_aIntrigueNotificationMessages[uiIndex].m_eTargetPlayer == MAX_MAJOR_CIVS)3881			{3882				strResult = Localization::Lookup("TXT_KEY_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_SOMEONE");3883			}3884			else3885			{3886				strResult = Localization::Lookup("TXT_KEY_INTRIGUE_SNEAK_ATTACK_AMPHIB_AGAINST_UNKNOWN");3887			}38883889			if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).isHuman())3890			{3891				strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNickName();3892			}3893			else3894			{3895				strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNameKey();3896			}3897		}3898		break;3899	case INTRIGUE_TYPE_CONSTRUCTING_WONDER:3900		if (pCity)3901		{3902			strResult = Localization::Lookup("TXT_KEY_INTRIGUE_CONSTRUCT_WONDER");3903		}3904		else3905		{3906			strResult = Localization::Lookup("TXT_KEY_INTRIGUE_CONSTRUCT_WONDER_WO_CITY");3907		}3908		if(GC.getGame().isGameMultiPlayer() && GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).isHuman())3909		{3910			strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNickName();3911		}3912		else3913		{3914			strResult << GET_PLAYER(m_aIntrigueNotificationMessages[uiIndex].m_eSourcePlayer).getNameKey();3915		}3916		if (m_aIntrigueNotificationMessages[uiIndex].m_eBuilding != NO_BUILDING)3917		{3918			CvBuildingEntry* pBuildingInfo = GC.getBuildingInfo(m_aIntrigueNotificationMessages[uiIndex].m_eBuilding);3919			CvAssertMsg(pBuildingInfo, "pBuildingInfo is null");3920			if (pBuildingInfo)3921			{3922				strResult << pBuildingInfo->GetTextKey();3923			}3924		}3925		else if (m_aIntrigueNotificationMessages[uiIndex].m_eProject != NO_PROJECT)3926		{3927			CvProjectEntry* pProjectInfo = GC.getProjectInfo(m_aIntrigueNotificationMessages[uiIndex].m_eProject);3928			CvAssertMsg(pProjectInfo, "pProjectInfo is null");3929			if (pProjectInfo)3930			{3931				strResult << pProjectInfo->GetTextKey();3932			}3933		}39343935		if (pCity)3936		{3937			strResult << pCity->getNameKey();3938		}3939		break;3940	}39413942	return strResult;3943}

Calls

Called by