Improved sendtable dump output (bug 5471, r=psychonic).
Improved sendtable dump output (
bug 5471, r=psychonic).
1.1 --- a/extensions/sdktools/vhelpers.cpp Thu Nov 15 17:49:13 2012 +0000
1.2 +++ b/extensions/sdktools/vhelpers.cpp Thu Nov 15 17:50:11 2012 +0000
1.3 @@ -329,24 +329,22 @@
1.4 fprintf(fp, "</serverclass>\n");
1.5 }
1.6
1.7 -void UTIL_DrawSendTable(FILE *fp, SendTable *pTable, int level)
1.8 +void UTIL_DrawSendTable(FILE *fp, SendTable *pTable, int level = 1)
1.9 {
1.10 - char spaces[255];
1.11 - for (int i=0; i<level; i++)
1.12 - spaces[i] = ' ';
1.13 - spaces[level] = '\0';
1.14 + SendProp *pProp;
1.15 + const char *type;
1.16
1.17 - const char *name, *type;
1.18 - SendProp *pProp;
1.19 -
1.20 - fprintf(fp, "%sSub-Class Table (%d Deep): %s\n", spaces, level, pTable->GetName());
1.21 -
1.22 - for (int i=0; i<pTable->GetNumProps(); i++)
1.23 + for (int i = 0; i < pTable->GetNumProps(); i++)
1.24 {
1.25 pProp = pTable->GetProp(i);
1.26 - name = pProp->GetName();
1.27 if (pProp->GetDataTable())
1.28 {
1.29 + fprintf(fp, "%*sTable: %s (offset %d) (type %s)\n",
1.30 + level, "",
1.31 + pProp->GetName(),
1.32 + pProp->GetOffset(),
1.33 + pProp->GetDataTable()->GetName());
1.34 +
1.35 UTIL_DrawSendTable(fp, pProp->GetDataTable(), level + 1);
1.36 }
1.37 else
1.38 @@ -356,8 +354,8 @@
1.39 if (type != NULL)
1.40 {
1.41 fprintf(fp,
1.42 - "%s-Member: %s (offset %d) (type %s) (bits %d)\n",
1.43 - spaces,
1.44 + "%*sMember: %s (offset %d) (type %s) (bits %d)\n",
1.45 + level, "",
1.46 pProp->GetName(),
1.47 pProp->GetOffset(),
1.48 type,
1.49 @@ -366,8 +364,8 @@
1.50 else
1.51 {
1.52 fprintf(fp,
1.53 - "%s-Member: %s (offset %d) (type %d) (bits %d)\n",
1.54 - spaces,
1.55 + "%*sMember: %s (offset %d) (type %d) (bits %d)\n",
1.56 + level, "",
1.57 pProp->GetName(),
1.58 pProp->GetOffset(),
1.59 pProp->GetType(),
1.60 @@ -453,8 +451,8 @@
1.61 ServerClass *pBase = gamedll->GetAllServerClasses();
1.62 while (pBase != NULL)
1.63 {
1.64 - fprintf(fp, "%s:\n", pBase->GetName());
1.65 - UTIL_DrawSendTable(fp, pBase->m_pTable, 1);
1.66 + fprintf(fp, "%s (type %s)\n", pBase->GetName(), pBase->m_pTable->GetName());
1.67 + UTIL_DrawSendTable(fp, pBase->m_pTable);
1.68 pBase = pBase->m_pNext;
1.69 }
1.70