CvLeague::GetName()
- Defined in
- CvVotingClasses.cpp, line 1927
- Class
- CvLeague
- Hook name
CivHooks::CvLeague_GetName
Hooks
static bool BeforeCvLeague_GetName(CvLeague* self, Localization::String& result);static void AfterCvLeague_GetName(CvLeague* self, Localization::String& result);static Localization::String ReplaceCvLeague_GetName(Localization::String (*original)(CvLeague*), CvLeague* self);CivRegisterBefore<CivHooks::CvLeague_GetName>(host, &BeforeCvLeague_GetName);CivRegisterAfter<CivHooks::CvLeague_GetName>(host, &AfterCvLeague_GetName);CivRegisterReplace<CivHooks::CvLeague_GetName>(host, &ReplaceCvLeague_GetName);
Code
1927Localization::String CvLeague::GetName()1928{1929 Localization::String sName = Localization::Lookup("TXT_KEY_LEAGUE_WORLD_CONGRESS_GENERIC");1930 if (m_szCustomName == NULL || strlen(m_szCustomName) == 0)1931 {1932 if (IsUnitedNations())1933 {1934 sName = Localization::Lookup("TXT_KEY_LEAGUE_UNITED_NATIONS");1935 }1936 else if (HasHostMember() && m_eAssignedName != NO_LEAGUE_NAME)1937 {1938 PlayerTypes eHost = GetHostMember();1939 CvCity* pCapital = GET_PLAYER(eHost).getCapitalCity();1940 CvLeagueNameEntry* pInfo = GC.getLeagueNameInfo(m_eAssignedName);1941 if (pCapital && pInfo)1942 {1943 CvString sOrdinalKey = "";1944 sOrdinalKey.Format("TXT_KEY_LEAGUE_ORDINAL_%d", GetConsecutiveHostedSessions() + 1);1945 Localization::String sOrdinal = Localization::Lookup(sOrdinalKey);19461947 sName = Localization::Lookup(pInfo->GetNameKey());1948 //antonjs: temp: Did our lookup return the same thing (ie. we don't have that text key)?1949 if (sOrdinalKey.compare(sOrdinal.toUTF8()) == 0)1950 {1951 sName << "" << pCapital->getNameKey();1952 }1953 else1954 {1955 sName << sOrdinal << pCapital->getNameKey();1956 }1957 }1958 }1959 }1960 // Custom name1961 else1962 {1963 return m_szCustomName;1964 }19651966 return sName;1967}
Calls
- CvCity::getNameKey() const
- CvGlobals::getLeagueNameInfo(LeagueNameTypes)
- CvLeague::GetConsecutiveHostedSessions() const
- CvLeague::GetHostMember() const
- CvLeague::HasHostMember() const
- CvLeague::IsUnitedNations() const
- CvLeagueNameEntry::GetNameKey() const
- CvPlayer::getCapitalCity()
- CvPlayerAI::getPlayer(PlayerTypes)
CvString::CvStringCvString::FormatCvString::operator const char *Localization::LookupLocalization::String::operator=Localization::String::StringLocalization::String::StringLocalization::String::toUTF8operator<<operator<<operator<<std::basic_string::comparestrlen
Called by
- CvDiplomacyAI::DoSendStatementToPlayer(PlayerTypes, DiploStatementTypes, int, CvDeal *)
- CvGameLeagues::DoPlayerTurn(CvPlayer &)
- CvLeague::GetLeagueSplashDescription(LeagueSpecialSessionTypes, bool)
- CvLeague::NotifyProposalResult(CvEnactProposal *)
- CvLeague::NotifySessionSoon(int)
- CvLuaLeague::lGetName(lua_State *)