本文整理汇总了C++中CSystem::GetLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ CSystem::GetLevel方法的具体用法?C++ CSystem::GetLevel怎么用?C++ CSystem::GetLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSystem
的用法示例。
在下文中一共展示了CSystem::GetLevel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GenerateEncounterCount
void GenerateEncounterCount (CUniverse &Universe, CXMLElement *pCmdLine)
{
int i, j, k, l;
// Options
int iSystemSample = pCmdLine->GetAttributeIntegerBounded(CONSTLIT("count"), 1, -1, 1);
bool bLogo = !pCmdLine->GetAttributeBool(CONSTLIT("noLogo"));
bool bAll = pCmdLine->GetAttributeBool(CONSTLIT("all"));
// Additional columns
TArray<CString> Cols;
for (i = 0; i < pCmdLine->GetAttributeCount(); i++)
{
CString sAttrib = pCmdLine->GetAttributeName(i);
if (!IsMainCommandParam(sAttrib)
&& !strEquals(sAttrib, CONSTLIT("count"))
&& !strEquals(sAttrib, CONSTLIT("encountercount")))
{
CString sValue = pCmdLine->GetAttribute(i);
if (!strEquals(sValue, CONSTLIT("true")))
Cols.Insert(strPatternSubst(CONSTLIT("%s:%s"), sAttrib, sValue));
else
Cols.Insert(sAttrib);
}
}
// Generate systems for multiple games
TSortMap<CString, SNodeDesc> NodeTable;
for (i = 0; i < iSystemSample; i++)
{
if (bLogo)
printf("pass %d...\n", i+1);
// Initialize the game
CString sError;
if (Universe.InitGame(0, &sError) != NOERROR)
{
printf("%s\n", sError.GetASCIIZPointer());
return;
}
for (j = 0; j < Universe.GetTopologyNodeCount(); j++)
{
CTopologyNode *pNode = Universe.GetTopologyNode(j);
if (pNode->IsEndGame())
continue;
// Create the system
CSystem *pSystem;
if (Universe.CreateStarSystem(pNode, &pSystem) != NOERROR)
{
printf("ERROR: Unable to create star system.\n");
return;
}
// Create a sort string for this system
CString sSort = strPatternSubst(CONSTLIT("%02d-%s"), pSystem->GetLevel(), pNode->GetID());
// Get the table
bool bNew;
SNodeDesc *pResult = NodeTable.SetAt(sSort, &bNew);
if (bNew)
{
pResult->iLevel = pNode->GetLevel();
pResult->sNodeID = pNode->GetID();
}
// Accumulate data
AddSystemData(pSystem, bAll, pResult);
// Done with old system
Universe.DestroySystem(pSystem);
}
Universe.Reinit();
}
// Header
printf("Level\tNode\tSystemType\tCategory\tSovereign\tEncounter\tCount");
for (i = 0; i < Cols.GetCount(); i++)
printf("\t%s", Cols[i].GetASCIIZPointer());
printf("\n");
// Output all rows
for (i = 0; i < NodeTable.GetCount(); i++)
{
//.........这里部分代码省略.........