Hooks
static bool BeforeCvPlayer_changePlotYieldChange(CvPlayer* self, PlotTypes eIndex1, YieldTypes eIndex2, int iChange);static void AfterCvPlayer_changePlotYieldChange(CvPlayer* self, PlotTypes eIndex1, YieldTypes eIndex2, int iChange);static void ReplaceCvPlayer_changePlotYieldChange(void (*original)(CvPlayer*, PlotTypes, YieldTypes, int), CvPlayer* self, PlotTypes eIndex1, YieldTypes eIndex2, int iChange);CivRegisterBefore<CivHooks::CvPlayer_changePlotYieldChange>(host, &BeforeCvPlayer_changePlotYieldChange);CivRegisterAfter<CivHooks::CvPlayer_changePlotYieldChange>(host, &AfterCvPlayer_changePlotYieldChange);CivRegisterReplace<CivHooks::CvPlayer_changePlotYieldChange>(host, &ReplaceCvPlayer_changePlotYieldChange);
Code
20927void CvPlayer::changePlotYieldChange(PlotTypes eIndex1, YieldTypes eIndex2, int iChange)20928{20929 if (MOD_API_PLOT_YIELDS) {20930 CvAssertMsg(eIndex1 >= 0, "eIndex1 is expected to be non-negative (invalid Index)");20931 CvAssertMsg(eIndex1 < GC.getNumPlotInfos(), "eIndex1 is expected to be within maximum bounds (invalid Index)");20932 CvAssertMsg(eIndex2 >= 0, "eIndex2 is expected to be non-negative (invalid Index)");20933 CvAssertMsg(eIndex2 < NUM_YIELD_TYPES, "eIndex2 is expected to be within maximum bounds (invalid Index)");2093420935 if(iChange != 0)20936 {20937 CvAssertMsg(iChange > -50 && iChange < 50, "GAMEPLAY: Yield for a plot is either negative or a ridiculously large number. Please send Jon this with your last 5 autosaves and what changelist # you're playing.");2093820939 Firaxis::Array<int, NUM_YIELD_TYPES> yields = m_ppiPlotYieldChange[eIndex1];20940 yields[eIndex2] = (m_ppiPlotYieldChange[eIndex1][eIndex2] + iChange);20941 m_ppiPlotYieldChange[eIndex1] = yields;20942 CvAssert(getPlotYieldChange(eIndex1, eIndex2) >= 0);2094320944 updateYield();20945 }20946 }20947}