From ec716f0c58addf825043e9e2533c295f11302ea8 Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Tue, 19 Mar 2013 11:24:01 -0400 Subject: [PATCH] Cache m_iEFlags offset for datamaps dump instead of getting for each ent (bug 5657, r=asherkin). --- extensions/sdktools/vhelpers.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/extensions/sdktools/vhelpers.cpp b/extensions/sdktools/vhelpers.cpp index c18b26e4..39b53642 100644 --- a/extensions/sdktools/vhelpers.cpp +++ b/extensions/sdktools/vhelpers.cpp @@ -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,14 +797,19 @@ CON_COMMAND(sm_dump_datamaps, "Dumps the data map list as a text file") UTIL_DrawDataTable(fp, pMap, 0); - typedescription_t *datamap = gamehelpers->FindInDataMap(pMap, "m_iEFlags"); - - if (!datamap) + if (offsEFlags == -1) { - continue; + typedescription_t *datamap = gamehelpers->FindInDataMap(pMap, "m_iEFlags"); + + if (!datamap) + { + continue; + } + + offsEFlags = GetTypeDescOffs(datamap); } - int *eflags = (int *)((char *)entity->GetBaseEntity() + GetTypeDescOffs(datamap)); + int *eflags = (int *)((char *)entity->GetBaseEntity() + offsEFlags); *eflags |= (1<<0); // EFL_KILLME }