本文整理汇总了C++中CDesignType::GetLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ CDesignType::GetLevel方法的具体用法?C++ CDesignType::GetLevel怎么用?C++ CDesignType::GetLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDesignType
的用法示例。
在下文中一共展示了CDesignType::GetLevel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GenerateImageChart
//.........这里部分代码省略.........
NewEntry.iSize = pStationType->GetSize();
NewEntry.sSovereignName = (pStationType->GetSovereign() ? pStationType->GetSovereign()->GetTypeNounPhrase() : NULL_STR);
InitStationTypeImage(NewEntry, pStationType);
break;
}
default:
// Don't know how to handle this type
continue;
break;
}
// Adjust name
if (bFieldUNID)
NewEntry.sName = strPatternSubst(CONSTLIT("%s (%x)"), NewEntry.sName, NewEntry.pType->GetUNID());
// Compute the sort key
char szBuffer[1024];
switch (iOrder)
{
case orderLargest:
wsprintf(szBuffer, "%09d%s%x",
1000000 - NewEntry.iSize,
NewEntry.sName.GetASCIIZPointer(),
pType->GetUNID());
break;
case orderLevel:
wsprintf(szBuffer, "%09d%s%x",
pType->GetLevel(),
NewEntry.sName.GetASCIIZPointer(),
pType->GetUNID());
break;
case orderSmallest:
wsprintf(szBuffer, "%09d%s%x",
NewEntry.iSize,
NewEntry.sName.GetASCIIZPointer(),
pType->GetUNID());
break;
case orderSovereign:
wsprintf(szBuffer, "%s|%s|%x", NewEntry.sSovereignName.GetASCIIZPointer(), NewEntry.sName.GetASCIIZPointer(), pType->GetUNID());
NewEntry.sCategorize = NewEntry.sSovereignName;
break;
case orderManufacturer:
{
CString sManufacturer = NewEntry.pType->GetPropertyString(CONSTLIT("manufacturer"));
wsprintf(szBuffer, "%s|%s|%x", sManufacturer.GetASCIIZPointer(), NewEntry.sName.GetASCIIZPointer(), pType->GetUNID());
NewEntry.sCategorize = sManufacturer;
break;
}
default:
wsprintf(szBuffer, "%s%x", NewEntry.sName.GetASCIIZPointer(), pType->GetUNID());
break;
}
// Add to list
Table.Insert(CString(szBuffer), NewEntry);
示例2: GenerateTypeTable
void GenerateTypeTable (CUniverse &Universe, CXMLElement *pCmdLine)
{
int i, j;
// Get the criteria from the command line.
CString sCriteria = pCmdLine->GetAttribute(CRITERIA_ATTRIB);
// Parse it
CDesignTypeCriteria Criteria;
if (CDesignTypeCriteria::ParseCriteria(sCriteria, &Criteria) != NOERROR)
{
printf("ERROR: Unable to parse criteria.\n");
return;
}
// Generate a table of all matching types
TSortMap<CString, CDesignType *> Table;
// Loop over all items for this level and add them to
// a sorted table.
for (i = 0; i < Universe.GetDesignTypeCount(); i++)
{
CDesignType *pType = Universe.GetDesignType(i);
int iLevel = pType->GetLevel();
if (!pType->MatchesCriteria(Criteria))
continue;
// Get the name
CString sName = pType->GetDataField(FIELD_NAME);
if (*sName.GetASCIIZPointer() == '(')
sName = strSubString(sName, 1, -1);
// Figure out the sort order
char szBuffer[1024];
wsprintf(szBuffer, "%02d%s%08x",
iLevel,
sName.GetASCIIZPointer(),
pType->GetUNID());
Table.Insert(CString(szBuffer), pType);
}
// Generate a list of columns to display
TArray<CString> Cols;
Cols.Insert(FIELD_LEVEL);
Cols.Insert(FIELD_NAME);
for (i = 0; i < pCmdLine->GetAttributeCount(); i++)
{
CString sAttrib = pCmdLine->GetAttributeName(i);
if (!IsMainCommandParam(sAttrib)
&& !strEquals(sAttrib, CONSTLIT("typetable")))
{
CString sValue = pCmdLine->GetAttribute(i);
if (!strEquals(sValue, CONSTLIT("true")))
Cols.Insert(strPatternSubst(CONSTLIT("%s:%s"), sAttrib, sValue));
else
Cols.Insert(sAttrib);
}
}
// If we need to output total count, then load the table
CDesignTypeStats TotalCount;
if (pCmdLine->GetAttributeBool(FIELD_TOTAL_COUNT)
|| pCmdLine->GetAttributeBool(FIELD_COUNT_DISTRIBUTION))
{
if (LoadDesignTypeStats(Universe.GetDesignCollection().GetAdventureUNID(), &TotalCount) != NOERROR)
{
printf("ERROR: Unable to load type count table.\n");
return;
}
}
// If we've got any entries in the table, output now
if (Table.GetCount())
{
// Output the header
for (j = 0; j < Cols.GetCount(); j++)
{
if (j != 0)
printf("\t");
printf(Cols[j].GetASCIIZPointer());
}
printf("\n");
// Output each row
//.........这里部分代码省略.........