CvGameDeals::DoCancelDealsBetweenTeams(TeamTypes, TeamTypes)
- Defined in
- CvDealClasses.cpp, line 3062
- Class
- CvGameDeals
- Hook name
CivHooks::CvGameDeals_DoCancelDealsBetweenTeams
Hooks
static bool BeforeCvGameDeals_DoCancelDealsBetweenTeams(CvGameDeals* self, TeamTypes eTeam1, TeamTypes eTeam2);static void AfterCvGameDeals_DoCancelDealsBetweenTeams(CvGameDeals* self, TeamTypes eTeam1, TeamTypes eTeam2);static void ReplaceCvGameDeals_DoCancelDealsBetweenTeams(void (*original)(CvGameDeals*, TeamTypes, TeamTypes), CvGameDeals* self, TeamTypes eTeam1, TeamTypes eTeam2);CivRegisterBefore<CivHooks::CvGameDeals_DoCancelDealsBetweenTeams>(host, &BeforeCvGameDeals_DoCancelDealsBetweenTeams);CivRegisterAfter<CivHooks::CvGameDeals_DoCancelDealsBetweenTeams>(host, &AfterCvGameDeals_DoCancelDealsBetweenTeams);CivRegisterReplace<CivHooks::CvGameDeals_DoCancelDealsBetweenTeams>(host, &ReplaceCvGameDeals_DoCancelDealsBetweenTeams);
Code
3061/// Deals between these two teams were interrupted (war or something)3062void CvGameDeals::DoCancelDealsBetweenTeams(TeamTypes eTeam1, TeamTypes eTeam2)3063{3064 if(m_CurrentDeals.size() > 0)3065 {3066 PlayerTypes eFromPlayer, eToPlayer;3067 int iPlayerLoop1, iPlayerLoop2;30683069 // Loop through first set of players3070 for(iPlayerLoop1 = 0; iPlayerLoop1 < MAX_MAJOR_CIVS; iPlayerLoop1++)3071 {3072 eFromPlayer = (PlayerTypes) iPlayerLoop1;30733074 if(!GET_PLAYER(eFromPlayer).isEverAlive())3075 {3076 continue;3077 }3078 if(GET_PLAYER(eFromPlayer).getTeam() != eTeam1)3079 {3080 continue;3081 }30823083 // Loop through second set of players3084 for(iPlayerLoop2 = 0; iPlayerLoop2 < MAX_MAJOR_CIVS; iPlayerLoop2++)3085 {3086 eToPlayer = (PlayerTypes) iPlayerLoop2;30873088 if(!GET_PLAYER(eToPlayer).isEverAlive())3089 {3090 continue;3091 }3092 if(GET_PLAYER(eToPlayer).getTeam() != eTeam2)3093 {3094 continue;3095 }30963097 DoCancelDealsBetweenPlayers(eFromPlayer, eToPlayer);3098 }3099 }3100 }3101}