CvNotifications::Add(NotificationTypes, const char *, const char *, int, int, int, int)
- Defined in
- CvNotifications.cpp, line 404
- Class
- CvNotifications
- Hook name
CivHooks::CvNotifications_Add- Changed in
- 0.5.0
Hand-placed hooks inside
A replacement for this function that does not call original stops these hooks from running.
Hooks
static bool BeforeCvNotifications_Add(CvNotifications* self, NotificationTypes eNotificationType, const char* strMessage, const char* strSummary, int iX, int iY, int iGameDataIndex, int iExtraGameData, int& result);static void AfterCvNotifications_Add(CvNotifications* self, NotificationTypes eNotificationType, const char* strMessage, const char* strSummary, int iX, int iY, int iGameDataIndex, int iExtraGameData, int& result);static int ReplaceCvNotifications_Add(int (*original)(CvNotifications*, NotificationTypes, const char*, const char*, int, int, int, int), CvNotifications* self, NotificationTypes eNotificationType, const char* strMessage, const char* strSummary, int iX, int iY, int iGameDataIndex, int iExtraGameData);CivRegisterBefore<CivHooks::CvNotifications_Add>(host, &BeforeCvNotifications_Add);CivRegisterAfter<CivHooks::CvNotifications_Add>(host, &AfterCvNotifications_Add);CivRegisterReplace<CivHooks::CvNotifications_Add>(host, &ReplaceCvNotifications_Add);
Code
403/// Adds a new notification to the list404int CvNotifications::Add(NotificationTypes eNotificationType, const char* strMessage, const char* strSummary, int iX, int iY, int iGameDataIndex, int iExtraGameData)405{406 // if the player is not human, do not record407 if(!GET_PLAYER(m_ePlayer).isHuman())408 {409 return -1;410 }411412 // If we're in debug mode, don't do anything413 if(GC.getGame().isDebugMode())414 return -1;415416417 Notification newNotification;418 newNotification.Clear();419 newNotification.m_ePlayerID = m_ePlayer;420 newNotification.m_eNotificationType = eNotificationType;421 newNotification.m_strMessage = strMessage;422 newNotification.m_strSummary = strSummary;423 newNotification.m_iX = iX;424 newNotification.m_iY = iY;425 newNotification.m_iGameDataIndex = iGameDataIndex;426 newNotification.m_iExtraGameData = iExtraGameData;427 newNotification.m_iTurn = GC.getGame().getGameTurn();428 newNotification.m_iLookupIndex = m_iCurrentLookupIndex;429 newNotification.m_bNeedsBroadcast = true;430 newNotification.m_bDismissed = false;431 newNotification.m_bWaitExtraTurn = false;432433 // Is this notification being added during the player's auto-moves and will it expire at the end of the turn?434 // If so, set a flag so the notification will stick around for an extra turn.435 if (GET_PLAYER(m_ePlayer).isTurnActive() && GET_PLAYER(m_ePlayer).isAutoMoves() && IsNotificationTypeEndOfTurnExpired(eNotificationType))436 newNotification.m_bWaitExtraTurn = true;437438 if(IsNotificationRedundant(newNotification))439 {440 // redundant notification441 return -1;442 }443444 if(IsArrayFull())445 {446 RemoveOldestNotification();447 }448449 m_aNotifications[m_iNotificationsEndIndex] = newNotification;450451 if(GC.getGame().isFinalInitialized())452 {453 // 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 wait454 // 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.455 if(newNotification.m_ePlayerID == GC.getGame().getActivePlayer() && (!CvPreGame::isHotSeatGame() || GET_PLAYER(GC.getGame().getActivePlayer()).isTurnActive()))456 {457 GC.GetEngineUserInterface()->AddNotification(newNotification.m_iLookupIndex, newNotification.m_eNotificationType, newNotification.m_strMessage.c_str(), newNotification.m_strSummary.c_str(), newNotification.m_iGameDataIndex, newNotification.m_iExtraGameData, m_ePlayer, iX, iY);458459#if defined(MOD_UI_CITY_EXPANSION)460 // Don't show effect with production notification or city tile acquisition461 bool bShow = (eNotificationType != NOTIFICATION_PRODUCTION);462 463 if (MOD_UI_CITY_EXPANSION) {464 bShow = bShow && (eNotificationType != NOTIFICATION_CITY_TILE);465 }466 467 if(bShow)468#else469 // Don't show effect with production notification470 if(eNotificationType != NOTIFICATION_PRODUCTION)471#endif472 {473 CvPlot* pPlot = GC.getMap().plot(iX, iY);474 if(pPlot != NULL)475 {476 auto_ptr<ICvPlot1> pDllPlot(new CvDllPlot(pPlot));477 gDLL->GameplayDoFX(pDllPlot.get());478 }479 else480 {481 gDLL->GameplayDoFX(NULL);482 }483484485 }486 m_aNotifications[m_iNotificationsEndIndex].m_bNeedsBroadcast = false;487 }488489 gDLL->GameplayMinimapNotification(iX, iY, m_iCurrentLookupIndex+1); // The index is used to uniquely identify each flashing dot on the minimap. We're adding 1 since the selected unit is always 0. It ain't pretty, but it'll work490 }491492 IncrementEndIndex();493494 m_iCurrentLookupIndex++;495496#if defined(CIV_HOST_API)497 CivHandNotificationAdded(m_ePlayer, eNotificationType, strMessage, strSummary, iX, iY, iGameDataIndex, iExtraGameData,hand-placed hook: NotificationAdded498 newNotification.m_iLookupIndex);499#endif500 return newNotification.m_iLookupIndex;501}
Calls
CivHandNotificationAdded- CustomMods::isUI_CITY_EXPANSION()
- CvDllPlot::CvDllPlot(CvPlot *)
- CvGame::getActivePlayer() const
- CvGame::getGameTurn()
- CvGame::isDebugMode() const
- CvGame::isFinalInitialized() const
- CvGlobals::getDLLIFace()
- CvGlobals::GetEngineUserInterface()
- CvGlobals::getGame()
- CvGlobals::getMap()
- CvMap::plot(int, int) const
- CvNotifications::IncrementEndIndex()
- CvNotifications::IsArrayFull()
- CvNotifications::IsNotificationRedundant(Notification &)
- CvNotifications::IsNotificationTypeEndOfTurnExpired(NotificationTypes, int)
- CvNotifications::Notification::Clear()
CvNotifications::Notification::NotificationCvNotifications::Notification::operator=- CvNotifications::RemoveOldestNotification()
- CvPlayer::isAutoMoves() const
- CvPlayer::isHuman() const
- CvPlayer::isTurnActive() const
- CvPlayerAI::getPlayer(PlayerTypes)
- CvPreGame::isHotSeatGame()
CvString::operator=ICvEngineUtility1::GameplayDoFXICvEngineUtility1::GameplayMinimapNotificationICvUserInterface1::AddNotificationstd::auto_ptr::auto_ptrstd::auto_ptr::getstd::basic_string::c_strstd::vector::operator[]
Called by
116 functions in 25 files
- CvBeliefHelpers::ConvertBarbarianUnit(const CvUnit *, UnitHandle)
- CvCityBuildings::SetNumRealBuildingTimed(BuildingTypes, int, bool, PlayerTypes, int)
- CvCity::ChangeNumResourceLocal(ResourceTypes, int)
- CvCity::DoJONSCultureLevelIncrease()
- CvCity::DoNearbyEnemy()
- CvCity::DoPickResourceDemanded(bool)
- CvCity::DoTestResourceDemanded()
- CvCity::chooseProduction(UnitTypes, BuildingTypes, ProjectTypes, bool, bool)
- CvCity::doGrowth()
- CvCity::doTurn()
- CvCity::popOrder(int, bool, bool)
- CvCityCitizens::DoSpawnGreatPerson(UnitTypes, bool, bool, bool)
- CultureHelpers::SendArtSwapNotification(GreatWorkSlotType, bool, PlayerTypes, PlayerTypes, int, int)
- CvPlayerCulture::DoTurn()
- CvGameDeals::DoEndTradedItem(CvTradedItem *, PlayerTypes, bool)
- CvGameDeals::FinalizeDealNotify(PlayerTypes, PlayerTypes, CvWeightedVector<TeamTypes, ((63)), true> &)
- CvDiplomacyAI::DoCounters()
- CvDiplomacyAI::DoDenouncePlayer(PlayerTypes)
- CvDiplomacyAI::DoFirstContact(PlayerTypes)
- CvDiplomacyAI::DoMakePublicDeclaration(PublicDeclarationTypes, int, int, PlayerTypes, PlayerTypes)
- CvDiplomacyAI::DoTestPromises()
- CvDiplomacyAI::SetDoFAccepted(PlayerTypes, bool)
- CvDiplomacyRequests::BeginTurn()
- CvDllNetMessageHandler::ResponseEnhanceReligion(PlayerTypes, ReligionTypes, const char *, BeliefTypes, BeliefTypes, int, int)
- CvDllNetMessageHandler::ResponseFoundReligion(PlayerTypes, ReligionTypes, const char *, BeliefTypes, BeliefTypes, BeliefTypes, BeliefTypes, int, int)
- CvDllNetMessageHandler::ResponsePlayerDealFinalized(PlayerTypes, PlayerTypes, PlayerTypes, bool)
- CvDllPlayer::AddNotification(NotificationTypes, const char *, const char *, int, int, int, int)
- CvPlayerEspionage::AddIntrigueMessage(PlayerTypes, PlayerTypes, PlayerTypes, BuildingTypes, ProjectTypes, CvIntrigueType, uint, CvCity *, bool)
- CvPlayerEspionage::AttemptCoup(uint)
- CvPlayerEspionage::CreateSpy()
- CvPlayerEspionage::LevelUpSpy(uint)
- CvPlayerEspionage::ProcessSpy(uint)
- CvPlayerEspionage::ProcessSpyMessages()
- CvGame::DoPlaceTeamInVictoryCompetition(VictoryTypes, TeamTypes)
- CvGame::DoResearchAgreementNotification(TeamTypes, TeamTypes)
- CvGame::SetBestGreatPeoplePlayer(PlayerTypes, int)
- CvGame::SetBestPoliciesPlayer(PlayerTypes, int)
- CvGame::SetBestWondersPlayer(PlayerTypes, int)
- CvGame::setWinner(TeamTypes, VictoryTypes)
- CvMinorCivAI::AddBuyoutNotification(CvString, CvString, PlayerTypes, int, int)
- CvMinorCivAI::AddNotification(CvString, CvString, PlayerTypes, int, int)
- CvMinorCivAI::AddQuestNotification(CvString, CvString, PlayerTypes, int, int, bool)
- CvMinorCivAI::DoElection()
- CvMinorCivAI::DoLiberationByMajor(PlayerTypes, TeamTypes)
- CvNotifications::AddByName(const char *, const char *, const char *, int, int, int, int)
- CvNotifications::AddToPlayer(PlayerTypes, NotificationTypes, const char *, const char *, int, int, int, int)
- CvPlayer::AddNotification(NotificationTypes, const char *, const char *, CvPlot *, int, int)
- CvPlayer::ChangeNumFaithGreatPeople(int)
- CvPlayer::ChangeNumFreeGreatPeople(int)
- CvPlayer::ChangeNumFreePolicies(int)
- CvPlayer::ChangeNumFreeTenets(int, bool)
- CvPlayer::ChangeNumMayaBoosts(int)
- CvPlayer::DoAnnounceReligionAdoption()
- CvPlayer::DoCityRevolt()
- CvPlayer::DoDeficit()
- CvPlayer::DoLiberatePlayer(PlayerTypes, int)
- CvPlayer::DoResetCityRevoltCounter()
- CvPlayer::DoSpawnGreatPerson(PlayerTypes, bool)
- CvPlayer::DoTestOverResourceNotification(ResourceTypes)
- CvPlayer::DoUprising()
- CvPlayer::SetHasLostCapital(bool, PlayerTypes)
- CvPlayer::acquireCity(CvCity *, bool, bool, bool)
- CvPlayer::changeGoldenAgeTurns(int)
- CvPlayer::changeNumResourceTotal(ResourceTypes, int, bool)
- CvPlayer::chooseTech(int, const char *, TechTypes)
- CvPlayer::createGreatAdmiral(UnitTypes, int, int, bool)
- CvPlayer::createGreatGeneral(UnitTypes, int, int, bool)
- CvPlayer::disconnected()
- CvPlayer::doTurnPostDiplomacy()
- CvPlayer::processPolicies(PolicyTypes, int)
- CvPlayer::reconnected()
- CvPlayer::setAlive(bool, bool)
- CvPlayer::setDynamicTurnsSimultMode(bool)
- CvPlot::changeBuildProgress(BuildTypes, int, PlayerTypes)
- CvPlot::setRevealed(TeamTypes, bool, CvUnit *, bool, TeamTypes)
- CvPlayerPolicies::SetPolicyBranchUnlocked(PolicyBranchTypes, bool, bool)
- CvCityReligions::CityConvertsReligion(ReligionTypes, ReligionTypes, PlayerTypes)
- CvGameReligions::AddReformationBelief(PlayerTypes, ReligionTypes, BeliefTypes)
- CvGameReligions::DoPlayerTurn(CvPlayer &)
- CvGameReligions::EnhanceReligion(PlayerTypes, ReligionTypes, BeliefTypes, BeliefTypes, bool)
- CvGameReligions::FoundPantheon(PlayerTypes, BeliefTypes)
- CvGameReligions::FoundReligion(PlayerTypes, ReligionTypes, const char *, BeliefTypes, BeliefTypes, BeliefTypes, BeliefTypes, CvCity *)
- CvTeam::AddNotification(NotificationTypes, const char *, const char *, int, int, int, int)
- CvTeam::DoDeclareWar(PlayerTypes, bool, TeamTypes, bool, bool)
- CvTeam::DoMakePeace(PlayerTypes, bool, TeamTypes, bool, bool)
- CvTeam::DoNowAtWarOrPeace(TeamTypes, bool)
- CvTeam::DoTestSmallAwards()
- CvTeam::EvacuateDiplomatsAtTeam(TeamTypes)
- CvTeam::SetCurrentEra(EraTypes)
- CvTeam::changeProjectCount(ProjectTypes, int)
- CvTeam::processTech(TechTypes, int)
- CvTeam::setHasTech(TechTypes, bool, PlayerTypes, bool, bool)
- CvPlayerTrade::PlunderTradeRoute(int, CvUnit *)
- CvPlayerTraits::ConvertBarbarianCamp(CvUnit *, CvPlot *)
- CvPlayerTraits::ConvertBarbarianNavalUnit(CvUnit *, UnitHandle)
- CvUnit::DoAttrition()
- CvUnit::DoEnhanceReligion()
- CvUnit::DoFoundReligion()
- CvUnit::PerformCultureBomb(int)
- CvUnit::UnitPathTo(int, int, int, int, bool)
- CvUnit::createGreatWork()
- CvUnit::setPromotionReady(bool)
- CvUnit::setXY(int, int, bool, bool, bool, bool, bool)
- CvUnitCombat::Attack(CvUnit &, CvPlot &, ATTACK_OPTION)
- CvUnitCombat::ResolveAirSweep(const CvCombatInfo &, uint)
- CvUnitCombat::ResolveAirUnitVsCombat(const CvCombatInfo &, uint)
- CvUnitCombat::ResolveMeleeCombat(const CvCombatInfo &, uint)
- CvUnitCombat::ResolveRangedCityVsUnitCombat(const CvCombatInfo &, uint)
- CvUnitCombat::ResolveRangedUnitVsCombat(const CvCombatInfo &, uint)
- CvGameLeagues::DoPlayerTurn(CvPlayer &)
- CvLeague::NotifyProjectComplete(LeagueProjectTypes)
- CvLeague::NotifyProjectProgress(LeagueProjectTypes)
- CvLeague::NotifyProposalResult(CvEnactProposal *)
- CvLeague::NotifyProposalResult(CvRepealProposal *)
- CvLeague::NotifySessionSoon(int)
- CvLuaPlayer::lAddNotification(lua_State *)