diff options
| author | John Schoenick <[email protected]> | 2015-09-09 18:35:41 -0700 |
|---|---|---|
| committer | John Schoenick <[email protected]> | 2015-09-09 18:35:41 -0700 |
| commit | 0d8dceea4310fde5706b3ce1c70609d72a38efdf (patch) | |
| tree | c831ef32c2c801a5c5a80401736b52c7b5a528ec /mp/src/game/shared/util_shared.h | |
| parent | Updated the SDK with the latest code from the TF and HL2 branches. (diff) | |
| download | source-sdk-2013-0d8dceea4310fde5706b3ce1c70609d72a38efdf.tar.xz source-sdk-2013-0d8dceea4310fde5706b3ce1c70609d72a38efdf.zip | |
Diffstat (limited to 'mp/src/game/shared/util_shared.h')
| -rw-r--r-- | mp/src/game/shared/util_shared.h | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/mp/src/game/shared/util_shared.h b/mp/src/game/shared/util_shared.h index 18f066c3..83793418 100644 --- a/mp/src/game/shared/util_shared.h +++ b/mp/src/game/shared/util_shared.h @@ -441,8 +441,8 @@ inline float DistanceToRay( const Vector &pos, const Vector &rayStart, const Vec public: \ interfaceName( bool bAutoAdd = true ); \ virtual ~interfaceName(); \ - static void Add( interfaceName *pElement ) { m_##interfaceName##AutoList.AddToTail( pElement ); } \ - static void Remove( interfaceName *pElement ) { m_##interfaceName##AutoList.FindAndFastRemove( pElement ); } \ + static void AddToAutoList( interfaceName *pElement ) { m_##interfaceName##AutoList.AddToTail( pElement ); } \ + static void RemoveFromAutoList( interfaceName *pElement ) { m_##interfaceName##AutoList.FindAndFastRemove( pElement ); } \ static const CUtlVector< interfaceName* >& AutoList( void ) { return m_##interfaceName##AutoList; } \ private: \ static CUtlVector< interfaceName* > m_##interfaceName##AutoList; \ @@ -456,14 +456,28 @@ inline float DistanceToRay( const Vector &pos, const Vector &rayStart, const Vec { \ if ( bAutoAdd ) \ { \ - Add( this ); \ + AddToAutoList( this ); \ } \ } \ interfaceName::~interfaceName() \ { \ - Remove( this ); \ + RemoveFromAutoList( this ); \ } +//-------------------------------------------------------------------------------------------------------------- +// This would do the same thing without requiring casts all over the place. Yes, it's a template, but +// DECLARE_AUTO_LIST requires a CUtlVector<T> anyway. TODO ask about replacing the macros with this. +//template<class T> +//class AutoList { +//public: +// typedef CUtlVector<T*> AutoListType; +// static AutoListType& All() { return m_autolist; } +//protected: +// AutoList() { m_autolist.AddToTail(static_cast<T*>(this)); } +// virtual ~AutoList() { m_autolist.FindAndFastRemove(static_cast<T*>(this)); } +//private: +// static AutoListType m_autolist; +//}; //-------------------------------------------------------------------------------------------------------------- /** @@ -579,7 +593,15 @@ public: private: float m_duration; float m_timestamp; - float Now( void ) const; // work-around since client header doesn't like inlined gpGlobals->curtime + virtual float Now( void ) const; // work-around since client header doesn't like inlined gpGlobals->curtime +}; + +class RealTimeCountdownTimer : public CountdownTimer +{ + virtual float Now( void ) const OVERRIDE + { + return Plat_FloatTime(); + } }; char* ReadAndAllocStringValue( KeyValues *pSub, const char *pName, const char *pFilename = NULL ); |