Cache m_iEFlags offset for datamaps dump instead of getting for each ent (bug 5657, r=asherkin).

This commit is contained in:
Nicholas Hastings 2013-03-19 11:24:01 -04:00
parent 0d97198f88
commit ec716f0c58

View File

@ -786,6 +786,7 @@ CON_COMMAND(sm_dump_datamaps, "Dumps the data map list as a text file")
fprintf(fp, "//\n\n");
static int offsEFlags = -1;
for ( int i = dict->m_Factories.First(); i != dict->m_Factories.InvalidIndex(); i = dict->m_Factories.Next( i ) )
{
IServerNetworkable *entity = dict->Create(dict->m_Factories.GetElementName(i));
@ -796,6 +797,8 @@ CON_COMMAND(sm_dump_datamaps, "Dumps the data map list as a text file")
UTIL_DrawDataTable(fp, pMap, 0);
if (offsEFlags == -1)
{
typedescription_t *datamap = gamehelpers->FindInDataMap(pMap, "m_iEFlags");
if (!datamap)
@ -803,7 +806,10 @@ CON_COMMAND(sm_dump_datamaps, "Dumps the data map list as a text file")
continue;
}
int *eflags = (int *)((char *)entity->GetBaseEntity() + GetTypeDescOffs(datamap));
offsEFlags = GetTypeDescOffs(datamap);
}
int *eflags = (int *)((char *)entity->GetBaseEntity() + offsEFlags);
*eflags |= (1<<0); // EFL_KILLME
}