Hooks
static bool BeforeCvLuaPlot_lCanSeePlot(lua_State* L, int& result);static void AfterCvLuaPlot_lCanSeePlot(lua_State* L, int& result);static int ReplaceCvLuaPlot_lCanSeePlot(int (*original)(lua_State*), lua_State* L);CivRegisterBefore<CivHooks::CvLuaPlot_lCanSeePlot>(host, &BeforeCvLuaPlot_lCanSeePlot);CivRegisterAfter<CivHooks::CvLuaPlot_lCanSeePlot>(host, &AfterCvLuaPlot_lCanSeePlot);CivRegisterReplace<CivHooks::CvLuaPlot_lCanSeePlot>(host, &ReplaceCvLuaPlot_lCanSeePlot);
Code
1973//bool CvPlot::canSeePlot(CvPlot *pPlot, TeamTypes eTeam, int iRange, DirectionTypes eFacingDirection)1974int CvLuaPlot::lCanSeePlot(lua_State* L)1975{1976 CvPlot* pkThisPlot = GetInstance(L);1977 CvPlot* pkThatPlot = GetInstance(L, 2);1978 TeamTypes eTeam = (TeamTypes) lua_tointeger(L, 3);1979 int iRange = lua_tointeger(L, 4);1980 DirectionTypes eFacingDirection = (DirectionTypes) lua_tointeger(L, 5);1981#if defined MOD_BUGFIX_NAVAL_TARGETING1982 DomainTypes eUnitDomain = (DomainTypes) luaL_optinteger(L, 6, DOMAIN_LAND);1983#endif19841985 bool bCanSee = false;1986 if(pkThisPlot)1987 {1988#if defined MOD_BUGFIX_NAVAL_TARGETING1989 bCanSee = pkThisPlot->canSeePlot(pkThatPlot, eTeam, iRange, eFacingDirection, eUnitDomain);1990#else1991 bCanSee = pkThisPlot->canSeePlot(pkThatPlot, eTeam, iRange, eFacingDirection);1992#endif1993 }19941995 lua_pushboolean(L, bCanSee);1996 return 1;19971998}