Bazaar developer reference

CvPlot::setNWOfRiver(bool, FlowDirectionTypes)

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

Hooks

static bool BeforeCvPlot_setNWOfRiver(CvPlot* self, bool bNewValue, FlowDirectionTypes eRiverDir);static void AfterCvPlot_setNWOfRiver(CvPlot* self, bool bNewValue, FlowDirectionTypes eRiverDir);static void ReplaceCvPlot_setNWOfRiver(void (*original)(CvPlot*, bool, FlowDirectionTypes), CvPlot* self, bool bNewValue, FlowDirectionTypes eRiverDir);CivRegisterBefore<CivHooks::CvPlot_setNWOfRiver>(host, &BeforeCvPlot_setNWOfRiver);CivRegisterAfter<CivHooks::CvPlot_setNWOfRiver>(host, &AfterCvPlot_setNWOfRiver);CivRegisterReplace<CivHooks::CvPlot_setNWOfRiver>(host, &ReplaceCvPlot_setNWOfRiver);

Code

5102void CvPlot::setNWOfRiver(bool bNewValue, FlowDirectionTypes eRiverDir)5103{5104	CvPlot* pAdjacentPlot;5105	int iI;51065107	if((isNWOfRiver() != bNewValue) || (eRiverDir != m_eRiverSEFlowDirection))5108	{5109		CvAssertMsg(m_eRiverSEFlowDirection == NO_FLOWDIRECTION && eRiverDir != NO_FLOWDIRECTION, "invalid parameter");5110		if(isNWOfRiver() != bNewValue)5111		{5112#if defined(MOD_EVENTS_TERRAFORMING)5113			if (MOD_EVENTS_TERRAFORMING) {5114				GAMEEVENTINVOKE_HOOK(GAMEEVENT_TerraformingPlot, TERRAFORMINGEVENT_RIVER, m_iX, m_iY, DIRECTION_NORTHWEST, ((int) bNewValue), ((int) m_bNWOfRiver), eRiverDir, m_eRiverSEFlowDirection);5115			}5116#endif51175118			m_bNWOfRiver = bNewValue;51195120			updateRiverCrossing();5121			updateYield();51225123			for(iI = 0; iI < NUM_DIRECTION_TYPES; ++iI)5124			{5125				pAdjacentPlot = plotDirection(getX(), getY(), ((DirectionTypes)iI));51265127				if(pAdjacentPlot != NULL)5128				{5129					pAdjacentPlot->updateRiverCrossing();5130					pAdjacentPlot->updateYield();5131				}5132			}51335134			if(area())5135			{5136				area()->changeNumRiverEdges((isNWOfRiver()) ? 1 : -1);5137			}5138		}51395140		CvAssertMsg(eRiverDir == FLOWDIRECTION_NORTHEAST || eRiverDir == FLOWDIRECTION_SOUTHWEST || eRiverDir == NO_FLOWDIRECTION, "invalid parameter");5141		m_eRiverSEFlowDirection = eRiverDir;5142	}5143}

Calls

Called by