Bazaar developer reference

CvPlayerCulture::GetTourismModifierWithTooltip(PlayerTypes) const

Defined in
CvCultureClasses.cpp, line 3269
Class
CvPlayerCulture
Hook name
CivHooks::CvPlayerCulture_GetTourismModifierWithTooltip

Hooks

static bool BeforeCvPlayerCulture_GetTourismModifierWithTooltip(const CvPlayerCulture* self, PlayerTypes ePlayer, CvString& result);static void AfterCvPlayerCulture_GetTourismModifierWithTooltip(const CvPlayerCulture* self, PlayerTypes ePlayer, CvString& result);static CvString ReplaceCvPlayerCulture_GetTourismModifierWithTooltip(CvString (*original)(const CvPlayerCulture*, PlayerTypes), const CvPlayerCulture* self, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvPlayerCulture_GetTourismModifierWithTooltip>(host, &BeforeCvPlayerCulture_GetTourismModifierWithTooltip);CivRegisterAfter<CivHooks::CvPlayerCulture_GetTourismModifierWithTooltip>(host, &AfterCvPlayerCulture_GetTourismModifierWithTooltip);CivRegisterReplace<CivHooks::CvPlayerCulture_GetTourismModifierWithTooltip>(host, &ReplaceCvPlayerCulture_GetTourismModifierWithTooltip);

Code

3268/// Tooltip for GetTourismModifierWith()3269CvString CvPlayerCulture::GetTourismModifierWithTooltip(PlayerTypes ePlayer) const3270{3271	CvString szRtnValue = "";3272	CvPlayer &kPlayer = GET_PLAYER(ePlayer);3273	CvTeam &kTeam = GET_TEAM(kPlayer.getTeam());3274	PolicyBranchTypes eMyIdeology = m_pPlayer->GetPlayerPolicies()->GetLateGamePolicyTree();3275	PolicyBranchTypes eTheirIdeology = kPlayer.GetPlayerPolicies()->GetLateGamePolicyTree();32763277	// POSITIVE MODIFIERS32783279	// Open borders with this player3280	if (kTeam.IsAllowsOpenBordersToTeam(m_pPlayer->getTeam()))3281	{3282		szRtnValue += "[COLOR_POSITIVE_TEXT]" + GetLocalizedText("TXT_KEY_CO_PLAYER_TOURISM_OPEN_BORDERS", GetTourismModifierOpenBorders()) + "[ENDCOLOR]";3283	}32843285	// Trade route to one of this player's cities from here3286	if (GC.getGame().GetGameTrade()->IsPlayerConnectedToPlayer(m_pPlayer->GetID(), ePlayer))3287	{3288		szRtnValue += "[COLOR_POSITIVE_TEXT]" + GetLocalizedText("TXT_KEY_CO_PLAYER_TOURISM_TRADE_ROUTE", GetTourismModifierTradeRoute()) + "[ENDCOLOR]";3289	}32903291	ReligionTypes ePlayerReligion = m_pPlayer->GetReligions()->GetReligionInMostCities();3292	if (ePlayerReligion != NO_RELIGION && kPlayer.GetReligions()->HasReligionInMostCities(ePlayerReligion))3293	{3294		szRtnValue += "[COLOR_POSITIVE_TEXT]" + GetLocalizedText("TXT_KEY_CO_PLAYER_TOURISM_RELIGION_NOTE", GetTourismModifierSharedReligion()) + "[ENDCOLOR]";3295	}3296	if (eMyIdeology != NO_POLICY_BRANCH_TYPE && eTheirIdeology != NO_POLICY_BRANCH_TYPE && eMyIdeology != eTheirIdeology)3297	{3298		if (m_pPlayer->GetEspionage()->IsMyDiplomatVisitingThem(ePlayer))3299		{3300			szRtnValue += "[COLOR_POSITIVE_TEXT]" + GetLocalizedText("TXT_KEY_CO_PLAYER_TOURISM_PROPAGANDA", GC.getTOURISM_MODIFIER_DIPLOMAT()) + "[ENDCOLOR]";3301		}3302	}33033304	int iSharedIdeologyMod = m_pPlayer->GetPlayerPolicies()->GetNumericModifier(POLICYMOD_TOURISM_MOD_SHARED_IDEOLOGY);3305	if (iSharedIdeologyMod > 0)3306	{3307		if (eMyIdeology != NO_POLICY_BRANCH_TYPE && eTheirIdeology != NO_POLICY_BRANCH_TYPE && eMyIdeology == eTheirIdeology)3308		{3309			szRtnValue += "[COLOR_POSITIVE_TEXT]" + GetLocalizedText("TXT_KEY_CO_PLAYER_TOURISM_SHARED_IDEOLOGY", iSharedIdeologyMod) + "[ENDCOLOR]";3310		}3311	}33123313	int iCommonFoeMod = m_pPlayer->GetPlayerPolicies()->GetNumericModifier(POLICYMOD_TOURISM_MOD_COMMON_FOE);3314	if (iCommonFoeMod > 0)3315	{3316		PlayerTypes eLoopPlayer;3317		for(int iPlayerLoop = 0; iPlayerLoop < MAX_MAJOR_CIVS; iPlayerLoop++)3318		{3319			eLoopPlayer = (PlayerTypes) iPlayerLoop;33203321			if (eLoopPlayer != ePlayer && eLoopPlayer != m_pPlayer->GetID() && m_pPlayer->GetDiplomacyAI()->IsPlayerValid(eLoopPlayer))3322			{3323				// Are they at war with me too?3324				if (GET_TEAM(m_pPlayer->getTeam()).isAtWar(GET_PLAYER(eLoopPlayer).getTeam()) && GET_TEAM(kPlayer.getTeam()).isAtWar(GET_PLAYER(eLoopPlayer).getTeam()))3325				{3326					szRtnValue += "[COLOR_POSITIVE_TEXT]" + GetLocalizedText("TXT_KEY_CO_PLAYER_TOURISM_COMMON_FOE", iCommonFoeMod) + "[ENDCOLOR]";3327				}3328			}3329		}3330	}33313332	int iLessHappyMod = m_pPlayer->GetPlayerPolicies()->GetNumericModifier(POLICYMOD_TOURISM_MOD_LESS_HAPPY);3333	if (iLessHappyMod > 0)3334	{3335		if (m_pPlayer->GetExcessHappiness() > kPlayer.GetExcessHappiness())3336		{3337			szRtnValue += "[COLOR_POSITIVE_TEXT]" + GetLocalizedText("TXT_KEY_CO_PLAYER_TOURISM_LESS_HAPPY", iLessHappyMod) + "[ENDCOLOR]";3338		}3339	}33403341	if (m_pPlayer->isGoldenAge() && m_pPlayer->GetPlayerTraits()->GetGoldenAgeTourismModifier())3342	{3343		szRtnValue += "[COLOR_POSITIVE_TEXT]" + GetLocalizedText("TXT_KEY_CO_PLAYER_TOURISM_CARNIVAL", m_pPlayer->GetPlayerTraits()->GetGoldenAgeTourismModifier()) + "[ENDCOLOR]";3344	}33453346	// NEUTRAL MODIFIERS3347	if (!kTeam.IsAllowsOpenBordersToTeam(m_pPlayer->getTeam()))3348	{3349		szRtnValue += "[COLOR_GREY]" + GetLocalizedText("TXT_KEY_CO_PLAYER_TOURISM_OPEN_BORDERS", 0) + "[ENDCOLOR]";		3350	}3351	if (!GC.getGame().GetGameTrade()->IsPlayerConnectedToPlayer(m_pPlayer->GetID(), ePlayer))3352	{3353		szRtnValue += "[COLOR_GREY]" + GetLocalizedText("TXT_KEY_CO_PLAYER_TOURISM_TRADE_ROUTE", 0) + "[ENDCOLOR]";		3354	}3355	if (ePlayerReligion == NO_RELIGION || !kPlayer.GetReligions()->HasReligionInMostCities(ePlayerReligion))3356	{3357		szRtnValue += "[COLOR_GREY]" + GetLocalizedText("TXT_KEY_CO_PLAYER_TOURISM_RELIGION_NOTE", 0) + "[ENDCOLOR]";3358	}3359	if (eMyIdeology != NO_POLICY_BRANCH_TYPE && eTheirIdeology != NO_POLICY_BRANCH_TYPE && eMyIdeology != eTheirIdeology)3360	{3361		if (!m_pPlayer->GetEspionage()->IsMyDiplomatVisitingThem(ePlayer))3362		{3363			szRtnValue += "[COLOR_GREY]" + GetLocalizedText("TXT_KEY_CO_PLAYER_TOURISM_PROPAGANDA", 0) + "[ENDCOLOR]";3364		}3365	}33663367	// NEGATIVE MODIFIERS3368	if (eMyIdeology != NO_POLICY_BRANCH_TYPE && eTheirIdeology != NO_POLICY_BRANCH_TYPE && eMyIdeology != eTheirIdeology)3369	{3370		szRtnValue += "[COLOR_NEGATIVE_TEXT]" + GetLocalizedText("TXT_KEY_CO_PLAYER_TOURISM_DIFFERENT_IDEOLOGIES", GC.getTOURISM_MODIFIER_DIFFERENT_IDEOLOGIES()) + "[ENDCOLOR]";3371	}33723373	return szRtnValue;3374}

Calls

Called by