Switch ClientPrefs off KTrie (bug 5884 part 15, r=ds).
This commit is contained in:
		
							parent
							
								
									bc51c3e5b1
								
							
						
					
					
						commit
						8e99b342a4
					
				| @ -1,5 +1,5 @@ | ||||
| /**
 | ||||
|  * vim: set ts=4 : | ||||
|  * vim: set ts=4 sw=4 tw=99 noet : | ||||
|  * ============================================================================= | ||||
|  * SourceMod | ||||
|  * Copyright (C) 2004-2008 AlliedModders LLC.  All rights reserved. | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| /**
 | ||||
|  * vim: set ts=4 : | ||||
|  * vim: set ts=4 sw=4 tw=99 noet : | ||||
|  * ============================================================================= | ||||
|  * SourceMod | ||||
|  * Copyright (C) 2004-2008 AlliedModders LLC.  All rights reserved. | ||||
|  | ||||
| @ -67,12 +67,10 @@ void CookieManager::Unload() | ||||
| 
 | ||||
| Cookie *CookieManager::FindCookie(const char *name) | ||||
| { | ||||
| 	Cookie **pCookie = cookieTrie.retrieve(name); | ||||
| 
 | ||||
| 	if (pCookie == NULL) | ||||
| 	Cookie *cookie; | ||||
| 	if (!cookieFinder.retrieve(name, &cookie)) | ||||
| 		return NULL; | ||||
| 
 | ||||
| 	return *pCookie; | ||||
| 	return cookie; | ||||
| } | ||||
| 
 | ||||
| Cookie *CookieManager::CreateCookie(const char *name, const char *description, CookieAccess access) | ||||
| @ -96,7 +94,7 @@ Cookie *CookieManager::CreateCookie(const char *name, const char *description, C | ||||
| 	TQueryOp *op = new TQueryOp(Query_InsertCookie, pCookie); | ||||
| 	op->m_params.cookie = pCookie; | ||||
| 	 | ||||
| 	cookieTrie.insert(name, pCookie); | ||||
| 	cookieFinder.insert(name, pCookie); | ||||
| 	cookieList.push_back(pCookie); | ||||
| 
 | ||||
| 	g_ClientPrefs.AddQueryToQueue(op); | ||||
|  | ||||
| @ -1,5 +1,5 @@ | ||||
| /**
 | ||||
|  * vim: set ts=4 : | ||||
|  * vim: set ts=4 sw=4 tw=99 noet : | ||||
|  * ============================================================================= | ||||
|  * SourceMod Client Preferences Extension | ||||
|  * Copyright (C) 2004-2008 AlliedModders LLC.  All rights reserved. | ||||
| @ -34,8 +34,7 @@ | ||||
| 
 | ||||
| #include "extension.h" | ||||
| #include "sh_list.h" | ||||
| #include "sm_trie_tpl.h" | ||||
| 
 | ||||
| #include <sm_namehashset.h> | ||||
| 
 | ||||
| #define MAX_NAME_LENGTH 30 | ||||
| #define MAX_DESC_LENGTH 255 | ||||
| @ -92,6 +91,11 @@ struct Cookie | ||||
| 	int dbid; | ||||
| 	CookieData *data[MAXCLIENTS+1]; | ||||
| 	CookieAccess access; | ||||
| 
 | ||||
| 	static inline bool matches(const char *name, const Cookie *cookie) | ||||
| 	{ | ||||
| 		return strcmp(name, cookie->name) == 0; | ||||
| 	} | ||||
| }; | ||||
| 
 | ||||
| class CookieManager : public IClientListener, public IPluginsListener | ||||
| @ -128,7 +132,7 @@ public: | ||||
| 	IBaseMenu *clientMenu; | ||||
| 
 | ||||
| private: | ||||
| 	KTrie<Cookie *> cookieTrie; | ||||
| 	NameHashSet<Cookie *> cookieFinder; | ||||
| 	SourceHook::List<CookieData *> clientData[MAXCLIENTS+1]; | ||||
| 
 | ||||
| 	bool connected[MAXCLIENTS+1]; | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user