aboutsummaryrefslogtreecommitdiff
path: root/mp/src/public/vstdlib
diff options
context:
space:
mode:
Diffstat (limited to 'mp/src/public/vstdlib')
-rw-r--r--mp/src/public/vstdlib/IKeyValuesSystem.h9
-rw-r--r--mp/src/public/vstdlib/random.h16
2 files changed, 23 insertions, 2 deletions
diff --git a/mp/src/public/vstdlib/IKeyValuesSystem.h b/mp/src/public/vstdlib/IKeyValuesSystem.h
index 1bd5a8ab..e999dd81 100644
--- a/mp/src/public/vstdlib/IKeyValuesSystem.h
+++ b/mp/src/public/vstdlib/IKeyValuesSystem.h
@@ -16,6 +16,9 @@
typedef int HKeySymbol;
#define INVALID_KEY_SYMBOL (-1)
+class IBaseFileSystem;
+class KeyValues;
+
//-----------------------------------------------------------------------------
// Purpose: Interface to shared data repository for KeyValues (included in vgui_controls.lib)
// allows for central data storage point of KeyValues symbol table
@@ -39,6 +42,12 @@ public:
// for debugging, adds KeyValues record into global list so we can track memory leaks
virtual void AddKeyValuesToMemoryLeakList(void *pMem, HKeySymbol name) = 0;
virtual void RemoveKeyValuesFromMemoryLeakList(void *pMem) = 0;
+
+ // maintain a cache of KeyValues we load from disk. This saves us quite a lot of time on app startup.
+ virtual void AddFileKeyValuesToCache( const KeyValues* _kv, const char *resourceName, const char *pathID ) = 0;
+ virtual bool LoadFileKeyValuesFromCache( KeyValues* _outKv, const char *resourceName, const char *pathID, IBaseFileSystem *filesystem ) const = 0;
+ virtual void InvalidateCache( ) = 0;
+ virtual void InvalidateCacheForFile( const char *resourceName, const char *pathID ) = 0;
};
VSTDLIB_INTERFACE IKeyValuesSystem *KeyValuesSystem();
diff --git a/mp/src/public/vstdlib/random.h b/mp/src/public/vstdlib/random.h
index 88188031..fdfd09c6 100644
--- a/mp/src/public/vstdlib/random.h
+++ b/mp/src/public/vstdlib/random.h
@@ -22,9 +22,11 @@
//-----------------------------------------------------------------------------
// A generator of uniformly distributed random numbers
//-----------------------------------------------------------------------------
-class IUniformRandomStream
+class VSTDLIB_CLASS IUniformRandomStream
{
public:
+ //virtual ~IUniformRandomStream() { }
+
// Sets the seed of the random number generator
virtual void SetSeed( int iSeed ) = 0;
@@ -86,7 +88,6 @@ private:
CThreadFastMutex m_mutex;
};
-
//-----------------------------------------------------------------------------
// A couple of convenience functions to access the library's global uniform stream
//-----------------------------------------------------------------------------
@@ -96,6 +97,17 @@ VSTDLIB_INTERFACE float RandomFloatExp( float flMinVal = 0.0f, float flMaxVal =
VSTDLIB_INTERFACE int RandomInt( int iMinVal, int iMaxVal );
VSTDLIB_INTERFACE float RandomGaussianFloat( float flMean = 0.0f, float flStdDev = 1.0f );
+//-----------------------------------------------------------------------------
+// IUniformRandomStream interface for free functions
+//-----------------------------------------------------------------------------
+class VSTDLIB_CLASS CDefaultUniformRandomStream : public IUniformRandomStream
+{
+public:
+ virtual void SetSeed( int iSeed ) OVERRIDE { RandomSeed( iSeed ); }
+ virtual float RandomFloat( float flMinVal, float flMaxVal ) OVERRIDE { return ::RandomFloat( flMinVal, flMaxVal ); }
+ virtual int RandomInt( int iMinVal, int iMaxVal ) OVERRIDE { return ::RandomInt( iMinVal, iMaxVal ); }
+ virtual float RandomFloatExp( float flMinVal, float flMaxVal, float flExponent ) OVERRIDE { return ::RandomFloatExp( flMinVal, flMaxVal, flExponent ); }
+};
//-----------------------------------------------------------------------------
// Installs a global random number generator, which will affect the Random functions above