Added example scripts missing from last commit (NPOTB).
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>
39 //#include "sm_globals.h"
40 #include "sm_memtable.h"
41 #include "sm_trie_tpl.h"
42 //#include "ThreadSupport.h"
51 #define PLATFORM_MAX_PATH PATH_MAX
55 using namespace SourceMod;
56 //using namespace SourceHook;
61 #define PARSE_ERROR -1
64 bool operator()(char const *a, char const *b)
66 return std::strcmp(a, b) < 0;
96 void setName(const char *src)
99 name = new char[strlen(src)+1];
103 void setSymbol(const char *src)
106 symbol = new char[strlen(src)+1];
110 void setLin(int offs)
115 void setWin(int offs)
136 name = win = lin = NULL;
155 void setName(const char *src)
158 name = new char[strlen(src)+1];
162 void setWin(const char *src)
165 win = new char[strlen(src)+1];
169 void setLin(const char *src)
172 lin = new char[strlen(src)+1];
176 void setLib(const char *src)
178 if (stricmp(src, "server") == 0) lib = Server;
179 else if (stricmp(src, "engine") == 0) lib = Engine;
180 else lib = (Library)-1;
187 public ITextListener_SMC//,
188 // public IGameConfig
191 CGameConfig();//const char *file);//, const char *game, const char *engine);
194 bool Reparse(char *error, size_t maxlength);
195 bool EnterFile(const char *file, char *error, size_t maxlength);
196 list<Offset> GetOffsets();
198 public: //ITextListener_SMC
199 SMCResult ReadSMC_NewSection(const SMCStates *states, const char *name);
200 SMCResult ReadSMC_KeyValue(const SMCStates *states, const char *key, const char *value);
201 SMCResult ReadSMC_LeavingSection(const SMCStates *states);
202 public: //IGameConfig
203 const char *GetKeyValue(const char *key);
204 bool GetOffset(const char *key, int *value);
205 SendProp *GetSendProp(const char *key);
206 bool GetMemSig(const char *key, void **addr);
208 // void IncRefCount();
209 // unsigned int DecRefCount();
211 // bool DoesGameMatch(const char *value);
212 // bool DoesEngineMatch(const char *value);
214 BaseStringTable *m_pStrings;
215 char m_File[PLATFORM_MAX_PATH];
216 char m_CurFile[PLATFORM_MAX_PATH];
217 list<Offset> m_Offsets;
219 // map<const char*,const char*,cmp_str> m_Keys;
221 unsigned int m_RefCount;
224 unsigned int m_IgnoreLevel;
230 char m_gdcEngine[256];
231 bool bShouldBeReadingDefault;
237 /* Custom Sections */
238 unsigned int m_CustomLevel;
239 ITextListener_SMC *m_CustomHandler;
242 #endif //_INCLUDE_SOURCEMOD_CGAMECONFIGS_H_