本文整理汇总了C++中CDesignType::AddTypesUsed方法的典型用法代码示例。如果您正苦于以下问题:C++ CDesignType::AddTypesUsed方法的具体用法?C++ CDesignType::AddTypesUsed怎么用?C++ CDesignType::AddTypesUsed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDesignType
的用法示例。
在下文中一共展示了CDesignType::AddTypesUsed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddTypesUsedRecursive
void AddTypesUsedRecursive (CUniverse &Universe, DWORD dwUNID, TSortMap<DWORD, bool> *retTypesUsed)
{
int i;
// If already added, don't bother
if (retTypesUsed->Find(dwUNID))
return;
CDesignType *pType = Universe.FindDesignType(dwUNID);
if (pType == NULL)
return;
retTypesUsed->SetAt(dwUNID, true);
// Recurse
TSortMap<DWORD, bool> TypesUsed;
pType->AddTypesUsed(&TypesUsed);
for (i = 0; i < TypesUsed.GetCount(); i++)
AddTypesUsedRecursive(Universe, TypesUsed.GetKey(i), retTypesUsed);
}
示例2: GenerateTypeIslands
void GenerateTypeIslands (CUniverse &Universe, CXMLElement *pCmdLine)
{
int i, j;
bool bExcludeImages = true;
printf("TYPE ISLANDS\n");
printf("------------\n\n");
// Make a list of default types
#if 0
g_DefaultTypes.SetAt(0x00001001, true); // independent sovereign
g_DefaultTypes.SetAt(0x00001002, true); // Commonwealth sovereign
g_DefaultTypes.SetAt(0x00001003, true); // independent sovereign
g_DefaultTypes.SetAt(0x00001007, true); // ares sovereign
g_DefaultTypes.SetAt(0x0000100c, true); // sung slavers sovereign
g_DefaultTypes.SetAt(0x0000100f, true); // auton sovereign
g_DefaultTypes.SetAt(0x00001011, true); // corporate hierarchy
g_DefaultTypes.SetAt(0x00004027, true); // container of frozen supplies
g_DefaultTypes.SetAt(0x0000402c, true); // pteracnium ore
g_DefaultTypes.SetAt(0x000040ae, true); // helium3 reactor assembly
g_DefaultTypes.SetAt(0x000040af, true); // pteracnium fuel
g_DefaultTypes.SetAt(0x000040ca, true); // lancer cannon
g_DefaultTypes.SetAt(0x000040e2, true); // worldship armor
g_DefaultTypes.SetAt(0x00004100, true); // xenotite ore
g_DefaultTypes.SetAt(0x00004109, true); // SN2500 reactor
g_DefaultTypes.SetAt(0x00004167, true); // tetramite ore
g_DefaultTypes.SetAt(0x00005004, true); // wreck ejecta
g_DefaultTypes.SetAt(0x0000500c, true); // blast explosion 2
g_DefaultTypes.SetAt(0x0000500d, true); // blast explosion 3
g_DefaultTypes.SetAt(0x0000500e, true); // blast explosion 4
g_DefaultTypes.SetAt(0x0000500f, true); // thermo explosion 1
g_DefaultTypes.SetAt(0x00005011, true); // thermo explosion 3
g_DefaultTypes.SetAt(0x00005012, true); // thermo explosion 4
g_DefaultTypes.SetAt(0x00009004, true); // shield effect
g_DefaultTypes.SetAt(0x00009007, true); // explosion effect
g_DefaultTypes.SetAt(0x0000900a, true); // fire effect
g_DefaultTypes.SetAt(0x0000A003, true); // dsAbandonedStation
g_DefaultTypes.SetAt(0x0000a017, true); // dock screen?
g_DefaultTypes.SetAt(0x001a200c, true); // wreck of the CSC Europa
g_DefaultTypes.SetAt(0x001a200e, true); // sandstorm wreck
g_DefaultTypes.SetAt(0x001c1002, true); // ares sect in Heretic
g_DefaultTypes.SetAt(0x08020102, true); // huari empire sovereign
g_DefaultTypes.SetAt(0x08040140, true); // gaian processor station
#endif
// Create a reverse index of all type dependencies
ReverseIndexMap ReverseIndex;
for (i = 0; i < Universe.GetDesignTypeCount(); i++)
{
CDesignType *pType = Universe.GetDesignType(i);
// Get the list of UNIDs that this type uses
TSortMap<DWORD, bool> TypesUsed;
pType->AddTypesUsed(&TypesUsed);
for (j = 0; j < TypesUsed.GetCount(); j++)
{
CDesignType *pRequired = Universe.FindDesignType(TypesUsed.GetKey(j));
if (pRequired == NULL)
continue;
// Add to reverse index
TArray<DWORD> *pList = ReverseIndex.SetAt(pRequired->GetUNID());
pList->Insert(pType->GetUNID());
}
}
// We create a list of islands. In each island, all the types refer to
// each other and don't refer to types on any other island.
TArray<IslandMap> AllIslands;
// Loop over all types and add them to an island.
for (i = 0; i < Universe.GetDesignTypeCount(); i++)
{
CDesignType *pType = Universe.GetDesignType(i);
// Exclude images
if (bExcludeImages && pType->GetType() == designImage)
continue;
if (pType->GetType() == designShipTable)
continue;
// Exclude default types
if (g_DefaultTypes.Find(pType->GetUNID()))
continue;
// If this type is already on one of the islands, then we skip it.
#if 0
bool bFound = false;
//.........这里部分代码省略.........
示例3: GenerateTypeDependencies
void GenerateTypeDependencies (CUniverse &Universe, CXMLElement *pCmdLine)
{
int i, j;
bool bRecursive = pCmdLine->GetAttributeBool(CONSTLIT("recursive"));
bool bReverse = pCmdLine->GetAttributeBool(CONSTLIT("reverse"));
// Create a reverse index of all type dependencies
TSortMap<DWORD, TArray<DWORD> > ReverseIndex;
// Types and what they use
if (!bReverse)
{
printf("TYPES AND WHAT THEY USE\n");
printf("-----------------------\n\n");
}
for (i = 0; i < Universe.GetDesignTypeCount(); i++)
{
CDesignType *pType = Universe.GetDesignType(i);
if (!bReverse)
printf("%s\n", (char *)GetTypeDesc(pType));
// Get the list of UNIDs that this type uses
TSortMap<DWORD, bool> TypesUsed;
if (bRecursive)
AddTypesUsedRecursive(Universe, pType->GetUNID(), &TypesUsed);
else
pType->AddTypesUsed(&TypesUsed);
// Output the list
for (j = 0; j < TypesUsed.GetCount(); j++)
{
CDesignType *pRequired = Universe.FindDesignType(TypesUsed.GetKey(j));
if (pRequired == NULL)
continue;
if (!bReverse)
printf("\t%s\n", (char *)GetTypeDesc(pRequired));
// Add to reverse index
TArray<DWORD> *pList = ReverseIndex.SetAt(pRequired->GetUNID());
pList->Insert(pType->GetUNID());
}
}
// Types and what depends on them
if (bReverse)
{
printf("\nTYPES AND WHAT USES THEM\n");
printf( "------------------------\n\n");
for (i = 0; i < ReverseIndex.GetCount(); i++)
{
CDesignType *pType = Universe.FindDesignType(ReverseIndex.GetKey(i));
if (pType == NULL)
continue;
printf("%s\n", (char *)GetTypeDesc(pType));
TArray<DWORD> &List = ReverseIndex.GetValue(i);
for (j = 0; j < List.GetCount(); j++)
{
CDesignType *pRequiredBy = Universe.FindDesignType(List[j]);
if (pRequiredBy)
printf("\t%s\n", (char *)GetTypeDesc(pRequiredBy));
}
}
}
}