本文整理汇总了C++中CDesignType::MatchesCriteria方法的典型用法代码示例。如果您正苦于以下问题:C++ CDesignType::MatchesCriteria方法的具体用法?C++ CDesignType::MatchesCriteria怎么用?C++ CDesignType::MatchesCriteria使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDesignType
的用法示例。
在下文中一共展示了CDesignType::MatchesCriteria方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddMatchingKeyEvents
bool CPlayerGameStats::AddMatchingKeyEvents (const CString &sNodeID, const CDesignTypeCriteria &Crit, TArray<SKeyEventStats> *pEventList, TArray<SKeyEventStatsResult> *retList) const
// AddMatchingKeyEvents
//
// Adds all of the matching events from pEventList to the result
{
int i;
for (i = 0; i < pEventList->GetCount(); i++)
{
SKeyEventStats *pStats = &pEventList->GetAt(i);
CDesignType *pType = g_pUniverse->FindDesignType(pStats->dwObjUNID);
if (pType == NULL)
continue;
if (pType->MatchesCriteria(Crit))
{
SKeyEventStatsResult *pResult = retList->Insert();
pResult->sNodeID = sNodeID;
pResult->pStats = pStats;
pResult->bMarked = false;
}
}
return true;
}
示例2: GenerateImageChart
//.........这里部分代码省略.........
&bBold,
&bItalic))
{
sTypeface = CONSTLIT("Arial");
iSize = 10;
bBold = false;
bItalic = false;
}
CG16bitFont NameFont;
NameFont.Create(sTypeface, -PointsToPixels(iSize), bBold, bItalic);
CG32bitPixel rgbNameColor = CG32bitPixel(255, 255, 255);
// Rotation
int iRotation = pCmdLine->GetAttributeInteger(CONSTLIT("rotation"));
// Output file
CString sFilespec = pCmdLine->GetAttribute(CONSTLIT("output"));
if (!sFilespec.IsBlank())
sFilespec = pathAddExtensionIfNecessary(sFilespec, CONSTLIT(".bmp"));
// Generate a sorted table of types
TSortMap<CString, SEntryDesc> Table;
for (i = 0; i < Universe.GetDesignTypeCount(); i++)
{
CDesignType *pType = Universe.GetDesignType(i);
SEntryDesc NewEntry;
// Make sure we match the criteria
if (!pType->MatchesCriteria(Criteria))
continue;
// Figure stuff stuff out based on the specific design type
switch (pType->GetType())
{
case designItemType:
{
CItemType *pItemType = CItemType::AsType(pType);
CItem Item(pItemType, 1);
// Skip if not in item criteria
if (!Item.MatchesCriteria(ItemCriteria))
continue;
// Skip virtual classes
if (pItemType->IsVirtual())
continue;
// Initialize the entry
NewEntry.pType = pType;
NewEntry.sName = pItemType->GetNounPhrase(0);
NewEntry.pImage = &pItemType->GetImage();
NewEntry.iSize = RectWidth(NewEntry.pImage->GetImageRect());
break;
}
case designShipClass:
{
示例3: 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
//.........这里部分代码省略.........