Bazaar developer reference

CvTeam::countEnemyDangerByArea(CvArea *) const

Defined in
CvTeam.cpp, line 2408
Class
CvTeam
Hook name
CivHooks::CvTeam_countEnemyDangerByArea

Hooks

static bool BeforeCvTeam_countEnemyDangerByArea(const CvTeam* self, CvArea* pArea, int& result);static void AfterCvTeam_countEnemyDangerByArea(const CvTeam* self, CvArea* pArea, int& result);static int ReplaceCvTeam_countEnemyDangerByArea(int (*original)(const CvTeam*, CvArea*), const CvTeam* self, CvArea* pArea);CivRegisterBefore<CivHooks::CvTeam_countEnemyDangerByArea>(host, &BeforeCvTeam_countEnemyDangerByArea);CivRegisterAfter<CivHooks::CvTeam_countEnemyDangerByArea>(host, &AfterCvTeam_countEnemyDangerByArea);CivRegisterReplace<CivHooks::CvTeam_countEnemyDangerByArea>(host, &ReplaceCvTeam_countEnemyDangerByArea);

Code

2408int CvTeam::countEnemyDangerByArea(CvArea* pArea) const2409{2410	CvPlot* pLoopPlot;2411	int iCount;2412	int iI;24132414	iCount = 0;24152416	for(iI = 0; iI < GC.getMap().numPlots(); iI++)2417	{2418		pLoopPlot = GC.getMap().plotByIndexUnchecked(iI);24192420		if(pLoopPlot != NULL)2421		{2422			if(pLoopPlot->area() == pArea)2423			{2424				if(pLoopPlot->getTeam() == GetID())2425				{2426					iCount += pLoopPlot->plotCount(PUF_canDefendEnemy, getLeaderID(), false, NO_PLAYER, NO_TEAM, PUF_isVisible, getLeaderID());2427				}2428			}2429		}2430	}24312432	return iCount;2433}

Calls

Called by