Bazaar developer reference

CvDiplomacyAI::GetInsultHumanMessage()

Defined in
CvDiplomacyAI.cpp, line 20007
Class
CvDiplomacyAI
Hook name
CivHooks::CvDiplomacyAI_GetInsultHumanMessage

Hooks

static bool BeforeCvDiplomacyAI_GetInsultHumanMessage(CvDiplomacyAI* self, const char*& result);static void AfterCvDiplomacyAI_GetInsultHumanMessage(CvDiplomacyAI* self, const char*& result);static const char* ReplaceCvDiplomacyAI_GetInsultHumanMessage(const char* (*original)(CvDiplomacyAI*), CvDiplomacyAI* self);CivRegisterBefore<CivHooks::CvDiplomacyAI_GetInsultHumanMessage>(host, &BeforeCvDiplomacyAI_GetInsultHumanMessage);CivRegisterAfter<CivHooks::CvDiplomacyAI_GetInsultHumanMessage>(host, &AfterCvDiplomacyAI_GetInsultHumanMessage);CivRegisterReplace<CivHooks::CvDiplomacyAI_GetInsultHumanMessage>(host, &ReplaceCvDiplomacyAI_GetInsultHumanMessage);

Code

20006/// AI is insulting the human20007const char* CvDiplomacyAI::GetInsultHumanMessage()20008{20009	PlayerTypes ePlayer = GC.getGame().getActivePlayer();20010	CvPlayerAI& kPlayer = GET_PLAYER(ePlayer);2001120012	StrengthTypes eMilitaryStrengthComparedToUs = GetPlayerMilitaryStrengthComparedToUs(ePlayer);2001320014	FStaticVector<DiploMessageTypes, NUM_DIPLO_MESSAGE_TYPES, true, c_eCiv5GameplayDLL, 0> veValidInsults;2001520016	// They're weak militarily20017	if(eMilitaryStrengthComparedToUs < STRENGTH_AVERAGE)20018		veValidInsults.push_back(DIPLO_MESSAGE_INSULT_MILITARY);2001920020	// We have nukes and they don't20021	if(kPlayer.getNumNukeUnits() == 0 && m_pPlayer->getNumNukeUnits() > 0)20022		veValidInsults.push_back(DIPLO_MESSAGE_INSULT_NUKE);2002320024	// They've attacked a lot of minor civs20025	else if(GetOtherPlayerNumMinorsAttacked(ePlayer) > 0)20026		veValidInsults.push_back(DIPLO_MESSAGE_INSULT_BULLY);2002720028	// Their empire is unhappy20029	else if(kPlayer.IsEmpireUnhappy())20030		veValidInsults.push_back(DIPLO_MESSAGE_INSULT_UNHAPPINESS);2003120032	// They have fewer Cities than us20033	else if(kPlayer.getNumCities() < m_pPlayer->getNumCities())20034		veValidInsults.push_back(DIPLO_MESSAGE_INSULT_CITIES);2003520036	// They have a low population20037	else if(kPlayer.getTotalPopulation() < m_pPlayer->getTotalPopulation())20038		veValidInsults.push_back(DIPLO_MESSAGE_INSULT_POPULATION);2003920040	// They have less Culture us20041	else if(kPlayer.GetJONSCultureEverGenerated() < m_pPlayer->GetJONSCultureEverGenerated())20042		veValidInsults.push_back(DIPLO_MESSAGE_INSULT_CULTURE);2004320044	// Pick a random insult from the valid ones20045	if(veValidInsults.size() > 0)20046	{20047		int iIndex = GC.getGame().getAsyncRandNum(veValidInsults.size(), "Picking random insult for AI to give to human.");2004820049		return GetDiploStringForMessage(veValidInsults[iIndex]);20050	}2005120052	// Needed to fall back on generic insult20053	return GetDiploStringForMessage(DIPLO_MESSAGE_INSULT_GENERIC);20054}

Calls

Called by