Bazaar developer reference

CvNotifications::Update()

Defined in
CvNotifications.cpp, line 320
Class
CvNotifications
Hook name
CivHooks::CvNotifications_Update

Hooks

static bool BeforeCvNotifications_Update(CvNotifications* self);static void AfterCvNotifications_Update(CvNotifications* self);static void ReplaceCvNotifications_Update(void (*original)(CvNotifications*), CvNotifications* self);CivRegisterBefore<CivHooks::CvNotifications_Update>(host, &BeforeCvNotifications_Update);CivRegisterAfter<CivHooks::CvNotifications_Update>(host, &AfterCvNotifications_Update);CivRegisterReplace<CivHooks::CvNotifications_Update>(host, &ReplaceCvNotifications_Update);

Code

319/// Update - called from within CvPlayer320void CvNotifications::Update(void)321{322	int iIndex = m_iNotificationsBeginIndex;323	while(iIndex != m_iNotificationsEndIndex)324	{325		Notification& kNotification = m_aNotifications[iIndex];326327		if(!kNotification.m_bDismissed)328		{329			if(IsNotificationExpired(iIndex))330			{331				Dismiss(kNotification.m_iLookupIndex, /*bUserInvoked*/ false);332				//GC.GetEngineUserInterface()->RemoveNotification(kNotification.m_iLookupIndex);333				//kNotification.m_bDismissed = true;334			}335			else336			{337				if(kNotification.m_bNeedsBroadcast)338				{339					// If the notification is for the 'active' player and that active player actually has his turn active or its not hotseat, then show the notification, else wait.340					// The 'active' player is only set to a human and during the AI turn, the 'active' player is the last human to do their turn.341					if(kNotification.m_ePlayerID == GC.getGame().getActivePlayer())342					{343						if(!CvPreGame::isHotSeatGame() || GET_PLAYER(GC.getGame().getActivePlayer()).isTurnActive())344						{345							GC.GetEngineUserInterface()->AddNotification(kNotification.m_iLookupIndex, kNotification.m_eNotificationType, kNotification.m_strMessage.c_str(), kNotification.m_strSummary.c_str(), kNotification.m_iGameDataIndex, kNotification.m_iExtraGameData, m_ePlayer, kNotification.m_iX, kNotification.m_iY);346							kNotification.m_bNeedsBroadcast = false;347						}348					}349					else if(gDLL->IsPlayerConnected(kNotification.m_ePlayerID))350					{//We consider a notification to have been broadcast if the notification 351						//is for a remote player who is network connected to the game.352						kNotification.m_bNeedsBroadcast = false;353					}354				}355			}356		}357358		iIndex++;359360		if(iIndex >= (int)m_aNotifications.size())361		{362			iIndex = 0;363		}364	}365}

Calls

Called by