Hooks
static bool BeforeCvTeam_SetHasDefensivePact(CvTeam* self, TeamTypes eIndex, bool bNewValue);static void AfterCvTeam_SetHasDefensivePact(CvTeam* self, TeamTypes eIndex, bool bNewValue);static void ReplaceCvTeam_SetHasDefensivePact(void (*original)(CvTeam*, TeamTypes, bool), CvTeam* self, TeamTypes eIndex, bool bNewValue);CivRegisterBefore<CivHooks::CvTeam_SetHasDefensivePact>(host, &BeforeCvTeam_SetHasDefensivePact);CivRegisterAfter<CivHooks::CvTeam_SetHasDefensivePact>(host, &AfterCvTeam_SetHasDefensivePact);CivRegisterReplace<CivHooks::CvTeam_SetHasDefensivePact>(host, &ReplaceCvTeam_SetHasDefensivePact);
Code
4303void CvTeam::SetHasDefensivePact(TeamTypes eIndex, bool bNewValue)4304{4305 CvAssertMsg(eIndex >= 0, "eIndex is expected to be non-negative (invalid Index)");4306 CvAssertMsg(eIndex < MAX_TEAMS, "eIndex is expected to be within maximum bounds (invalid Index)");43074308 if(IsHasDefensivePact(eIndex) != bNewValue)4309 {4310 m_abDefensivePact[eIndex] = bNewValue;43114312 if((GetID() == GC.getGame().getActiveTeam()) || (eIndex == GC.getGame().getActiveTeam()))4313 {4314 DLLUI->setDirty(Score_DIRTY_BIT, true);4315 }43164317 if(bNewValue && !GET_TEAM(eIndex).IsHasDefensivePact(GetID()))4318 {4319 CvString strBuffer = GetLocalizedText("TXT_KEY_MISC_PLAYERS_SIGN_DEFENSIVE_PACT", getName().GetCString(), GET_TEAM(eIndex).getName().GetCString());4320 GC.getGame().addReplayMessage(REPLAY_MESSAGE_MAJOR_EVENT, getLeaderID(), strBuffer, -1, -1);4321 }4322 }4323}