Hooks
static bool BeforeCvGame_SetBestPoliciesPlayer(CvGame* self, PlayerTypes ePlayer, int iPolicyCount);static void AfterCvGame_SetBestPoliciesPlayer(CvGame* self, PlayerTypes ePlayer, int iPolicyCount);static void ReplaceCvGame_SetBestPoliciesPlayer(void (*original)(CvGame*, PlayerTypes, int), CvGame* self, PlayerTypes ePlayer, int iPolicyCount);CivRegisterBefore<CivHooks::CvGame_SetBestPoliciesPlayer>(host, &BeforeCvGame_SetBestPoliciesPlayer);CivRegisterAfter<CivHooks::CvGame_SetBestPoliciesPlayer>(host, &AfterCvGame_SetBestPoliciesPlayer);CivRegisterReplace<CivHooks::CvGame_SetBestPoliciesPlayer>(host, &ReplaceCvGame_SetBestPoliciesPlayer);
Code
10803/// Set Player leading with Policies10804void CvGame::SetBestPoliciesPlayer(PlayerTypes ePlayer, int iPolicyCount)10805{10806 int iVictoryPointChange = /*5*/ GC.getZERO_SUM_COMPETITION_POLICIES_VICTORY_POINTS();1080710808 // Remove VPs from old player's team10809 if(GetBestPoliciesPlayer() != NO_PLAYER)10810 {10811 GET_TEAM(GET_PLAYER(GetBestPoliciesPlayer()).getTeam()).changeVictoryPoints(-iVictoryPointChange);10812 }1081310814 m_eBestPoliciesPlayer = ePlayer;1081510816 if(ePlayer != NO_PLAYER)10817 {10818 CvString strBuffer;10819 CvString strSummary;1082010821 GET_TEAM(GET_PLAYER(ePlayer).getTeam()).changeVictoryPoints(iVictoryPointChange);1082210823 //Notify everyone10824 for(int iNotifyLoop = 0; iNotifyLoop < MAX_MAJOR_CIVS; ++iNotifyLoop){10825 PlayerTypes eNotifyPlayer = (PlayerTypes) iNotifyLoop;10826 CvPlayerAI& kCurNotifyPlayer = GET_PLAYER(eNotifyPlayer);10827 TeamTypes eCurNotifyTeam = kCurNotifyPlayer.getTeam();1082810829 // This player has the most Policies10830 if(eNotifyPlayer == ePlayer)10831 {10832 strBuffer = GetLocalizedText("TXT_KEY_NOTIFICATION_BEST_IN_POLICIES_YOU", iVictoryPointChange, iPolicyCount+1);10833 strSummary = GetLocalizedText("TXT_KEY_NOTIFICATION_SUMMARY_BEST_IN_POLICIES_YOU", iVictoryPointChange, iPolicyCount+1);10834 }10835 // Unmet player10836 else if(!GET_TEAM(eCurNotifyTeam).isHasMet(GET_PLAYER(ePlayer).getTeam()))10837 {10838 strBuffer = GetLocalizedText("TXT_KEY_NOTIFICATION_BEST_IN_POLICIES_UNMET", iVictoryPointChange, iPolicyCount+1);10839 strSummary = GetLocalizedText("TXT_KEY_NOTIFICATION_SUMMARY_BEST_IN_POLICIES_UNMET", iVictoryPointChange, iPolicyCount+1);10840 }10841 // player met10842 else10843 {10844 strBuffer = GetLocalizedText("TXT_KEY_NOTIFICATION_BEST_IN_POLICIES_ANOTHER", GET_PLAYER(ePlayer).getCivilizationShortDescriptionKey(), iVictoryPointChange, iPolicyCount+1);10845 strSummary = GetLocalizedText("TXT_KEY_NOTIFICATION_SUMMARY_BEST_IN_POLICIES_ANOTHER", GET_PLAYER(ePlayer).getCivilizationShortDescriptionKey(), iVictoryPointChange, iPolicyCount+1);10846 }1084710848 CvNotifications* pNotifications = kCurNotifyPlayer.GetNotifications();10849 if(pNotifications)10850 {10851 pNotifications->Add(NOTIFICATION_VICTORY, strBuffer, strSummary, -1, -1, -1);10852 }10853 }10854 }10855}