CvMinorCivAI::GetMajorBullyUnitDetails(PlayerTypes)
- Defined in
- CvMinorCivAI.cpp, line 9436
- Class
- CvMinorCivAI
- Hook name
CivHooks::CvMinorCivAI_GetMajorBullyUnitDetails
Hooks
static bool BeforeCvMinorCivAI_GetMajorBullyUnitDetails(CvMinorCivAI* self, PlayerTypes ePlayer, CvString& result);static void AfterCvMinorCivAI_GetMajorBullyUnitDetails(CvMinorCivAI* self, PlayerTypes ePlayer, CvString& result);static CvString ReplaceCvMinorCivAI_GetMajorBullyUnitDetails(CvString (*original)(CvMinorCivAI*, PlayerTypes), CvMinorCivAI* self, PlayerTypes ePlayer);CivRegisterBefore<CivHooks::CvMinorCivAI_GetMajorBullyUnitDetails>(host, &BeforeCvMinorCivAI_GetMajorBullyUnitDetails);CivRegisterAfter<CivHooks::CvMinorCivAI_GetMajorBullyUnitDetails>(host, &AfterCvMinorCivAI_GetMajorBullyUnitDetails);CivRegisterReplace<CivHooks::CvMinorCivAI_GetMajorBullyUnitDetails>(host, &ReplaceCvMinorCivAI_GetMajorBullyUnitDetails);
Code
9436CvString CvMinorCivAI::GetMajorBullyUnitDetails(PlayerTypes ePlayer)9437{9438 CvAssertMsg(ePlayer >= 0, "ePlayer is expected to be non-negative (invalid Index)");9439 CvAssertMsg(ePlayer < MAX_MAJOR_CIVS, "ePlayer is expected to be within maximum bounds (invalid Index)");9440 if(ePlayer < 0 || ePlayer >= MAX_MAJOR_CIVS) return "";94419442 CvString sFactors = "";9443 int iScore = CalculateBullyMetric(ePlayer, /*bForUnit*/true, &sFactors);9444 bool bCanBully = CanMajorBullyUnit(ePlayer, iScore);9445#if defined(MOD_BUGFIX_UNITCLASS_NOT_UNIT)9446 UnitTypes eUnitType = GET_PLAYER(ePlayer).GetSpecificUnitType("UNITCLASS_WORKER");9447#else9448 UnitTypes eUnitType = (UnitTypes) GC.getInfoTypeForString("UNIT_WORKER"); //antonjs: todo: XML/function9449#endif9450 CvUnitEntry* pUnitInfo = GC.getUnitInfo(eUnitType);9451 CvAssert(pUnitInfo);9452 if (!pUnitInfo)9453 return "";94549455 Localization::String sFear = Localization::Lookup("TXT_KEY_POP_CSTATE_BULLY_AFRAID");9456 if (!bCanBully)9457 {9458 sFear = Localization::Lookup("TXT_KEY_POP_CSTATE_BULLY_RESILIENT");9459 }9460 sFear << iScore;94619462 Localization::String sResult = Localization::Lookup("TXT_KEY_POP_CSTATE_BULLY_UNIT_TT");9463 sResult << sFear.toUTF8() << sFactors << pUnitInfo->GetDescriptionKey();94649465 return sResult.toUTF8();9466}
Calls
- CvBaseInfo::GetDescriptionKey() const
- CvGlobals::getUnitInfo(UnitTypes)
- CvMinorCivAI::CalculateBullyMetric(PlayerTypes, bool, CvString *)
- CvMinorCivAI::CanMajorBullyUnit(PlayerTypes, int)
- CvPlayer::GetSpecificUnitType(const char *, bool)
- CvPlayerAI::getPlayer(PlayerTypes)
CvString::CvStringLocalization::LookupLocalization::String::operator=Localization::String::toUTF8operator<<operator<<operator<<