Bazaar developer reference

CvPlot::isCoastalLand(int) const

Defined in
CvPlot.cpp, line 1070
Class
CvPlot
Hook name
CivHooks::CvPlot_isCoastalLand

Hooks

static bool BeforeCvPlot_isCoastalLand(const CvPlot* self, int iMinWaterSize, bool& result);static void AfterCvPlot_isCoastalLand(const CvPlot* self, int iMinWaterSize, bool& result);static bool ReplaceCvPlot_isCoastalLand(bool (*original)(const CvPlot*, int), const CvPlot* self, int iMinWaterSize);CivRegisterBefore<CivHooks::CvPlot_isCoastalLand>(host, &BeforeCvPlot_isCoastalLand);CivRegisterAfter<CivHooks::CvPlot_isCoastalLand>(host, &AfterCvPlot_isCoastalLand);CivRegisterReplace<CivHooks::CvPlot_isCoastalLand>(host, &ReplaceCvPlot_isCoastalLand);

Code

1070bool CvPlot::isCoastalLand(int iMinWaterSize) const1071{1072	CvPlot* pAdjacentPlot;1073	int iI;10741075	if(isWater())1076	{1077		return false;1078	}10791080	// If -1 was passed in (default argument) use min water size for ocean define1081	if(iMinWaterSize == -1)1082	{1083		iMinWaterSize = GC.getMIN_WATER_SIZE_FOR_OCEAN();1084	}10851086	for(iI = 0; iI < NUM_DIRECTION_TYPES; ++iI)1087	{1088		pAdjacentPlot = plotDirection(getX(), getY(), ((DirectionTypes)iI));10891090		if(pAdjacentPlot != NULL)1091		{1092			if(pAdjacentPlot->isWater())1093			{1094				if(iMinWaterSize <= 0)1095				{1096					return true;1097				}1098				CvLandmass* pAdjacentBodyOfWater = GC.getMap().getLandmass(pAdjacentPlot->getLandmass());1099				if(pAdjacentBodyOfWater && pAdjacentBodyOfWater->getNumTiles() >= iMinWaterSize)1100				{1101					return true;1102				}1103			}1104		}1105	}11061107	return false;1108}

Calls

Called by