CvPlayer::DoResetCityRevoltCounter()
- Defined in
- CvPlayer.cpp, line 11834
- Class
- CvPlayer
- Hook name
CivHooks::CvPlayer_DoResetCityRevoltCounter
Hooks
static bool BeforeCvPlayer_DoResetCityRevoltCounter(CvPlayer* self);static void AfterCvPlayer_DoResetCityRevoltCounter(CvPlayer* self);static void ReplaceCvPlayer_DoResetCityRevoltCounter(void (*original)(CvPlayer*), CvPlayer* self);CivRegisterBefore<CivHooks::CvPlayer_DoResetCityRevoltCounter>(host, &BeforeCvPlayer_DoResetCityRevoltCounter);CivRegisterAfter<CivHooks::CvPlayer_DoResetCityRevoltCounter>(host, &AfterCvPlayer_DoResetCityRevoltCounter);CivRegisterReplace<CivHooks::CvPlayer_DoResetCityRevoltCounter>(host, &ReplaceCvPlayer_DoResetCityRevoltCounter);
Code
11833/// City revolt countdown - seed11834void CvPlayer::DoResetCityRevoltCounter()11835{11836 int iTurns = /*5*/ GC.getREVOLT_COUNTER_MIN();11837 CvGame& theGame = GC.getGame();1183811839 // Game speed mod11840 int iMod = theGame.getGameSpeedInfo().getTrainPercent();11841 // Only LENGTHEN time between rebels11842 if(iMod > 100)11843 {11844 iTurns *= iMod;11845 iTurns /= 100;11846 }1184711848 if(iTurns <= 0)11849 iTurns = 1;1185011851 CvCity *pMostUnhappyCity = GetMostUnhappyCity();11852 PlayerTypes eRecipient = GetMostUnhappyCityRecipient();11853 if(pMostUnhappyCity && eRecipient != NO_PLAYER)11854 {11855 SetCityRevoltCounter(iTurns);1185611857 CvNotifications* pNotifications = GetNotifications();11858 if(pNotifications && isHuman())11859 {11860 Localization::String strMessage = GetLocalizedText("TXT_KEY_NOTIFICATION_POSSIBLE_CITY_REVOLT", iTurns, pMostUnhappyCity->getName(), GET_PLAYER(eRecipient).getCivilizationShortDescription());11861 Localization::String strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_POSSIBLE_CITY_REVOLT_SUMMARY");11862 pNotifications->Add(NOTIFICATION_CITY_REVOLT_POSSIBLE, strMessage.toUTF8(), strSummary.toUTF8(), pMostUnhappyCity->getX(), pMostUnhappyCity->getY(), -1);11863 }11864 }11865}
Calls
- CvCity::getName() const
- CvCity::getX() const
- CvCity::getY() const
- CvGame::getGameSpeedInfo() const
- CvGameSpeedInfo::getTrainPercent() const
- CvGlobals::getGame()
- CvGlobals::getREVOLT_COUNTER_MIN()
- CvNotifications::Add(NotificationTypes, const char *, const char *, int, int, int, int)
- CvPlayer::getCivilizationShortDescription() const
- CvPlayer::GetMostUnhappyCity()
- CvPlayer::GetMostUnhappyCityRecipient()
- CvPlayer::GetNotifications() const
- CvPlayer::isHuman() const
- CvPlayer::SetCityRevoltCounter(int)
- CvPlayerAI::getPlayer(PlayerTypes)
GetLocalizedTextLocalization::LookupLocalization::String::toUTF8