Bazaar developer reference

CvDangerPlots::ShouldIgnoreUnit(CvUnit *, bool)

Defined in
CvDangerPlots.cpp, line 530
Class
CvDangerPlots
Hook name
CivHooks::CvDangerPlots_ShouldIgnoreUnit

Hooks

static bool BeforeCvDangerPlots_ShouldIgnoreUnit(CvDangerPlots* self, CvUnit* pUnit, bool bIgnoreVisibility, bool& result);static void AfterCvDangerPlots_ShouldIgnoreUnit(CvDangerPlots* self, CvUnit* pUnit, bool bIgnoreVisibility, bool& result);static bool ReplaceCvDangerPlots_ShouldIgnoreUnit(bool (*original)(CvDangerPlots*, CvUnit*, bool), CvDangerPlots* self, CvUnit* pUnit, bool bIgnoreVisibility);CivRegisterBefore<CivHooks::CvDangerPlots_ShouldIgnoreUnit>(host, &BeforeCvDangerPlots_ShouldIgnoreUnit);CivRegisterAfter<CivHooks::CvDangerPlots_ShouldIgnoreUnit>(host, &AfterCvDangerPlots_ShouldIgnoreUnit);CivRegisterReplace<CivHooks::CvDangerPlots_ShouldIgnoreUnit>(host, &ReplaceCvDangerPlots_ShouldIgnoreUnit);

Code

529/// Should this unit be ignored when creating the danger plots?530bool CvDangerPlots::ShouldIgnoreUnit(CvUnit* pUnit, bool bIgnoreVisibility)531{532	if(!pUnit->IsCanAttack())533	{534		return true;535	}536537	if(!pUnit->plot()->isVisible(GET_PLAYER(m_ePlayer).getTeam()))538	{539		return true;540	}541542	if(pUnit->isInvisible(GET_PLAYER(m_ePlayer).getTeam(), false))543	{544		return true;545	}546547	CvPlot* pPlot = pUnit->plot();548	CvAssertMsg(pPlot, "Plot is null?")549550	if(NULL != pPlot && !pPlot->isVisibleOtherUnit(m_ePlayer) && !bIgnoreVisibility)551	{552		return true;553	}554555	// fix post-gold!556	if(pUnit->getDomainType() == DOMAIN_AIR)557	{558		return true;559	}560561	return false;562}

Calls

Called by