Hooks
static bool BeforeCvTeam_SetHasResearchAgreement(CvTeam* self, TeamTypes eIndex, bool bNewValue);static void AfterCvTeam_SetHasResearchAgreement(CvTeam* self, TeamTypes eIndex, bool bNewValue);static void ReplaceCvTeam_SetHasResearchAgreement(void (*original)(CvTeam*, TeamTypes, bool), CvTeam* self, TeamTypes eIndex, bool bNewValue);CivRegisterBefore<CivHooks::CvTeam_SetHasResearchAgreement>(host, &BeforeCvTeam_SetHasResearchAgreement);CivRegisterAfter<CivHooks::CvTeam_SetHasResearchAgreement>(host, &AfterCvTeam_SetHasResearchAgreement);CivRegisterReplace<CivHooks::CvTeam_SetHasResearchAgreement>(host, &ReplaceCvTeam_SetHasResearchAgreement);
Code
4357void CvTeam::SetHasResearchAgreement(TeamTypes eIndex, bool bNewValue)4358{4359 CvAssertMsg(eIndex >= 0, "eIndex is expected to be non-negative (invalid Index)");4360 CvAssertMsg(eIndex < MAX_TEAMS, "eIndex is expected to be within maximum bounds (invalid Index)");43614362 if(IsHasResearchAgreement(eIndex) != bNewValue)4363 {4364 m_abResearchAgreement[eIndex] = bNewValue;43654366 if((GetID() == GC.getGame().getActiveTeam()) || (eIndex == GC.getGame().getActiveTeam()))4367 {4368 DLLUI->setDirty(Score_DIRTY_BIT, true);4369 }43704371 if(bNewValue && !GET_TEAM(eIndex).IsHasResearchAgreement(GetID()))4372 {4373 const char* strLeaderName = GET_PLAYER(getLeaderID()).getCivilizationShortDescriptionKey();4374 const char* strOtherLeaderName = GET_PLAYER(GET_TEAM(eIndex).getLeaderID()).getCivilizationShortDescriptionKey();43754376 CvString strBuffer = GetLocalizedText("TXT_KEY_NOTIFICATION_RESEARCH_AGREEMENT", strLeaderName, strOtherLeaderName);4377 GC.getGame().addReplayMessage(REPLAY_MESSAGE_MAJOR_EVENT, getLeaderID(), strBuffer, -1, -1);4378 }4379 }4380}