Update CS:GO team score gamedata.
2 * vim: set ts=4 sw=4 tw=99 noet :
3 * =============================================================================
5 * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved.
6 * =============================================================================
8 * This program is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU General Public License, version 3.0, as published by the
10 * Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 * You should have received a copy of the GNU General Public License along with
18 * this program. If not, see <http://www.gnu.org/licenses/>.
20 * As a special exception, AlliedModders LLC gives you permission to link the
21 * code of this program (as well as its derivative works) to "Half-Life 2," the
22 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
23 * by the Valve Corporation. You must obey the GNU General Public License in
24 * all respects for all other code used. Additionally, AlliedModders LLC grants
25 * this exception to all derivative works. AlliedModders LLC defines further
26 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
27 * or <http://www.sourcemod.net/license.php>.
32 #ifndef _INCLUDE_SOURCEMOD_CONVARMANAGER_H_
33 #define _INCLUDE_SOURCEMOD_CONVARMANAGER_H_
35 #include "sm_globals.h"
36 #include "sourcemm_api.h"
38 #include <IPluginSys.h>
39 #include <IForwardSys.h>
40 #include <IHandleSys.h>
41 #include <IRootConsoleMenu.h>
42 #include <IPlayerHelpers.h>
43 #include <compat_wrappers.h>
44 #include "concmd_cleaner.h"
45 #include "PlayerManager.h"
47 #if SOURCE_ENGINE == SE_DARKMESSIAH
48 class EQueryCvarValueStatus;
49 typedef int QueryCvarCookie_t;
52 using namespace SourceHook;
54 class IConVarChangeListener
57 virtual void OnConVarChanged(ConVar *pConVar, const char *oldValue, float flOldValue) =0;
61 * Holds SourceMod-specific information about a convar
65 Handle_t handle; /**< Handle to self */
66 bool sourceMod; /**< Determines whether or not convar was created by a SourceMod plugin */
67 IChangeableForward *pChangeForward; /**< Forward associated with convar */
68 ConVar *pVar; /**< The actual convar */
69 List<IConVarChangeListener *> changeListeners;
71 static inline bool matches(const char *name, const ConVarInfo *info)
73 return strcmp(name, info->pVar->GetName()) == 0;
78 * Holds information about a client convar query
82 QueryCvarCookie_t cookie; /**< Cookie that identifies query */
83 IPluginFunction *pCallback; /**< Function that will be called when query is finished */
84 cell_t value; /**< Optional value passed to query function */
85 cell_t client; /**< Only used for cleaning up on client disconnection */
90 public IHandleTypeDispatch,
91 public IPluginsListener,
92 public IRootConsoleCommand,
93 public IConCommandTracker,
94 public IClientListener
99 public: // SMGlobalClass
100 void OnSourceModStartup(bool late);
101 void OnSourceModAllInitialized();
102 void OnSourceModShutdown();
103 void OnSourceModVSPReceived();
104 public: // IHandleTypeDispatch
105 void OnHandleDestroy(HandleType_t type, void *object);
106 bool GetHandleApproxSize(HandleType_t type, void *object, unsigned int *pSize);
107 public: // IPluginsListener
108 void OnPluginUnloaded(IPlugin *plugin);
109 public: //IRootConsoleCommand
110 void OnRootConsoleCommand(const char *cmdname, const CCommand &command);
111 public: //IConCommandTracker
112 void OnUnlinkConCommandBase(ConCommandBase *pBase, const char *name, bool is_read_safe);
113 public: //IClientListener
114 void OnClientDisconnected(int client);
117 * Create a convar and return a handle to it.
119 Handle_t CreateConVar(IPluginContext *pContext, const char *name, const char *defaultVal,
120 const char *description, int flags, bool hasMin, float min, bool hasMax, float max);
123 * Searches for a convar and returns a handle to it
125 Handle_t FindConVar(const char* name);
128 * Add a function to call when the specified convar changes.
130 void HookConVarChange(ConVar *pConVar, IPluginFunction *pFunction);
133 * Remove a function from the forward that will be called when the specified convar changes.
135 void UnhookConVarChange(ConVar *pConVar, IPluginFunction *pFunction);
137 void AddConVarChangeListener(const char *name, IConVarChangeListener *pListener);
138 void RemoveConVarChangeListener(const char *name, IConVarChangeListener *pListener);
141 * Starts a query to find the value of a client convar.
143 QueryCvarCookie_t QueryClientConVar(edict_t *pPlayer, const char *name, IPluginFunction *pCallback,
146 bool IsQueryingSupported();
148 HandleError ReadConVarHandle(Handle_t hndl, ConVar **pVar);
152 * Adds a convar to a plugin's list.
154 static void AddConVarToPluginList(IPluginContext *pContext, const ConVar *pConVar);
157 * Static callback that Valve's ConVar object executes when the convar's value changes.
159 #if SOURCE_ENGINE >= SE_ORANGEBOX
160 static void OnConVarChanged(ConVar *pConVar, const char *oldValue, float flOldValue);
162 static void OnConVarChanged(ConVar *pConVar, const char *oldValue);
166 * Callback for when StartQueryCvarValue() has finished.
168 #if SOURCE_ENGINE == SE_DOTA
169 void OnQueryCvarValueFinished(QueryCvarCookie_t cookie, CEntityIndex player, EQueryCvarValueStatus result,
170 const char *cvarName, const char *cvarValue);
171 #elif SOURCE_ENGINE != SE_DARKMESSIAH
172 void OnQueryCvarValueFinished(QueryCvarCookie_t cookie, edict_t *pPlayer, EQueryCvarValueStatus result,
173 const char *cvarName, const char *cvarValue);
176 HandleType_t m_ConVarType;
177 List<ConVarInfo *> m_ConVars;
178 List<ConVarQuery> m_ConVarQueries;
179 bool m_bIsDLLQueryHooked;
180 bool m_bIsVSPQueryHooked;
183 extern ConVarManager g_ConVarManager;
185 #endif // _INCLUDE_SOURCEMOD_CONVARMANAGER_H_