Bazaar developer reference

CvDangerPlots::AddDanger(int, int, int, bool)

Defined in
CvDangerPlots.cpp, line 245
Class
CvDangerPlots
Hook name
CivHooks::CvDangerPlots_AddDanger

Hooks

static bool BeforeCvDangerPlots_AddDanger(CvDangerPlots* self, int iPlotX, int iPlotY, int iValue, bool bWithinOneMove);static void AfterCvDangerPlots_AddDanger(CvDangerPlots* self, int iPlotX, int iPlotY, int iValue, bool bWithinOneMove);static void ReplaceCvDangerPlots_AddDanger(void (*original)(CvDangerPlots*, int, int, int, bool), CvDangerPlots* self, int iPlotX, int iPlotY, int iValue, bool bWithinOneMove);CivRegisterBefore<CivHooks::CvDangerPlots_AddDanger>(host, &BeforeCvDangerPlots_AddDanger);CivRegisterAfter<CivHooks::CvDangerPlots_AddDanger>(host, &AfterCvDangerPlots_AddDanger);CivRegisterReplace<CivHooks::CvDangerPlots_AddDanger>(host, &ReplaceCvDangerPlots_AddDanger);

Code

244/// Add an amount of danger to a given tile245void CvDangerPlots::AddDanger(int iPlotX, int iPlotY, int iValue, bool bWithinOneMove)246{247	const int idx = iPlotX + iPlotY * GC.getMap().getGridWidth();248	if (iValue > 0)249	{250		if (bWithinOneMove)251		{252			iValue |= 0x1;253		}254		else255		{256			iValue &= ~0x1;257		}258	}259260	m_DangerPlots[idx] += iValue;261}

Calls

Called by