Bazaar developer reference

CvPlot::setNEOfRiver(bool, FlowDirectionTypes)

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

Hooks

static bool BeforeCvPlot_setNEOfRiver(CvPlot* self, bool bNewValue, FlowDirectionTypes eRiverDir);static void AfterCvPlot_setNEOfRiver(CvPlot* self, bool bNewValue, FlowDirectionTypes eRiverDir);static void ReplaceCvPlot_setNEOfRiver(void (*original)(CvPlot*, bool, FlowDirectionTypes), CvPlot* self, bool bNewValue, FlowDirectionTypes eRiverDir);CivRegisterBefore<CivHooks::CvPlot_setNEOfRiver>(host, &BeforeCvPlot_setNEOfRiver);CivRegisterAfter<CivHooks::CvPlot_setNEOfRiver>(host, &AfterCvPlot_setNEOfRiver);CivRegisterReplace<CivHooks::CvPlot_setNEOfRiver>(host, &ReplaceCvPlot_setNEOfRiver);

Code

4998void CvPlot::setNEOfRiver(bool bNewValue, FlowDirectionTypes eRiverDir)4999{5000	CvPlot* pAdjacentPlot;5001	int iI;50025003	if((isNEOfRiver() != bNewValue) || (eRiverDir != m_eRiverSWFlowDirection))5004	{5005		CvAssertMsg(m_eRiverSWFlowDirection == NO_FLOWDIRECTION && eRiverDir != NO_FLOWDIRECTION, "invalid parameter");5006		if(isNEOfRiver() != bNewValue)5007		{5008#if defined(MOD_EVENTS_TERRAFORMING)5009			if (MOD_EVENTS_TERRAFORMING) {5010				GAMEEVENTINVOKE_HOOK(GAMEEVENT_TerraformingPlot, TERRAFORMINGEVENT_RIVER, m_iX, m_iY, DIRECTION_NORTHEAST, ((int) bNewValue), ((int) m_bNEOfRiver), eRiverDir, m_eRiverSWFlowDirection);5011			}5012#endif50135014			m_bNEOfRiver = bNewValue;50155016			updateRiverCrossing();5017			updateYield();50185019			for(iI = 0; iI < NUM_DIRECTION_TYPES; ++iI)5020			{5021				pAdjacentPlot = plotDirection(getX(), getY(), ((DirectionTypes)iI));50225023				if(pAdjacentPlot != NULL)5024				{5025					pAdjacentPlot->updateRiverCrossing();5026					pAdjacentPlot->updateYield();5027				}5028			}50295030			if(area() != NULL)5031			{5032				area()->changeNumRiverEdges((isNEOfRiver()) ? 1 : -1);5033			}5034		}50355036		CvAssertMsg(eRiverDir == FLOWDIRECTION_NORTHWEST || eRiverDir == FLOWDIRECTION_SOUTHEAST || eRiverDir == NO_FLOWDIRECTION, "invalid parameter");5037		m_eRiverSWFlowDirection = eRiverDir;5038	}5039}

Calls

Called by