Bazaar developer reference

CvMap::calculateLandmasses()

Defined in
CvMap.cpp, line 2146
Class
CvMap
Hook name
CivHooks::CvMap_calculateLandmasses

Hooks

static bool BeforeCvMap_calculateLandmasses(CvMap* self);static void AfterCvMap_calculateLandmasses(CvMap* self);static void ReplaceCvMap_calculateLandmasses(void (*original)(CvMap*), CvMap* self);CivRegisterBefore<CivHooks::CvMap_calculateLandmasses>(host, &BeforeCvMap_calculateLandmasses);CivRegisterAfter<CivHooks::CvMap_calculateLandmasses>(host, &AfterCvMap_calculateLandmasses);CivRegisterReplace<CivHooks::CvMap_calculateLandmasses>(host, &ReplaceCvMap_calculateLandmasses);

Code

2146void CvMap::calculateLandmasses()2147{2148	CvPlot* pLoopPlot;2149	CvLandmass* pLandmass;2150	int iLandmassID;21512152	CvAStar& thePathfinder = GC.getAreaFinder();21532154	// change the area pathfinder to use these funcs instead2155	thePathfinder.SetValidFunc(LandmassValid);2156	thePathfinder.SetNotifyListFunc(JoinLandmass);21572158	for(int iI = 0; iI < numPlots(); iI++)2159	{2160		pLoopPlot = plotByIndexUnchecked(iI);2161		if(pLoopPlot->getLandmass() == FFreeList::INVALID_INDEX)2162		{2163			pLandmass = addLandmass();2164			pLandmass->init(pLandmass->GetID(), pLoopPlot->isWater());21652166			iLandmassID = pLandmass->GetID();21672168			pLoopPlot->setLandmass(iLandmassID);21692170			thePathfinder.GeneratePath(pLoopPlot->getX(), pLoopPlot->getY(), -1, -1, iLandmassID);2171		}2172	}2173	thePathfinder.SetValidFunc(AreaValid);2174	thePathfinder.SetNotifyListFunc(JoinArea);21752176	// KWG: Rebuild the yields here.  Yes, this is called during the landmass rebuild process if the landmass' 'lake' field changes, but2177	//      there is a problem with that. The yield bonus for a lake is dependent on the proximity to a plot that is a lake, and not the general landmass2178	//		'lake' flag.  During recalculation, a neighboring plot's 'lake' flag may not be set yet because it is in a landmass that has yet to be calculated2179	//		resulting in the wrong yield being applied to a plot.2180	updateYield();2181}

Calls

Called by