File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -361,6 +361,7 @@ class CSendTablePrecalc
361361 int GetNumDataTableProxies () const ;
362362 void SetNumDataTableProxies ( int count );
363363
364+ void FillGModDataTableOffset ();
364365
365366public:
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
452456inline 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.
You can’t perform that action at this time.
0 commit comments