CvMap::findWater(CvPlot *, int, bool)
- Defined in
- CvMap.cpp, line 1039
- Class
- CvMap
- Hook name
CivHooks::CvMap_findWater
Hooks
static bool BeforeCvMap_findWater(CvMap* self, CvPlot* pPlot, int iRange, bool bFreshWater, bool& result);static void AfterCvMap_findWater(CvMap* self, CvPlot* pPlot, int iRange, bool bFreshWater, bool& result);static bool ReplaceCvMap_findWater(bool (*original)(CvMap*, CvPlot*, int, bool), CvMap* self, CvPlot* pPlot, int iRange, bool bFreshWater);CivRegisterBefore<CivHooks::CvMap_findWater>(host, &BeforeCvMap_findWater);CivRegisterAfter<CivHooks::CvMap_findWater>(host, &AfterCvMap_findWater);CivRegisterReplace<CivHooks::CvMap_findWater>(host, &ReplaceCvMap_findWater);
Code
1038// Check plots for wetlands or seaWater. Returns true if found1039bool CvMap::findWater(CvPlot* pPlot, int iRange, bool bFreshWater)1040{1041 CvPlot* pLoopPlot;1042 int iDX, iDY;1043 int iPlotX = pPlot->getX();1044 int iPlotY = pPlot->getY();10451046 for(iDX = -(iRange); iDX <= iRange; iDX++)1047 {1048 for(iDY = -(iRange); iDY <= iRange; iDY++)1049 {1050 pLoopPlot = plotXYWithRangeCheck(iPlotX, iPlotY, iDX, iDY, iRange);10511052 if(pLoopPlot != NULL)1053 {1054 if(bFreshWater)1055 {1056 if(pLoopPlot->isFreshWater())1057 {1058 return true;1059 }1060 }1061 else1062 {1063 if(pLoopPlot->isWater())1064 {1065 return true;1066 }1067 }1068 }1069 }1070 }10711072 return false;1073}