1.1 --- a/core/ConVarManager.h Sat Apr 14 04:19:58 2007 +0000
1.2 +++ b/core/ConVarManager.h Sat Apr 14 04:27:47 2007 +0000
1.3 @@ -33,10 +33,20 @@
1.4 {
1.5 Handle_t handle; /**< Handle to convar */
1.6 bool sourceMod; /**< Determines whether or not convar was created by a SourceMod plugin */
1.7 - IChangeableForward *changeForward; /**< Forward associated with convar */
1.8 + IChangeableForward *pChangeForward; /**< Forward associated with convar */
1.9 FnChangeCallback origCallback; /**< The original callback function */
1.10 };
1.11
1.12 +/**
1.13 + * Holds information about a client convar query
1.14 + */
1.15 +struct ConVarQuery
1.16 +{
1.17 + QueryCvarCookie_t cookie; /**< Cookie that identifies query */
1.18 + IPluginFunction *pCallback; /**< Function that will be called when query is finished */
1.19 + cell_t value; /**< Optional value passed to query function */
1.20 +};
1.21 +
1.22 class ConVarManager :
1.23 public SMGlobalClass,
1.24 public IHandleTypeDispatch,
1.25 @@ -49,6 +59,7 @@
1.26 public: // SMGlobalClass
1.27 void OnSourceModAllInitialized();
1.28 void OnSourceModShutdown();
1.29 + void OnSourceModVSPReceived(IServerPluginCallbacks *iface);
1.30 public: // IHandleTypeDispatch
1.31 void OnHandleDestroy(HandleType_t type, void *object);
1.32 public: // IPluginsListener
1.33 @@ -92,6 +103,12 @@
1.34 * Remove a function from the forward that will be called when the specified convar changes.
1.35 */
1.36 void UnhookConVarChange(ConVar *pConVar, IPluginFunction *pFunction);
1.37 +
1.38 + /**
1.39 + * Starts a query to find the value of a client convar.
1.40 + */
1.41 + QueryCvarCookie_t QueryClientConVar(edict_t *pPlayer, const char *name, IPluginFunction *pCallback,
1.42 + Handle_t hndl);
1.43 private:
1.44 /**
1.45 * Adds a convar to a plugin's list.
1.46 @@ -99,13 +116,22 @@
1.47 static void AddConVarToPluginList(IPluginContext *pContext, const ConVar *pConVar);
1.48
1.49 /**
1.50 - * Static callback that Valve's ConVar class executes when the convar's value changes.
1.51 + * Static callback that Valve's ConVar object executes when the convar's value changes.
1.52 */
1.53 static void OnConVarChanged(ConVar *pConVar, const char *oldValue);
1.54 +
1.55 + /**
1.56 + * Callback for when StartQueryCvarValue() has finished.
1.57 + */
1.58 + void OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *pPlayer, EQueryCvarValueStatus result,
1.59 + const char *cvarName, const char *cvarValue);
1.60 private:
1.61 HandleType_t m_ConVarType;
1.62 List<ConVarInfo *> m_ConVars;
1.63 + List<ConVarQuery> m_ConVarQueries;
1.64 Trie *m_ConVarCache;
1.65 + IServerPluginCallbacks *m_VSPIface;
1.66 + bool m_CanQueryConVars;
1.67 };
1.68
1.69 extern ConVarManager g_ConVarManager;