CvPlot::GetSizeLargestAdjacentWater() const
- Defined in
- CvPlot.cpp, line 1111
- Class
- CvPlot
- Hook name
CivHooks::CvPlot_GetSizeLargestAdjacentWater
Hooks
static bool BeforeCvPlot_GetSizeLargestAdjacentWater(const CvPlot* self, int& result);static void AfterCvPlot_GetSizeLargestAdjacentWater(const CvPlot* self, int& result);static int ReplaceCvPlot_GetSizeLargestAdjacentWater(int (*original)(const CvPlot*), const CvPlot* self);CivRegisterBefore<CivHooks::CvPlot_GetSizeLargestAdjacentWater>(host, &BeforeCvPlot_GetSizeLargestAdjacentWater);CivRegisterAfter<CivHooks::CvPlot_GetSizeLargestAdjacentWater>(host, &AfterCvPlot_GetSizeLargestAdjacentWater);CivRegisterReplace<CivHooks::CvPlot_GetSizeLargestAdjacentWater>(host, &ReplaceCvPlot_GetSizeLargestAdjacentWater);
Code
1111int CvPlot::GetSizeLargestAdjacentWater() const1112{1113 CvPlot* pAdjacentPlot;1114 int iI;1115 int iRtnValue = 0;11161117 if(isWater())1118 {1119 return iRtnValue;1120 }11211122 for(iI = 0; iI < NUM_DIRECTION_TYPES; ++iI)1123 {1124 pAdjacentPlot = plotDirection(getX(), getY(), ((DirectionTypes)iI));11251126 if(pAdjacentPlot != NULL)1127 {1128 if(pAdjacentPlot->isWater())1129 {1130 CvLandmass* pAdjacentBodyOfWater = GC.getMap().getLandmass(pAdjacentPlot->getLandmass());1131 if (pAdjacentBodyOfWater && pAdjacentBodyOfWater->getNumTiles() >= iRtnValue)1132 {1133 iRtnValue = pAdjacentBodyOfWater->getNumTiles();1134 }1135 }1136 }1137 }11381139 return iRtnValue;1140}