Bazaar developer reference

CvPlot::setWOfRiver(bool, FlowDirectionTypes)

Defined in
CvPlot.cpp, line 5050
Class
CvPlot
Hook name
CivHooks::CvPlot_setWOfRiver
Lua events
GameEvents.TerraformingPlot

Hooks

static bool BeforeCvPlot_setWOfRiver(CvPlot* self, bool bNewValue, FlowDirectionTypes eRiverDir);static void AfterCvPlot_setWOfRiver(CvPlot* self, bool bNewValue, FlowDirectionTypes eRiverDir);static void ReplaceCvPlot_setWOfRiver(void (*original)(CvPlot*, bool, FlowDirectionTypes), CvPlot* self, bool bNewValue, FlowDirectionTypes eRiverDir);CivRegisterBefore<CivHooks::CvPlot_setWOfRiver>(host, &BeforeCvPlot_setWOfRiver);CivRegisterAfter<CivHooks::CvPlot_setWOfRiver>(host, &AfterCvPlot_setWOfRiver);CivRegisterReplace<CivHooks::CvPlot_setWOfRiver>(host, &ReplaceCvPlot_setWOfRiver);

Code

5050void CvPlot::setWOfRiver(bool bNewValue, FlowDirectionTypes eRiverDir)5051{5052	CvPlot* pAdjacentPlot;5053	int iI;50545055	if((isWOfRiver() != bNewValue) || (eRiverDir != m_eRiverEFlowDirection))5056	{5057		CvAssertMsg(m_eRiverEFlowDirection == NO_FLOWDIRECTION && eRiverDir != NO_FLOWDIRECTION, "invalid parameter");5058		if(isWOfRiver() != bNewValue)5059		{5060#if defined(MOD_EVENTS_TERRAFORMING)5061			if (MOD_EVENTS_TERRAFORMING) {5062				GAMEEVENTINVOKE_HOOK(GAMEEVENT_TerraformingPlot, TERRAFORMINGEVENT_RIVER, m_iX, m_iY, DIRECTION_WEST, ((int) bNewValue), ((int) m_bWOfRiver), eRiverDir, m_eRiverEFlowDirection);5063			}5064#endif50655066			m_bWOfRiver = bNewValue;50675068			updateRiverCrossing();5069			updateYield();50705071			for(iI = 0; iI < NUM_DIRECTION_TYPES; ++iI)5072			{5073				pAdjacentPlot = plotDirection(getX(), getY(), ((DirectionTypes)iI));50745075				if(pAdjacentPlot != NULL)5076				{5077					pAdjacentPlot->updateRiverCrossing();5078					pAdjacentPlot->updateYield();5079				}5080			}50815082			if(area())5083			{5084				area()->changeNumRiverEdges((isWOfRiver()) ? 1 : -1);5085			}5086		}50875088		CvAssertMsg(eRiverDir == FLOWDIRECTION_NORTH || eRiverDir == FLOWDIRECTION_SOUTH || eRiverDir == NO_FLOWDIRECTION, "invalid parameter");5089		m_eRiverEFlowDirection= eRiverDir;5090	}5091}

Calls

Called by