Bazaar developer reference

CvPlayer::createGreatAdmiral(UnitTypes, int, int, bool)

Defined in
CvPlayer.cpp, line 25942
Class
CvPlayer
Hook name
CivHooks::CvPlayer_createGreatAdmiral

Hooks

static bool BeforeCvPlayer_createGreatAdmiral(CvPlayer* self, UnitTypes eGreatPersonUnit, int iX, int iY, bool bIsFree);static void AfterCvPlayer_createGreatAdmiral(CvPlayer* self, UnitTypes eGreatPersonUnit, int iX, int iY, bool bIsFree);static void ReplaceCvPlayer_createGreatAdmiral(void (*original)(CvPlayer*, UnitTypes, int, int, bool), CvPlayer* self, UnitTypes eGreatPersonUnit, int iX, int iY, bool bIsFree);CivRegisterBefore<CivHooks::CvPlayer_createGreatAdmiral>(host, &BeforeCvPlayer_createGreatAdmiral);CivRegisterAfter<CivHooks::CvPlayer_createGreatAdmiral>(host, &AfterCvPlayer_createGreatAdmiral);CivRegisterReplace<CivHooks::CvPlayer_createGreatAdmiral>(host, &ReplaceCvPlayer_createGreatAdmiral);

Code

25941#if defined(MOD_GLOBAL_TRULY_FREE_GP)25942void CvPlayer::createGreatAdmiral(UnitTypes eGreatPersonUnit, int iX, int iY, bool bIsFree)25943#else25944void CvPlayer::createGreatAdmiral(UnitTypes eGreatPersonUnit, int iX, int iY)25945#endif25946{25947	CvUnit* pGreatPeopleUnit = initUnit(eGreatPersonUnit, iX, iY);25948	if(NULL == pGreatPeopleUnit)25949	{25950		CvAssert(false);25951		return;25952	}2595325954	ChangeNumGreatPeople(1);25955#if !defined(MOD_GLOBAL_LOCAL_GENERALS)25956	CvPlot *pSpawnPlot = GetGreatAdmiralSpawnPlot(pGreatPeopleUnit);25957	if (pGreatPeopleUnit->plot() != pSpawnPlot)25958	{25959		pGreatPeopleUnit->setXY(pSpawnPlot->getX(), pSpawnPlot->getY());25960	}25961#endif2596225963#if defined(MOD_GLOBAL_TRULY_FREE_GP)25964	incrementGreatAdmiralsCreated(bIsFree);25965#else25966	incrementGreatAdmiralsCreated();25967#endif25968#if defined(MOD_GLOBAL_TRULY_FREE_GP)25969	changeGreatAdmiralsThresholdModifier(/*50*/ GC.getGREAT_GENERALS_THRESHOLD_INCREASE() * ((getGreatAdmiralsCreated(bIsFree) / 10) + 1));25970#else25971	changeGreatAdmiralsThresholdModifier(/*50*/ GC.getGREAT_GENERALS_THRESHOLD_INCREASE() * ((getGreatAdmiralsCreated() / 10) + 1));25972#endif2597325974	for(int iI = 0; iI < MAX_PLAYERS; iI++)25975	{25976		if(GET_PLAYER((PlayerTypes)iI).getTeam() == getTeam())25977		{25978#if defined(MOD_BUGFIX_MINOR)25979#if defined(MOD_GLOBAL_TRULY_FREE_GP)25980			GET_PLAYER((PlayerTypes)iI).changeGreatAdmiralsThresholdModifier(/*50*/ GC.getGREAT_GENERALS_THRESHOLD_INCREASE_TEAM() * ((getGreatAdmiralsCreated(bIsFree) / 10) + 1));25981#else25982			GET_PLAYER((PlayerTypes)iI).changeGreatAdmiralsThresholdModifier(/*50*/ GC.getGREAT_GENERALS_THRESHOLD_INCREASE_TEAM() * ((getGreatAdmiralsCreated() / 10) + 1));25983#endif25984#else25985#if defined(MOD_GLOBAL_TRULY_FREE_GP)25986			GET_PLAYER((PlayerTypes)iI).changeGreatAdmiralsThresholdModifier(/*50*/ GC.getGREAT_GENERALS_THRESHOLD_INCREASE_TEAM() * ((getGreatPeopleCreated(bIsFree) / 10) + 1));25987#else25988			GET_PLAYER((PlayerTypes)iI).changeGreatAdmiralsThresholdModifier(/*50*/ GC.getGREAT_GENERALS_THRESHOLD_INCREASE_TEAM() * ((getGreatPeopleCreated() / 10) + 1));25989#endif25990#endif25991		}25992	}2599325994	CvPlot* pPlot = GC.getMap().plot(iX, iY);2599525996	// Notification25997	if(GetNotifications())25998	{25999		Localization::String strText = Localization::Lookup("TXT_KEY_NOTIFICATION_GREAT_PERSON_ACTIVE_PLAYER");26000		Localization::String strSummary = Localization::Lookup("TXT_KEY_NOTIFICATION_SUMMARY_GREAT_PERSON");26001		GetNotifications()->Add(NOTIFICATION_GREAT_PERSON_ACTIVE_PLAYER, strText.toUTF8(), strSummary.toUTF8(), pPlot->getX(), pPlot->getY(), eGreatPersonUnit);26002	}26003}

Calls

Called by