Bazaar developer reference

CvNotifications::GetEndTurnBlockedType(EndTurnBlockingTypes &, int &)

Defined in
CvNotifications.cpp, line 651
Class
CvNotifications
Hook name
CivHooks::CvNotifications_GetEndTurnBlockedType

Hooks

static bool BeforeCvNotifications_GetEndTurnBlockedType(CvNotifications* self, EndTurnBlockingTypes& eBlockingType, int& iNotificationIndex, bool& result);static void AfterCvNotifications_GetEndTurnBlockedType(CvNotifications* self, EndTurnBlockingTypes& eBlockingType, int& iNotificationIndex, bool& result);static bool ReplaceCvNotifications_GetEndTurnBlockedType(bool (*original)(CvNotifications*, EndTurnBlockingTypes&, int&), CvNotifications* self, EndTurnBlockingTypes& eBlockingType, int& iNotificationIndex);CivRegisterBefore<CivHooks::CvNotifications_GetEndTurnBlockedType>(host, &BeforeCvNotifications_GetEndTurnBlockedType);CivRegisterAfter<CivHooks::CvNotifications_GetEndTurnBlockedType>(host, &AfterCvNotifications_GetEndTurnBlockedType);CivRegisterReplace<CivHooks::CvNotifications_GetEndTurnBlockedType>(host, &ReplaceCvNotifications_GetEndTurnBlockedType);

Code

651bool CvNotifications::GetEndTurnBlockedType(EndTurnBlockingTypes& eBlockingType, int& iNotificationIndex)652{653	eBlockingType = NO_ENDTURN_BLOCKING_TYPE;654	iNotificationIndex = -1;655656	int iIndex = m_iNotificationsBeginIndex;657	while(iIndex != m_iNotificationsEndIndex)658	{659		if(!m_aNotifications[iIndex].m_bDismissed)660		{661			switch(m_aNotifications[iIndex].m_eNotificationType)662			{663			case NOTIFICATION_CITY_RANGE_ATTACK:664			{665				bool automaticallyEndTurns = GC.getGame().isGameMultiPlayer() ? GC.GetEngineUserInterface()->IsMPAutoEndTurnEnabled() : GC.GetEngineUserInterface()->IsSPAutoEndTurnEnabled();666				if(automaticallyEndTurns)667				{//City range attacks only block turns if the player is using auto end turn.668					eBlockingType = ENDTURN_BLOCKING_CITY_RANGE_ATTACK;669					iNotificationIndex = m_aNotifications[iIndex].m_iLookupIndex;670					return true;671				}672				break;673			}674675			case NOTIFICATION_DIPLO_VOTE:676				eBlockingType = ENDTURN_BLOCKING_DIPLO_VOTE;677				iNotificationIndex = m_aNotifications[iIndex].m_iLookupIndex;678				return true;679				break;680681			case NOTIFICATION_PRODUCTION:682				eBlockingType = ENDTURN_BLOCKING_PRODUCTION;683				iNotificationIndex = m_aNotifications[iIndex].m_iLookupIndex;684				return true;685				break;686687#if defined(MOD_UI_CITY_EXPANSION)688			case NOTIFICATION_CITY_TILE:689				if (MOD_UI_CITY_EXPANSION) {690					eBlockingType = ENDTURN_BLOCKING_CITY_TILE;691					iNotificationIndex = m_aNotifications[iIndex].m_iLookupIndex;692					return true;693				}694				break;695#endif696697			case NOTIFICATION_POLICY:698				eBlockingType = ENDTURN_BLOCKING_POLICY;699				iNotificationIndex = m_aNotifications[iIndex].m_iLookupIndex;700				return true;701				break;702703			case NOTIFICATION_FREE_POLICY:704				eBlockingType = ENDTURN_BLOCKING_FREE_POLICY;705				iNotificationIndex = m_aNotifications[iIndex].m_iLookupIndex;706				return true;707				break;708709			case NOTIFICATION_TECH:710				eBlockingType = ENDTURN_BLOCKING_RESEARCH;711				iNotificationIndex = m_aNotifications[iIndex].m_iLookupIndex;712				return true;713				break;714715			case NOTIFICATION_FREE_TECH:716				eBlockingType = ENDTURN_BLOCKING_FREE_TECH;717				iNotificationIndex = m_aNotifications[iIndex].m_iLookupIndex;718				return true;719				break;720721			case NOTIFICATION_FREE_GREAT_PERSON:722				eBlockingType = ENDTURN_BLOCKING_FREE_ITEMS;723				iNotificationIndex = m_aNotifications[iIndex].m_iLookupIndex;724				return true;725				break;726727			case NOTIFICATION_FOUND_PANTHEON:728				eBlockingType = ENDTURN_BLOCKING_FOUND_PANTHEON;729				iNotificationIndex = m_aNotifications[iIndex].m_iLookupIndex;730				return true;731				break;732733			case NOTIFICATION_FOUND_RELIGION:734				eBlockingType = ENDTURN_BLOCKING_FOUND_RELIGION;735				iNotificationIndex = m_aNotifications[iIndex].m_iLookupIndex;736				return true;737				break;738739			case NOTIFICATION_ENHANCE_RELIGION:740				eBlockingType = ENDTURN_BLOCKING_ENHANCE_RELIGION;741				iNotificationIndex = m_aNotifications[iIndex].m_iLookupIndex;742				return true;743				break;744745			case NOTIFICATION_SPY_STOLE_TECH:746				eBlockingType = ENDTURN_BLOCKING_STEAL_TECH;747				iNotificationIndex = m_aNotifications[iIndex].m_iLookupIndex;748				return true;749				break;750751			case NOTIFICATION_MAYA_LONG_COUNT:752				eBlockingType = ENDTURN_BLOCKING_MAYA_LONG_COUNT;753				iNotificationIndex = m_aNotifications[iIndex].m_iLookupIndex;754				return true;755				break;756757			case NOTIFICATION_FAITH_GREAT_PERSON:758				eBlockingType = ENDTURN_BLOCKING_FAITH_GREAT_PERSON;759				iNotificationIndex = m_aNotifications[iIndex].m_iLookupIndex;760				return true;761				break;762763			case NOTIFICATION_ADD_REFORMATION_BELIEF:764				eBlockingType = ENDTURN_BLOCKING_ADD_REFORMATION_BELIEF;765				iNotificationIndex = m_aNotifications[iIndex].m_iLookupIndex;766				return true;767				break;768769			case NOTIFICATION_LEAGUE_CALL_FOR_PROPOSALS:770				eBlockingType = ENDTURN_BLOCKING_LEAGUE_CALL_FOR_PROPOSALS;771				iNotificationIndex = m_aNotifications[iIndex].m_iLookupIndex;772				return true;773				break;774775			case NOTIFICATION_CHOOSE_ARCHAEOLOGY:776				eBlockingType = ENDTURN_BLOCKING_CHOOSE_ARCHAEOLOGY;777				iNotificationIndex = m_aNotifications[iIndex].m_iLookupIndex;778				return true;779				break;780781			case NOTIFICATION_LEAGUE_CALL_FOR_VOTES:782				eBlockingType = ENDTURN_BLOCKING_LEAGUE_CALL_FOR_VOTES;783				iNotificationIndex = m_aNotifications[iIndex].m_iLookupIndex;784				return true;785				break;786787			case NOTIFICATION_CHOOSE_IDEOLOGY:788				eBlockingType = ENDTURN_BLOCKING_CHOOSE_IDEOLOGY;789				iNotificationIndex = m_aNotifications[iIndex].m_iLookupIndex;790				return true;791				break;792793			default:794				// these notifications don't block, so don't return a blocking type795				break;796			}797		}798799		iIndex++;800		if(iIndex >= (int)m_aNotifications.size())801		{802			iIndex = 0;803		}804	}805806	return false;807}

Calls

Called by