CvMinorCivAI::CalculateFriendshipFromQuests()
- Defined in
- CvMinorCivAI.cpp, line 3883
- Class
- CvMinorCivAI
- Hook name
CivHooks::CvMinorCivAI_CalculateFriendshipFromQuests
Hooks
static bool BeforeCvMinorCivAI_CalculateFriendshipFromQuests(CvMinorCivAI* self, WeightedCivsList& result);static void AfterCvMinorCivAI_CalculateFriendshipFromQuests(CvMinorCivAI* self, WeightedCivsList& result);static WeightedCivsList ReplaceCvMinorCivAI_CalculateFriendshipFromQuests(WeightedCivsList (*original)(CvMinorCivAI*), CvMinorCivAI* self);CivRegisterBefore<CivHooks::CvMinorCivAI_CalculateFriendshipFromQuests>(host, &BeforeCvMinorCivAI_CalculateFriendshipFromQuests);CivRegisterAfter<CivHooks::CvMinorCivAI_CalculateFriendshipFromQuests>(host, &AfterCvMinorCivAI_CalculateFriendshipFromQuests);CivRegisterReplace<CivHooks::CvMinorCivAI_CalculateFriendshipFromQuests>(host, &ReplaceCvMinorCivAI_CalculateFriendshipFromQuests);
Code
3882// Return a sorted weighted vector of player influence values accounting for quest rewards they are about to receive.3883WeightedCivsList CvMinorCivAI::CalculateFriendshipFromQuests()3884{3885 WeightedCivsList vePlayerInfluences;3886 for (int iMajorLoop = 0; iMajorLoop < MAX_MAJOR_CIVS; iMajorLoop++)3887 {3888 PlayerTypes eMajorLoop = (PlayerTypes) iMajorLoop;3889 int iInfTimes100 = GetEffectiveFriendshipWithMajorTimes100(eMajorLoop);3890 if (IsHasMetPlayer(eMajorLoop) && !IsAtWarWithPlayersTeam(eMajorLoop))3891 {3892 QuestListForPlayer::iterator itr_quest;3893 for (itr_quest = m_QuestsGiven[eMajorLoop].begin(); itr_quest != m_QuestsGiven[eMajorLoop].end(); itr_quest++)3894 {3895 if (itr_quest->IsComplete())3896 {3897 iInfTimes100 += (itr_quest->GetInfluenceReward() * 100);3898 }3899 }3900 }3901 int iWeight = iInfTimes100 + abs(GC.getMINOR_FRIENDSHIP_AT_WAR() * 100); // Weights cannot be negative, so shift all values up by minimum influence amount3902 vePlayerInfluences.push_back(eMajorLoop, iWeight);3903 }39043905 vePlayerInfluences.SortItems();3906 return vePlayerInfluences;3907}
Calls
absBaseVector::beginBaseVector::endBaseVector::operator[]- CvGlobals::getMINOR_FRIENDSHIP_AT_WAR()
- CvMinorCivAI::GetEffectiveFriendshipWithMajorTimes100(PlayerTypes)
- CvMinorCivAI::IsAtWarWithPlayersTeam(PlayerTypes)
- CvMinorCivAI::IsHasMetPlayer(PlayerTypes)
- CvMinorCivQuest::GetInfluenceReward() const
- CvMinorCivQuest::IsComplete()
CvWeightedVector::CvWeightedVectorCvWeightedVector::CvWeightedVectorCvWeightedVector::push_backCvWeightedVector::SortItems