Hooks
static bool BeforeCvUnit_willRevealByMove(const CvUnit* self, const CvPlot& plot, bool& result);static void AfterCvUnit_willRevealByMove(const CvUnit* self, const CvPlot& plot, bool& result);static bool ReplaceCvUnit_willRevealByMove(bool (*original)(const CvUnit*, const CvPlot&), const CvUnit* self, const CvPlot& plot);CivRegisterBefore<CivHooks::CvUnit_willRevealByMove>(host, &BeforeCvUnit_willRevealByMove);CivRegisterAfter<CivHooks::CvUnit_willRevealByMove>(host, &AfterCvUnit_willRevealByMove);CivRegisterReplace<CivHooks::CvUnit_willRevealByMove>(host, &ReplaceCvUnit_willRevealByMove);
Code
3039bool CvUnit::willRevealByMove(const CvPlot& plot) const3040{3041 VALIDATE_OBJECT3042 int iVisRange = visibilityRange();3043 TeamTypes eTeam = getTeam();3044 int iRange = iVisRange + 1;3045 for(int i = -iRange; i <= iRange; ++i)3046 {3047 for(int j = -iRange; j <= iRange; ++j)3048 {3049 CvPlot* pLoopPlot = ::plotXYWithRangeCheck(plot.getX(), plot.getY(), i, j, iRange);3050 if(NULL != pLoopPlot)3051 {3052#if defined MOD_BUGFIX_NAVAL_TARGETING3053 if (!pLoopPlot->isRevealed(eTeam) && plot.canSeePlot(pLoopPlot, eTeam, iVisRange, NO_DIRECTION, getDomainType()))3054#else3055 if (!pLoopPlot->isRevealed(eTeam) && plot.canSeePlot(pLoopPlot, eTeam, iVisRange, NO_DIRECTION))3056#endif3057 {3058 return true;3059 }3060 }3061 }3062 }30633064 return false;3065}