Bazaar developer reference

CvGame::DoCacheMapScoreMod()

Defined in
CvGame.cpp, line 1787
Class
CvGame
Hook name
CivHooks::CvGame_DoCacheMapScoreMod

Hooks

static bool BeforeCvGame_DoCacheMapScoreMod(CvGame* self);static void AfterCvGame_DoCacheMapScoreMod(CvGame* self);static void ReplaceCvGame_DoCacheMapScoreMod(void (*original)(CvGame*), CvGame* self);CivRegisterBefore<CivHooks::CvGame_DoCacheMapScoreMod>(host, &BeforeCvGame_DoCacheMapScoreMod);CivRegisterAfter<CivHooks::CvGame_DoCacheMapScoreMod>(host, &AfterCvGame_DoCacheMapScoreMod);CivRegisterReplace<CivHooks::CvGame_DoCacheMapScoreMod>(host, &ReplaceCvGame_DoCacheMapScoreMod);

Code

1787void CvGame::DoCacheMapScoreMod()1788{1789	// Seed with a default value in case someone's removed the Standard worldsize (shame on you!)1790	int iBaseNumTiles = 4160;17911792	// Calculate "base" num tiles for the average map1793	WorldSizeTypes eStandardWorld = (WorldSizeTypes) GC.getInfoTypeForString("WORLDSIZE_STANDARD", true);1794	if(eStandardWorld == NO_WORLDSIZE)1795	{1796		Database::SingleResult kResult;1797		CvWorldInfo kWorldInfo;1798		const bool bResult = DB.SelectAt(kResult, "Worlds", eStandardWorld);1799		DEBUG_VARIABLE(bResult);1800		CvAssertMsg(bResult, "Cannot find world info.");1801		kWorldInfo.CacheResult(kResult);18021803		iBaseNumTiles = kWorldInfo.getGridWidth();1804		iBaseNumTiles *= kWorldInfo.getGridHeight();1805	}18061807	int iNumTilesOnThisMap = GC.getMap().numPlots();18081809	int iScoreMod = 100 * iBaseNumTiles / iNumTilesOnThisMap;18101811	// If we're giving a bonus to score, reduce the value, so that one pop isn't worth 30 points or something crazy on really small maps1812	if(iScoreMod > 100)1813	{1814		iScoreMod -= 100;1815		iScoreMod /= 3;1816		iScoreMod += 100;1817	}18181819	m_iMapScoreMod = iScoreMod;1820}

Calls

Called by