Bazaar developer reference

CvPlot::waterArea() const

Defined in
CvPlot.cpp, line 4592
Class
CvPlot
Hook name
CivHooks::CvPlot_waterArea

Hooks

static bool BeforeCvPlot_waterArea(const CvPlot* self, CvArea*& result);static void AfterCvPlot_waterArea(const CvPlot* self, CvArea*& result);static CvArea* ReplaceCvPlot_waterArea(CvArea* (*original)(const CvPlot*), const CvPlot* self);CivRegisterBefore<CivHooks::CvPlot_waterArea>(host, &BeforeCvPlot_waterArea);CivRegisterAfter<CivHooks::CvPlot_waterArea>(host, &AfterCvPlot_waterArea);CivRegisterReplace<CivHooks::CvPlot_waterArea>(host, &ReplaceCvPlot_waterArea);

Code

4592CvArea* CvPlot::waterArea() const4593{4594	CvArea* pBestArea;4595	CvPlot* pAdjacentPlot;4596	int iValue;4597	int iBestValue;4598	int iI;45994600	if(isWater())4601	{4602		return area();4603	}46044605	iBestValue = 0;4606	pBestArea = NULL;46074608	for(iI = 0; iI < NUM_DIRECTION_TYPES; ++iI)4609	{4610		pAdjacentPlot = plotDirection(getX(), getY(), ((DirectionTypes)iI));46114612		if(pAdjacentPlot != NULL)4613		{4614			if(pAdjacentPlot->isWater())4615			{4616				iValue = pAdjacentPlot->area()->getNumTiles();46174618				if(iValue > iBestValue)4619				{4620					iBestValue = iValue;4621					pBestArea = pAdjacentPlot->area();4622				}4623			}4624		}4625	}46264627	return pBestArea;4628}

Calls

Called by