Skip to content

Commit a5c19ef

Browse files
committed
sourcesdk: Update CSendTablePrecalc with my proposed change
1 parent 4d5a730 commit a5c19ef

File tree

1 file changed

+20
-1
lines changed
  • source/sourcesdk

1 file changed

+20
-1
lines changed

source/sourcesdk/dt.h

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ class CSendTablePrecalc
361361
int GetNumDataTableProxies() const;
362362
void SetNumDataTableProxies( int count );
363363

364+
void FillGModDataTableOffset();
364365

365366
public:
366367

@@ -410,6 +411,9 @@ class CSendTablePrecalc
410411

411412
// Map prop offsets to indices for properties that can use it.
412413
CUtlMap<unsigned short, unsigned short> m_PropOffsetToIndexMap;
414+
415+
// Gmod specific, we calculate it once to avoid doing it in expensive code!
416+
int m_nGMODDataTableOffset = -1;
413417
};
414418

415419

@@ -452,8 +456,23 @@ inline int CSendTablePrecalc::GetNumDataTableProxies() const
452456
inline void CSendTablePrecalc::SetNumDataTableProxies( int count )
453457
{
454458
m_nDataTableProxies = count;
455-
}
459+
}
456460

461+
inline void CSendTablePrecalc::FillGModDataTableOffset()
462+
{
463+
if (GetNumProps() > 0)
464+
{
465+
for (int i=0; i<GetNumProps(); ++i)
466+
{
467+
const SendProp* pProp = GetProp(i);
468+
if (pProp->GetType() != DPT_GMODTable)
469+
continue;
470+
471+
m_nGMODDataTableOffset = pProp->GetOffset();
472+
break;
473+
}
474+
}
475+
}
457476

458477
// ------------------------------------------------------------------------ //
459478
// Helpers.

0 commit comments

Comments
 (0)