Bazaar developer reference

CvDiplomacyRequests::EndTurn()

Defined in
CvDiplomacyRequests.cpp, line 212
Class
CvDiplomacyRequests
Hook name
CivHooks::CvDiplomacyRequests_EndTurn

Hooks

static bool BeforeCvDiplomacyRequests_EndTurn(CvDiplomacyRequests* self);static void AfterCvDiplomacyRequests_EndTurn(CvDiplomacyRequests* self);static void ReplaceCvDiplomacyRequests_EndTurn(void (*original)(CvDiplomacyRequests*), CvDiplomacyRequests* self);CivRegisterBefore<CivHooks::CvDiplomacyRequests_EndTurn>(host, &BeforeCvDiplomacyRequests_EndTurn);CivRegisterAfter<CivHooks::CvDiplomacyRequests_EndTurn>(host, &AfterCvDiplomacyRequests_EndTurn);CivRegisterReplace<CivHooks::CvDiplomacyRequests_EndTurn>(host, &ReplaceCvDiplomacyRequests_EndTurn);

Code

211//	Called from within CvPlayer at the end of turn212void CvDiplomacyRequests::EndTurn(void)213{214#if defined(MOD_AI_MP_DIPLOMACY)215	if (MOD_AI_MP_DIPLOMACY) {216		// JdH => we remove all pending requests that are not from humans at the end of the turn217		GC.getGame().GetGameDeals()->DoCancelAllProposedDealsWithPlayer(m_ePlayer, DIPLO_AI_PLAYERS);218		RequestList::iterator iter = m_aRequests.begin();219		while (iter != m_aRequests.end())220		{221			if (CvPreGame::isHuman(iter->m_eFromPlayer))222				++iter;223			else224			{225				if (iter->m_iLookupIndex >= 0)226				{227					// we had a notification: Cancel it228					GET_PLAYER(m_ePlayer).GetNotifications()->Dismiss(iter->m_iLookupIndex, false);229				}230				iter = m_aRequests.erase(iter);231			}232		}233	} else234#endif235	m_eNextAIPlayer = NO_PLAYER;236}

Calls

Called by