Bazaar developer reference

CvPlot::updateSeeFromSight(bool)

Defined in
CvPlot.cpp, line 2058
Class
CvPlot
Hook name
CivHooks::CvPlot_updateSeeFromSight

Hooks

static bool BeforeCvPlot_updateSeeFromSight(CvPlot* self, bool bIncrement);static void AfterCvPlot_updateSeeFromSight(CvPlot* self, bool bIncrement);static void ReplaceCvPlot_updateSeeFromSight(void (*original)(CvPlot*, bool), CvPlot* self, bool bIncrement);CivRegisterBefore<CivHooks::CvPlot_updateSeeFromSight>(host, &BeforeCvPlot_updateSeeFromSight);CivRegisterAfter<CivHooks::CvPlot_updateSeeFromSight>(host, &AfterCvPlot_updateSeeFromSight);CivRegisterReplace<CivHooks::CvPlot_updateSeeFromSight>(host, &ReplaceCvPlot_updateSeeFromSight);

Code

2058void CvPlot::updateSeeFromSight(bool bIncrement)2059{2060	CvPlot* pLoopPlot;2061	int iDX, iDY;20622063	int iRange = GC.getUNIT_VISIBILITY_RANGE() + 1;2064#if defined(MOD_PROMOTIONS_VARIABLE_RECON)2065	int iReconRange = GC.getRECON_VISIBILITY_RANGE() + 1;2066#endif2067	for(int iPromotion = 0; iPromotion < GC.getNumPromotionInfos(); ++iPromotion)2068	{2069		const PromotionTypes ePromotion = static_cast<PromotionTypes>(iPromotion);2070		CvPromotionEntry* pkPromotionInfo = GC.getPromotionInfo(ePromotion);2071		if(pkPromotionInfo)2072		{2073			iRange += pkPromotionInfo->GetVisibilityChange();2074#if defined(MOD_PROMOTIONS_VARIABLE_RECON)2075			iReconRange += std::max(0, pkPromotionInfo->GetReconChange());2076#endif2077		}2078	}20792080#if defined(MOD_PROMOTIONS_VARIABLE_RECON)2081	iRange = std::max(iReconRange, iRange);2082#else2083	iRange = std::max(GC.getRECON_VISIBILITY_RANGE() + 1, iRange);2084#endif2085	iRange = std::min(8, iRange); // I don't care, I'm not looking more than 8 out, deal20862087	for(iDX = -iRange; iDX <= iRange; iDX++)2088	{2089		for(iDY = -iRange; iDY <= iRange; iDY++)2090		{2091			pLoopPlot = plotXYWithRangeCheck(getX(), getY(), iDX, iDY, iRange);20922093			if(pLoopPlot != NULL)2094			{2095				pLoopPlot->updateSight(bIncrement);2096			}2097		}2098	}2099}

Calls

Called by