Bazaar developer reference

isPotentialEnemy(const CvUnit *, TeamTypes, bool)

Defined in
CvPlot.cpp, line 3903
Hook name
CivHooks::CvPlot_cpp_isPotentialEnemy

Hooks

static bool BeforeCvPlot_cpp_isPotentialEnemy(const CvUnit* pUnit, TeamTypes eOtherTeam, bool bAlwaysHostile, bool& result);static void AfterCvPlot_cpp_isPotentialEnemy(const CvUnit* pUnit, TeamTypes eOtherTeam, bool bAlwaysHostile, bool& result);static bool ReplaceCvPlot_cpp_isPotentialEnemy(bool (*original)(const CvUnit*, TeamTypes, bool), const CvUnit* pUnit, TeamTypes eOtherTeam, bool bAlwaysHostile);CivRegisterBefore<CivHooks::CvPlot_cpp_isPotentialEnemy>(host, &BeforeCvPlot_cpp_isPotentialEnemy);CivRegisterAfter<CivHooks::CvPlot_cpp_isPotentialEnemy>(host, &AfterCvPlot_cpp_isPotentialEnemy);CivRegisterReplace<CivHooks::CvPlot_cpp_isPotentialEnemy>(host, &ReplaceCvPlot_cpp_isPotentialEnemy);

Code

3903inline static bool isPotentialEnemy(const CvUnit* pUnit, TeamTypes eOtherTeam, bool bAlwaysHostile)3904{3905	if(pUnit->canCoexistWithEnemyUnit(eOtherTeam))3906	{3907		return false;3908	}39093910	TeamTypes eOurTeam = GET_PLAYER(pUnit->getCombatOwner(eOtherTeam, *(pUnit->plot()))).getTeam();3911	return (bAlwaysHostile ? eOtherTeam != eOurTeam : isPotentialEnemy(eOtherTeam, eOurTeam));3912}

Calls

Called by