Bazaar developer reference

CvPlayer::DoTestOverResourceNotification(ResourceTypes)

Defined in
CvPlayer.cpp, line 20044
Class
CvPlayer
Hook name
CivHooks::CvPlayer_DoTestOverResourceNotification

Hooks

static bool BeforeCvPlayer_DoTestOverResourceNotification(CvPlayer* self, ResourceTypes eIndex);static void AfterCvPlayer_DoTestOverResourceNotification(CvPlayer* self, ResourceTypes eIndex);static void ReplaceCvPlayer_DoTestOverResourceNotification(void (*original)(CvPlayer*, ResourceTypes), CvPlayer* self, ResourceTypes eIndex);CivRegisterBefore<CivHooks::CvPlayer_DoTestOverResourceNotification>(host, &BeforeCvPlayer_DoTestOverResourceNotification);CivRegisterAfter<CivHooks::CvPlayer_DoTestOverResourceNotification>(host, &AfterCvPlayer_DoTestOverResourceNotification);CivRegisterReplace<CivHooks::CvPlayer_DoTestOverResourceNotification>(host, &ReplaceCvPlayer_DoTestOverResourceNotification);

Code

20043/// Are we over our resource limit? If so, give out a notification20044void CvPlayer::DoTestOverResourceNotification(ResourceTypes eIndex)20045{20046	if(getNumResourceAvailable(eIndex, true) < 0)20047	{20048		const CvResourceInfo* pkResourceInfo = GC.getResourceInfo(eIndex);20049		if(pkResourceInfo != NULL && pkResourceInfo->getResourceUsage() == RESOURCEUSAGE_STRATEGIC)20050		{20051			CvNotifications* pNotifications = GetNotifications();20052			if(pNotifications)20053			{20054				Localization::String strText = Localization::Lookup("TXT_KEY_NOTIFICATION_OVER_RESOURCE_LIMIT");20055				strText << pkResourceInfo->GetTextKey();20056				Localization::String strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_SUMMARY_OVER_RESOURCE_LIMIT");20057				strSummary << pkResourceInfo->GetTextKey();20058				pNotifications->Add(NOTIFICATION_DEMAND_RESOURCE, strText.toUTF8(), strSummary.toUTF8(), -1, -1, eIndex);20059			}20060		}20061	}20062}

Calls

Called by