本文整理汇总了C++中CShipClass::CalcScore方法的典型用法代码示例。如果您正苦于以下问题:C++ CShipClass::CalcScore方法的具体用法?C++ CShipClass::CalcScore怎么用?C++ CShipClass::CalcScore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CShipClass
的用法示例。
在下文中一共展示了CShipClass::CalcScore方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GenerateShipTable
//.........这里部分代码省略.........
{
Cols.Insert(CONSTLIT("balanceType"));
Cols.Insert(CONSTLIT("combatStrength"));
Cols.Insert(CONSTLIT("damage"));
Cols.Insert(CONSTLIT("defenseStrength"));
}
else if (!IsMainCommandParam(sAttrib)
&& !strEquals(sAttrib, CONSTLIT("shiptable")))
{
CString sValue = pCmdLine->GetAttribute(i);
if (!strEquals(sValue, CONSTLIT("true")))
Cols.Insert(strPatternSubst(CONSTLIT("%s:%s"), sAttrib, sValue));
else
Cols.Insert(sAttrib);
}
}
// Output the header
for (j = 0; j < Cols.GetCount(); j++)
{
if (j != 0)
printf("\t");
printf(Cols[j].GetASCIIZPointer());
}
printf("\n");
// Generate a table
CSymbolTable Table(FALSE, TRUE);
// Loop over all items that match and add them to
// a sorted table.
for (i = 0; i < Universe.GetShipClassCount(); i++)
{
CShipClass *pClass = Universe.GetShipClass(i);
// Only include generic classes unless otherwise specified
if (!bAllClasses && !pClass->HasLiteralAttribute(CONSTLIT("genericClass")))
continue;
if (!pClass->MatchesCriteria(Criteria))
continue;
// Figure out the sort order
char szBuffer[1024];
wsprintf(szBuffer, "%04d%s%d",
pClass->GetLevel(),
pClass->GetNounPhrase(0).GetASCIIZPointer(),
pClass->GetUNID());
Table.AddEntry(CString(szBuffer), (CObject *)pClass);
}
// Output table
for (i = 0; i < Table.GetCount(); i++)
{
CShipClass *pClass = (CShipClass *)Table.GetValue(i);
// Output each row
for (j = 0; j < Cols.GetCount(); j++)
{
if (j != 0)
printf("\t");
const CString &sField = Cols[j];
CString sValue;
if (strEquals(sField, FIELD_ENTITY))
{
CString *pValue;
if (EntityTable.Lookup(pClass->GetUNID(), (CObject **)&pValue) == NOERROR)
sValue = *pValue;
else
sValue = CONSTLIT("?");
}
else
sValue = pClass->GetDataField(sField);
if (strEquals(sField, FIELD_MANEUVER)
|| strEquals(sField, FIELD_THRUST_TO_WEIGHT))
printf("%.1f", strToInt(sValue, 0, NULL) / 1000.0);
else if (strEquals(sField, FIELD_SCORE_CALC))
printf("%d", pClass->CalcScore());
else
printf(sValue.GetASCIIZPointer());
}
printf("\n");
}
printf("\n");
}