Fixed clientprefs prefab menu double free crash (
bug 5374, r=asherkin).
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_CGAMECONFIGS_H_
33 #define _INCLUDE_SOURCEMOD_CGAMECONFIGS_H_
35 #include <IGameConfigs.h>
36 #include <ITextParsers.h>
37 //#include <sh_list.h>
38 //#include "sm_trie.h"
39 //#include "sm_globals.h"
40 //#include "sm_memtable.h"
41 //#include "sm_trie_tpl.h"
42 //#include "ThreadSupport.h"
49 #define PLATFORM_MAX_PATH PATH_MAX
53 using namespace SourceMod;
54 //using namespace SourceHook;
59 #define PARSE_ERROR -1
62 bool operator()(char const *a, char const *b)
64 return std::strcmp(a, b) < 0;
94 void setName(const char *src)
97 name = new char[strlen(src)+1];
101 void setSymbol(const char *src)
104 symbol = new char[strlen(src)+1];
108 void setLin(int offs)
113 void setWin(int offs)
134 name = win = lin = NULL;
153 void setName(const char *src)
156 name = new char[strlen(src)+1];
160 void setWin(const char *src)
163 win = new char[strlen(src)+1];
167 void setLin(const char *src)
170 lin = new char[strlen(src)+1];
174 void setLib(const char *src)
176 if (stricmp(src, "server") == 0) lib = Server;
177 else if (stricmp(src, "engine") == 0) lib = Engine;
178 else lib = (Library)-1;
185 public ITextListener_SMC//,
186 // public IGameConfig
189 CGameConfig();//const char *file);//, const char *game, const char *engine);
192 bool Reparse(char *error, size_t maxlength);
193 bool EnterFile(const char *file, char *error, size_t maxlength);
194 list<Offset> GetOffsets();
196 public: //ITextListener_SMC
197 SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name);
198 SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value);
199 SMCResult ReadSMC_LeavingSection(const SMCStates *states);
200 public: //IGameConfig
201 const char *GetKeyValue(const char *key);
202 bool GetOffset(const char *key, int *value);
203 SendProp *GetSendProp(const char *key);
204 bool GetMemSig(const char *key, void **addr);
206 // void IncRefCount();
207 // unsigned int DecRefCount();
209 // bool DoesGameMatch(const char *value);
210 // bool DoesEngineMatch(const char *value);
212 // BaseStringTable *m_pStrings;
213 char m_File[PLATFORM_MAX_PATH];
214 char m_CurFile[PLATFORM_MAX_PATH];
215 list<Offset> m_Offsets;
217 map<const char*,const char*,cmp_str> m_Keys;
218 unsigned int m_RefCount;
221 unsigned int m_IgnoreLevel;
227 char m_gdcEngine[256];
228 bool bShouldBeReadingDefault;
234 /* Custom Sections */
235 unsigned int m_CustomLevel;
236 ITextListener_SMC *m_CustomHandler;
239 #endif //_INCLUDE_SOURCEMOD_CGAMECONFIGS_H_