Bazaar developer reference

CvArea::reset(int, bool, bool)

Defined in
CvArea.cpp, line 69
Class
CvArea
Hook name
CivHooks::CvArea_reset

Hooks

static bool BeforeCvArea_reset(CvArea* self, int iID, bool bWater, bool bConstructorCall);static void AfterCvArea_reset(CvArea* self, int iID, bool bWater, bool bConstructorCall);static void ReplaceCvArea_reset(void (*original)(CvArea*, int, bool, bool), CvArea* self, int iID, bool bWater, bool bConstructorCall);CivRegisterBefore<CivHooks::CvArea_reset>(host, &BeforeCvArea_reset);CivRegisterAfter<CivHooks::CvArea_reset>(host, &AfterCvArea_reset);CivRegisterReplace<CivHooks::CvArea_reset>(host, &ReplaceCvArea_reset);

Code

67// FUNCTION: reset()68// Initializes data members that are serialized.69void CvArea::reset(int iID, bool bWater, bool bConstructorCall)70{71	int iI, iJ;7273	//--------------------------------74	// Uninit class75	uninit();7677	m_iID = iID;78	m_iNumTiles = 0;79	m_iNumOwnedTiles = 0;80	m_iNumRiverEdges = 0;81	m_iNumUnits = 0;82	m_iNumCities = 0;83	m_iTotalPopulation = 0;84	m_iNumStartingPlots = 0;85	m_iNumNaturalWonders = 0;86	m_iTotalFoundValue = 0;87	m_Boundaries.m_iNorthEdge = 0;88	m_Boundaries.m_iSouthEdge = 0;89	m_Boundaries.m_iEastEdge = 0;90	m_Boundaries.m_iWestEdge = 0;9192	m_bWater = bWater;93	m_bMountains = false;9495	for(iI = 0; iI < REALLY_MAX_PLAYERS; iI++)96	{97		m_aiUnitsPerPlayer[iI] = 0;98		m_aiCitiesPerPlayer[iI] = 0;99		m_aiPopulationPerPlayer[iI] = 0;100		m_aiFreeSpecialist[iI] = 0;101	}102103	for(iI = 0; iI < REALLY_MAX_TEAMS; iI++)104	{105		m_aiNumRevealedTiles[iI] = 0;106	}107108	for(iI = 0; iI < REALLY_MAX_PLAYERS; iI++)109	{110		m_aTargetCities[iI].reset();111	}112113	for(iI = 0; iI < REALLY_MAX_PLAYERS; iI++)114	{115		for(iJ = 0; iJ < NUM_YIELD_TYPES; iJ++)116		{117			m_aaiYieldRateModifier[iI][iJ] = 0;118		}119	}120121	if(!bConstructorCall)122	{123		CvAssertMsg((0 < GC.getNumResourceInfos()) && "GC.getNumResourceInfos() is not greater than zero but an array is being allocated in CvArea::reset", "GC.getNumResourceInfos() is not greater than zero but an array is being allocated in CvArea::reset");124		int numRIs = GC.getNumResourceInfos();125		m_paiNumResources = FNEW(int[numRIs], c_eCiv5GameplayDLL, 0);126		for(iI = 0; iI < numRIs; iI++)127		{128			m_paiNumResources[iI] = 0;129		}130131		CvAssertMsg((0 < GC.getNumImprovementInfos()) && "GC.getNumImprovementInfos() is not greater than zero but an array is being allocated in CvArea::reset", "GC.getNumImprovementInfos() is not greater than zero but an array is being allocated in CvArea::reset");132		int numIIs = GC.getNumImprovementInfos();133		m_paiNumImprovements = FNEW(int[numIIs], c_eCiv5GameplayDLL, 0);134		for(iI = 0; iI < numIIs; iI++)135		{136			m_paiNumImprovements[iI] = 0;137		}138	}139}

Calls

Called by