CvLeague::NotifyProjectProgress(LeagueProjectTypes)
- Defined in
- CvVotingClasses.cpp, line 6075
- Class
- CvLeague
- Hook name
CivHooks::CvLeague_NotifyProjectProgress
Hooks
static bool BeforeCvLeague_NotifyProjectProgress(CvLeague* self, LeagueProjectTypes eProject);static void AfterCvLeague_NotifyProjectProgress(CvLeague* self, LeagueProjectTypes eProject);static void ReplaceCvLeague_NotifyProjectProgress(void (*original)(CvLeague*, LeagueProjectTypes), CvLeague* self, LeagueProjectTypes eProject);CivRegisterBefore<CivHooks::CvLeague_NotifyProjectProgress>(host, &BeforeCvLeague_NotifyProjectProgress);CivRegisterAfter<CivHooks::CvLeague_NotifyProjectProgress>(host, &AfterCvLeague_NotifyProjectProgress);CivRegisterReplace<CivHooks::CvLeague_NotifyProjectProgress>(host, &ReplaceCvLeague_NotifyProjectProgress);
Code
6075void CvLeague::NotifyProjectProgress(LeagueProjectTypes eProject)6076{6077 CvLeagueProjectEntry* pInfo = GC.getLeagueProjectInfo(eProject);6078 CvAssertMsg(pInfo, "Could not find League Project info when sending out a progress update. Please send Anton your save file and version.");6079 if (pInfo)6080 {6081 for (MemberList::iterator it = m_vMembers.begin(); it != m_vMembers.end(); ++it)6082 {6083 PlayerTypes eMember = it->ePlayer;6084 CvPlayer& kPlayer = GET_PLAYER(eMember);6085 if (kPlayer.isHuman())6086 {6087 if (kPlayer.isLocalPlayer() && !kPlayer.isObserver())6088 {6089 CvNotifications* pNotifications = kPlayer.GetNotifications();6090 if (pNotifications)6091 {6092 int iPercentCompleted = (int) (((float)GetProjectProgress(eProject) / (float)GetProjectCost(eProject)) * 100);6093 iPercentCompleted = MIN(100, iPercentCompleted);60946095 Localization::String sSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_LEAGUE_PROJECT_PROGRESS");6096 sSummary << pInfo->GetDescriptionKey();60976098 Localization::String sMessage = Localization::Lookup("TXT_KEY_NOTIFICATION_LEAGUE_PROJECT_PROGRESS_TT");6099 sMessage << pInfo->GetDescriptionKey() << iPercentCompleted;61006101 pNotifications->Add((NotificationTypes)FString::Hash("NOTIFICATION_LEAGUE_PROJECT_PROGRESS"), sMessage.toUTF8(), sSummary.toUTF8(), -1, -1, GetID(), eProject);6102 }6103 }6104 }6105 }6106 }6107}
Calls
BaseVector::beginBaseVector::end- CvBaseInfo::GetDescriptionKey() const
- CvGlobals::getLeagueProjectInfo(LeagueProjectTypes)
- CvLeague::GetID() const
- CvLeague::GetProjectCost(LeagueProjectTypes) const
- CvLeague::GetProjectProgress(LeagueProjectTypes)
- CvNotifications::Add(NotificationTypes, const char *, const char *, int, int, int, int)
- CvPlayer::GetNotifications() const
- CvPlayer::isHuman() const
- CvPlayer::isLocalPlayer() const
- CvPlayer::isObserver() const
- CvPlayerAI::getPlayer(PlayerTypes)
FStringA::HashLocalization::LookupLocalization::String::toUTF8operator<<operator<<std::min