Bazaar developer reference

CvDiplomacyAI::DoInitializePersonality()

Defined in
CvDiplomacyAI.cpp, line 1845
Class
CvDiplomacyAI
Hook name
CivHooks::CvDiplomacyAI_DoInitializePersonality

Hooks

static bool BeforeCvDiplomacyAI_DoInitializePersonality(CvDiplomacyAI* self);static void AfterCvDiplomacyAI_DoInitializePersonality(CvDiplomacyAI* self);static void ReplaceCvDiplomacyAI_DoInitializePersonality(void (*original)(CvDiplomacyAI*), CvDiplomacyAI* self);CivRegisterBefore<CivHooks::CvDiplomacyAI_DoInitializePersonality>(host, &BeforeCvDiplomacyAI_DoInitializePersonality);CivRegisterAfter<CivHooks::CvDiplomacyAI_DoInitializePersonality>(host, &AfterCvDiplomacyAI_DoInitializePersonality);CivRegisterReplace<CivHooks::CvDiplomacyAI_DoInitializePersonality>(host, &ReplaceCvDiplomacyAI_DoInitializePersonality);

Code

1844/// Initializes Personality Members for this player (XML value + random element)1845void CvDiplomacyAI::DoInitializePersonality()1846{1847	// AI Player1848	if(!GetPlayer()->isHuman())1849	{1850		CvLeaderHeadInfo& playerLeaderInfo = GetPlayer()->getLeaderInfo();18511852		m_iVictoryCompetitiveness = GetRandomPersonalityWeight(playerLeaderInfo.GetVictoryCompetitiveness());1853		CvAssertMsg(m_iVictoryCompetitiveness >= 0, "DIPLOMACY_AI: Victory Competitiveness Personality weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")18541855		m_iWonderCompetitiveness = GetRandomPersonalityWeight(playerLeaderInfo.GetWonderCompetitiveness());1856		CvAssertMsg(m_iWonderCompetitiveness >= 0, "DIPLOMACY_AI: Victory Competitiveness Personality weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")18571858		m_iMinorCivCompetitiveness = GetRandomPersonalityWeight(playerLeaderInfo.GetMinorCivCompetitiveness());1859		CvAssertMsg(m_iMinorCivCompetitiveness >= 0, "DIPLOMACY_AI: Minor Civ Competitiveness Personality weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")18601861		m_iBoldness = GetRandomPersonalityWeight(playerLeaderInfo.GetBoldness());1862		CvAssertMsg(m_iBoldness >= 0, "DIPLOMACY_AI: Boldness Personality weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")18631864		m_iDiploBalance = GetRandomPersonalityWeight(playerLeaderInfo.GetDiploBalance());1865		CvAssertMsg(m_iDiploBalance >= 0, "DIPLOMACY_AI: DiploBalance Personality weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")18661867		m_iWarmongerHate = GetRandomPersonalityWeight(playerLeaderInfo.GetWarmongerHate());1868		CvAssertMsg(m_iWarmongerHate >= 0, "DIPLOMACY_AI: WarmongerHate Personality weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")18691870		m_iDenounceWillingness = GetRandomPersonalityWeight(playerLeaderInfo.GetDenounceWillingness());1871		CvAssertMsg(m_iDenounceWillingness >= 0, "DIPLOMACY_AI: DenounceWillingness Personality weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")18721873		m_iDoFWillingness = GetRandomPersonalityWeight(playerLeaderInfo.GetDoFWillingness());1874		CvAssertMsg(m_iDoFWillingness >= 0, "DIPLOMACY_AI: DoFWillingness Personality weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")18751876		m_iLoyalty = GetRandomPersonalityWeight(playerLeaderInfo.GetLoyalty());1877		CvAssertMsg(m_iLoyalty >= 0, "DIPLOMACY_AI: Loyalty Personality weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")18781879		m_iNeediness = GetRandomPersonalityWeight(playerLeaderInfo.GetNeediness());1880		CvAssertMsg(m_iNeediness >= 0, "DIPLOMACY_AI: Neediness Personality weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")18811882		m_iForgiveness = GetRandomPersonalityWeight(playerLeaderInfo.GetForgiveness());1883		CvAssertMsg(m_iForgiveness >= 0, "DIPLOMACY_AI: Forgiveness Personality weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")18841885		m_iChattiness = GetRandomPersonalityWeight(playerLeaderInfo.GetChattiness());1886		CvAssertMsg(m_iChattiness >= 0, "DIPLOMACY_AI: Chattiness Personality weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")18871888		m_iMeanness = GetRandomPersonalityWeight(playerLeaderInfo.GetMeanness());1889		CvAssertMsg(m_iMeanness >= 0, "DIPLOMACY_AI: Meanness Personality weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")18901891		for(int iApproachLoop = 0; iApproachLoop < NUM_MAJOR_CIV_APPROACHES; iApproachLoop++)1892		{1893			m_paiPersonalityMajorCivApproachBiases[iApproachLoop] = GetRandomPersonalityWeight(playerLeaderInfo.GetMajorCivApproachBias(iApproachLoop));1894			CvAssertMsg(m_paiPersonalityMajorCivApproachBiases[iApproachLoop] >= 0, "DIPLOMACY_AI: Personality Approach weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")1895		}18961897		for(int iApproachLoop = 0; iApproachLoop < NUM_MINOR_CIV_APPROACHES; iApproachLoop++)1898		{1899			m_paiPersonalityMinorCivApproachBiases[iApproachLoop] = GetRandomPersonalityWeight(playerLeaderInfo.GetMinorCivApproachBias(iApproachLoop));1900			CvAssertMsg(m_paiPersonalityMinorCivApproachBiases[iApproachLoop] >= 0, "DIPLOMACY_AI: Personality Approach weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")1901		}1902	}1903	// Human player1904	else1905	{1906		int iDefaultFlavorValue = GC.getDEFAULT_FLAVOR_VALUE();19071908		m_iVictoryCompetitiveness = iDefaultFlavorValue;1909		CvAssertMsg(m_iVictoryCompetitiveness >= 0, "DIPLOMACY_AI: Victory Competitiveness Personality weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")19101911		m_iWonderCompetitiveness = iDefaultFlavorValue;1912		CvAssertMsg(m_iWonderCompetitiveness >= 0, "DIPLOMACY_AI: Wonder Competitiveness Personality weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")19131914		m_iMinorCivCompetitiveness = iDefaultFlavorValue;1915		CvAssertMsg(m_iMinorCivCompetitiveness >= 0, "DIPLOMACY_AI: Minor Civ Competitiveness Personality weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")19161917		m_iBoldness = iDefaultFlavorValue;1918		CvAssertMsg(m_iBoldness >= 0, "DIPLOMACY_AI: Boldness Personality weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")19191920		m_iDiploBalance = iDefaultFlavorValue;1921		CvAssertMsg(m_iDiploBalance >= 0, "DIPLOMACY_AI: DiploBalance Personality weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")19221923		m_iWarmongerHate = iDefaultFlavorValue;1924		CvAssertMsg(m_iWarmongerHate >= 0, "DIPLOMACY_AI: WarmongerHate Personality weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")19251926		m_iDenounceWillingness = iDefaultFlavorValue;1927		CvAssertMsg(m_iDenounceWillingness >= 0, "DIPLOMACY_AI: DenounceWillingness Personality weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")19281929		m_iDoFWillingness = iDefaultFlavorValue;1930		CvAssertMsg(m_iDoFWillingness >= 0, "DIPLOMACY_AI: DoFWillingness Personality weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")19311932		m_iLoyalty = iDefaultFlavorValue;1933		CvAssertMsg(m_iLoyalty >= 0, "DIPLOMACY_AI: Loyalty Personality weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")19341935		m_iNeediness = iDefaultFlavorValue;1936		CvAssertMsg(m_iNeediness >= 0, "DIPLOMACY_AI: Neediness Personality weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")19371938		m_iForgiveness = iDefaultFlavorValue;1939		CvAssertMsg(m_iForgiveness >= 0, "DIPLOMACY_AI: Forgiveness Personality weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")19401941		m_iChattiness = iDefaultFlavorValue;1942		CvAssertMsg(m_iChattiness >= 0, "DIPLOMACY_AI: Chattiness Personality weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")19431944		m_iMeanness = iDefaultFlavorValue;1945		CvAssertMsg(m_iMeanness >= 0, "DIPLOMACY_AI: Meanness Personality weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")19461947		for(int iApproachLoop = 0; iApproachLoop < NUM_MAJOR_CIV_APPROACHES; iApproachLoop++)1948		{1949			m_paiPersonalityMajorCivApproachBiases[iApproachLoop] = iDefaultFlavorValue;1950			CvAssertMsg(m_paiPersonalityMajorCivApproachBiases[iApproachLoop] >= 0, "DIPLOMACY_AI: Personality Approach weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")1951		}19521953		for(int iApproachLoop = 0; iApproachLoop < NUM_MINOR_CIV_APPROACHES; iApproachLoop++)1954		{1955			m_paiPersonalityMinorCivApproachBiases[iApproachLoop] = iDefaultFlavorValue;1956			CvAssertMsg(m_paiPersonalityMinorCivApproachBiases[iApproachLoop] >= 0, "DIPLOMACY_AI: Personality Approach weight is negative.  Please send Jon this with your last 5 autosaves and what changelist # you're playing.")1957		}1958	}19591960	LogPersonality();1961}

Calls

Called by