Bazaar developer reference

CvPlot::updateRiverCrossing(DirectionTypes)

Defined in
CvPlot.cpp, line 9012
Class
CvPlot
Hook name
CivHooks::CvPlot_updateRiverCrossing

Hooks

static bool BeforeCvPlot_updateRiverCrossing(CvPlot* self, DirectionTypes eIndex);static void AfterCvPlot_updateRiverCrossing(CvPlot* self, DirectionTypes eIndex);static void ReplaceCvPlot_updateRiverCrossing(void (*original)(CvPlot*, DirectionTypes), CvPlot* self, DirectionTypes eIndex);CivRegisterBefore<CivHooks::CvPlot_updateRiverCrossing>(host, &BeforeCvPlot_updateRiverCrossing);CivRegisterAfter<CivHooks::CvPlot_updateRiverCrossing>(host, &AfterCvPlot_updateRiverCrossing);CivRegisterReplace<CivHooks::CvPlot_updateRiverCrossing>(host, &ReplaceCvPlot_updateRiverCrossing);

Code

9012void CvPlot::updateRiverCrossing(DirectionTypes eIndex)9013{90149015	CvAssertMsg(eIndex >= 0, "eIndex is expected to be non-negative (invalid Index)");9016	CvAssertMsg(eIndex < NUM_DIRECTION_TYPES, "eIndex is expected to be within maximum bounds (invalid Index)");90179018	bool bValid = false;9019	CvPlot* pPlot = plotDirection(getX(), getY(), eIndex);90209021	if((NULL == pPlot) || (!pPlot->isWater() && !isWater()))  // if there is no plot in that direction or both plots are land9022	{9023		switch(eIndex)9024		{90259026		case DIRECTION_NORTHEAST:9027		{9028			if(pPlot && pPlot->isNEOfRiver())9029			{9030				bValid = true;9031				break;9032			}9033		}9034		break;90359036		case DIRECTION_EAST:9037			bValid = isWOfRiver();9038			break;90399040		case DIRECTION_SOUTHEAST:9041			bValid = isNWOfRiver();9042			break;90439044		case DIRECTION_SOUTHWEST:9045			bValid = isNEOfRiver();9046			break;90479048		case DIRECTION_WEST:9049			if(pPlot != NULL)9050			{9051				bValid = pPlot->isWOfRiver();9052			}9053			break;90549055		case DIRECTION_NORTHWEST:9056			if(pPlot != NULL)9057			{9058				bValid = pPlot->isNWOfRiver();9059			}9060			break;90619062		default:9063			CvAssert(false);9064			break;9065		}9066	}90679068	if(isRiverCrossing(eIndex) != bValid)9069	{9070		char iFlowMask = 1 << eIndex;9071		if(bValid)9072		{9073			m_cRiverCrossing |= iFlowMask;9074			changeRiverCrossingCount(1);9075		}9076		else9077		{9078			m_cRiverCrossing &= ~iFlowMask;9079			changeRiverCrossingCount(-1);9080		}9081	}9082}

Calls

Called by