Bazaar developer reference

CvUnit::getName() const

Defined in
CvUnit.cpp, line 20024
Class
CvUnit
Hook name
CivHooks::CvUnit_getName

Hooks

static bool BeforeCvUnit_getName(const CvUnit* self, CvString& result);static void AfterCvUnit_getName(const CvUnit* self, CvString& result);static const CvString ReplaceCvUnit_getName(const CvString (*original)(const CvUnit*), const CvUnit* self);CivRegisterBefore<CivHooks::CvUnit_getName>(host, &BeforeCvUnit_getName);CivRegisterAfter<CivHooks::CvUnit_getName>(host, &AfterCvUnit_getName);CivRegisterReplace<CivHooks::CvUnit_getName>(host, &ReplaceCvUnit_getName);

Code

20024const CvString CvUnit::getName() const20025{20026	VALIDATE_OBJECT20027	CvString strBuffer;2002820029	if(m_strName.IsEmpty())20030	{20031#if defined(MOD_PROMOTIONS_UNIT_NAMING)20032		// For units, getUnitInfo().GetTextKey() (ie getNameKey()) and getUnitInfo().GetDescription() are the same20033		return GetLocalizedText(getNameKey());20034#else20035		return getUnitInfo().GetDescription();20036#endif20037	}2003820039	Localization::String name = Localization::Lookup(m_strName);20040#if defined(MOD_PROMOTIONS_UNIT_NAMING)20041		// For units, getUnitInfo().GetTextKey() (ie getNameKey()) and getUnitInfo().GetDescription() are the same20042	strBuffer.Format("%s (%s)", name.toUTF8(), GetLocalizedText(getNameKey()).c_str());20043#else20044	strBuffer.Format("%s (%s)", name.toUTF8(), getUnitInfo().GetDescription());20045#endif2004620047	return strBuffer;20048}

Calls

Called by

34 functions in 13 files