Bazaar developer reference

CvPlot::secondWaterArea() const

Defined in
CvPlot.cpp, line 4631
Class
CvPlot
Hook name
CivHooks::CvPlot_secondWaterArea

Hooks

static bool BeforeCvPlot_secondWaterArea(const CvPlot* self, CvArea*& result);static void AfterCvPlot_secondWaterArea(const CvPlot* self, CvArea*& result);static CvArea* ReplaceCvPlot_secondWaterArea(CvArea* (*original)(const CvPlot*), const CvPlot* self);CivRegisterBefore<CivHooks::CvPlot_secondWaterArea>(host, &BeforeCvPlot_secondWaterArea);CivRegisterAfter<CivHooks::CvPlot_secondWaterArea>(host, &AfterCvPlot_secondWaterArea);CivRegisterReplace<CivHooks::CvPlot_secondWaterArea>(host, &ReplaceCvPlot_secondWaterArea);

Code

4631CvArea* CvPlot::secondWaterArea() const4632{46334634	CvArea* pWaterArea = waterArea();4635	CvArea* pBestArea;4636	CvPlot* pAdjacentPlot;4637	int iValue;4638	int iBestValue;4639	int iI;46404641	CvAssert(!isWater());46424643	iBestValue = 0;4644	pBestArea = NULL;46454646	for(iI = 0; iI < NUM_DIRECTION_TYPES; ++iI)4647	{4648		pAdjacentPlot = plotDirection(getX(), getY(), ((DirectionTypes)iI));46494650		if(pAdjacentPlot != NULL)4651		{4652			if(pAdjacentPlot->isWater() && (pAdjacentPlot->getArea() != pWaterArea->GetID()))4653			{4654				iValue = pAdjacentPlot->area()->getNumTiles();46554656				if(iValue > iBestValue)4657				{4658					iBestValue = iValue;4659					pBestArea = pAdjacentPlot->area();4660				}4661			}4662		}4663	}46644665	return pBestArea;46664667}

Calls