Clean up TF2 ext CalcCritical code (bug 5894, r=voided).

This commit is contained in:
Nicholas Hastings
2013-08-29 09:27:35 -04:00
parent c80e0a964f
commit dde1deb6bc
6 changed files with 236 additions and 349 deletions
+32
View File
@@ -88,6 +88,38 @@ bool UTIL_FindDataTable(SendTable *pTable,
return false;
}
bool UTIL_ContainsDataTable(SendTable *pTable, const char *name)
{
const char *pname = pTable->GetName();
int props = pTable->GetNumProps();
SendProp *prop;
SendTable *table;
if (pname && strcmp(name, pname) == 0)
return true;
for (int i = 0; i < props; i++)
{
prop = pTable->GetProp(i);
if ((table = prop->GetDataTable()) != NULL)
{
pname = table->GetName();
if (pname && strcmp(name, pname) == 0)
{
return true;
}
if (UTIL_ContainsDataTable(table, name))
{
return true;
}
}
}
return false;
}
ServerClass *UTIL_FindServerClass(const char *classname)
{
ServerClass *sc = gamedll->GetAllServerClasses();