Hooks
static bool BeforeCvPlayer_chooseTech(CvPlayer* self, int iDiscover, const char* strText, TechTypes iTechJustDiscovered);static void AfterCvPlayer_chooseTech(CvPlayer* self, int iDiscover, const char* strText, TechTypes iTechJustDiscovered);static void ReplaceCvPlayer_chooseTech(void (*original)(CvPlayer*, int, const char*, TechTypes), CvPlayer* self, int iDiscover, const char* strText, TechTypes iTechJustDiscovered);CivRegisterBefore<CivHooks::CvPlayer_chooseTech>(host, &BeforeCvPlayer_chooseTech);CivRegisterAfter<CivHooks::CvPlayer_chooseTech>(host, &AfterCvPlayer_chooseTech);CivRegisterReplace<CivHooks::CvPlayer_chooseTech>(host, &ReplaceCvPlayer_chooseTech);
Code
5451void CvPlayer::chooseTech(int iDiscover, const char* strText, TechTypes iTechJustDiscovered)5452{5453 if(GC.getGame().isOption(GAMEOPTION_NO_SCIENCE))5454 {5455 return;5456 }54575458 if(iDiscover > 0)5459 {5460 SetNumFreeTechs(GetNumFreeTechs()+iDiscover);5461 }54625463 if(iDiscover > 0)5464 {5465 CvNotifications* pNotifications = GetNotifications();5466 if(pNotifications)5467 {5468 pNotifications->Add(NOTIFICATION_FREE_TECH, strText, strText, -1, -1, iDiscover, iTechJustDiscovered);5469 }5470 }5471 else if(strText == 0 || strText[0] == 0)5472 {5473 CvString strBuffer = GetLocalizedText("TXT_KEY_NOTIFICATION_NEW_RESEARCH");5474 CvString strSummary = GetLocalizedText("TXT_KEY_NOTIFICATION_SUMMARY_NEW_RESEARCH");5475 CvNotifications* pNotifications = GetNotifications();5476 if(pNotifications)5477 {5478 pNotifications->Add(NOTIFICATION_TECH, strBuffer, strSummary, -1, -1, iDiscover, iTechJustDiscovered);5479 }5480 }5481 else5482 {5483 CvNotifications* pNotifications = GetNotifications();5484 if(pNotifications)5485 {5486 pNotifications->Add(NOTIFICATION_TECH, strText, strText, -1, -1, iDiscover, iTechJustDiscovered);5487 }5488 }5489}