Bazaar developer reference

CvGlobals::GetHexDebugLayerString(CvPlot *, const char *, PlayerTypes, char *, unsigned int)

Defined in
CvGlobals.cpp, line 4105
Class
CvGlobals
Hook name
CivHooks::CvGlobals_GetHexDebugLayerString

Hooks

static bool BeforeCvGlobals_GetHexDebugLayerString(CvGlobals* self, CvPlot* pkPlot, const char* szLayerName, PlayerTypes ePlayer, char* szBuffer, unsigned int uiBufferLength, bool& result);static void AfterCvGlobals_GetHexDebugLayerString(CvGlobals* self, CvPlot* pkPlot, const char* szLayerName, PlayerTypes ePlayer, char* szBuffer, unsigned int uiBufferLength, bool& result);static bool ReplaceCvGlobals_GetHexDebugLayerString(bool (*original)(CvGlobals*, CvPlot*, const char*, PlayerTypes, char*, unsigned int), CvGlobals* self, CvPlot* pkPlot, const char* szLayerName, PlayerTypes ePlayer, char* szBuffer, unsigned int uiBufferLength);CivRegisterBefore<CivHooks::CvGlobals_GetHexDebugLayerString>(host, &BeforeCvGlobals_GetHexDebugLayerString);CivRegisterAfter<CivHooks::CvGlobals_GetHexDebugLayerString>(host, &AfterCvGlobals_GetHexDebugLayerString);CivRegisterReplace<CivHooks::CvGlobals_GetHexDebugLayerString>(host, &ReplaceCvGlobals_GetHexDebugLayerString);

Code

4105bool CvGlobals::GetHexDebugLayerString(CvPlot* pkPlot, const char* szLayerName, PlayerTypes ePlayer, char* szBuffer, unsigned int uiBufferLength)4106{4107	std::string strLayerName = szLayerName;4108	if(strLayerName == "StartSiteEvaluationLayer")4109	{4110		if(!pkPlot->isWater())4111		{4112			const int iValue = GC.getGame().GetStartSiteEvaluator()->PlotFoundValue(pkPlot, NULL);4113			sprintf_s(szBuffer, uiBufferLength, "%d", iValue);4114		}4115	}4116	else if(strLayerName == "SettlerSiteEvaluationLayer")4117	{4118		if(!pkPlot->isWater() && ePlayer != NO_PLAYER)4119		{4120			CvPlayerAI& kPlayer = GET_PLAYER(ePlayer);4121			const int iValue = GC.getGame().GetSettlerSiteEvaluator()->PlotFoundValue(pkPlot, &kPlayer);4122			sprintf_s(szBuffer, uiBufferLength, "%d", iValue);4123		}4124	}4125	else if(strLayerName == "VisibilityLayer")4126	{4127		if(ePlayer != NO_PLAYER)4128		{4129			CvPlayerAI& kPlayer = GET_PLAYER(ePlayer);4130			const TeamTypes eTeam = kPlayer.getTeam();41314132			if(pkPlot->isVisible(eTeam))4133			{4134				sprintf_s(szBuffer, uiBufferLength, "Vis %d", kPlayer.GetID());4135			}4136		}4137	}4138	else if(strLayerName == "RevealedLayer")4139	{4140		if(ePlayer != NO_PLAYER)4141		{4142			CvPlayerAI& kPlayer = GET_PLAYER(ePlayer);4143			const TeamTypes eTeam = kPlayer.getTeam();4144			if(pkPlot->isRevealed(eTeam))4145			{4146				sprintf_s(szBuffer, uiBufferLength, "Rev %d", kPlayer.GetID());41474148			}4149		}4150	}4151	else if(strLayerName == "DangerLayer")4152	{4153		if(ePlayer != NO_PLAYER)4154		{4155			CvPlayerAI& kPlayer = GET_PLAYER(ePlayer);4156			const int iValue = kPlayer.GetPlotDanger(*pkPlot);41574158			sprintf_s(szBuffer, uiBufferLength, "%d", iValue);4159		}4160	}4161	else if(strLayerName == "ArtifactLayer")4162	{4163		const int iValue = pkPlot->GetArchaeologicalRecord().m_eArtifactType; // this is a copy4164		sprintf_s(szBuffer, uiBufferLength, "%d", iValue);4165	}4166	else if(strLayerName == "TacticalAnalysisLayer")4167	{4168		std::string strOut;41694170		int iIndex = GC.getMap().plotNum(pkPlot->getX(), pkPlot->getY());4171		CvTacticalAnalysisMap* pTactMap = GC.getGame().GetTacticalAnalysisMap();4172		CvTacticalAnalysisCell* pCell = pTactMap->GetCell(iIndex);41734174		if(pCell->IsImpassableTerrain())4175		{4176			strOut += "X Terrain";4177		}4178		else4179		{4180			if(pCell->IsImpassableTerritory())4181			{4182				strOut += "X Territory";4183			}4184			else4185			{4186				if(pCell->IsRevealed())4187				{4188					strOut += "R ";4189				}4190				if(pCell->IsVisible())4191				{4192					strOut += "V ";4193				}4194				if(pCell->IsEnemyCanMovePast())4195				{4196					strOut += "A+ ";4197				}4198				else if(pCell->IsNotVisibleToEnemy())4199				{4200					strOut += "N ";4201				}4202				else if(pCell->IsSubjectToAttack())4203				{4204					strOut += "A ";4205				}4206				if(pCell->IsFriendlyTurnEndTile())4207				{4208					strOut += "E ";4209				}4210				if(pCell->IsWithinRangeOfTarget())4211				{4212					strOut += "T ";4213				}4214				if(pCell->IsHelpsProvidesFlankBonus())4215				{4216					strOut += "F ";4217				}4218				if(pCell->GetDefenseModifier() > 0)4219				{4220					strOut += "D ";4221				}4222				if(pCell->GetDominanceZone() != -1)4223				{4224					char szTmp[16] = {0};4225					sprintf_s(szTmp, "%d ", pCell->GetDominanceZone());42264227					strOut += szTmp;4228				}4229				if(pCell->GetDeploymentScore() > 0)4230				{4231					char szTmp[16] = {0};4232					if(pCell->IsSafeForDeployment())4233					{4234						sprintf_s(szTmp, "[S%d] ", pCell->GetDeploymentScore());4235					}4236					else4237					{4238						sprintf_s(szTmp, "[%d] ", pCell->GetDeploymentScore());4239					}42404241					strOut += szTmp;4242				}4243			}4244		}42454246		sprintf_s(szBuffer, uiBufferLength, "%s", strOut.c_str());4247	}4248	else if(strLayerName == "TargetingPathLayer")4249	{4250		extern int GetLastTargetingPathIndex(int plotIndex);4251		sprintf_s(szBuffer, uiBufferLength, "%d", GetLastTargetingPathIndex(pkPlot->GetPlotIndex()));4252	}42534254	return true;4255}

Calls

Called by