2005-03-01 15:36:23 +00:00
|
|
|
#include "hash.h"
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2005-03-28 00:11:59 +00:00
|
|
|
#ifndef _WIN32
|
|
|
|
#ifndef stricmp
|
|
|
|
#define stricmp strcasecmp
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2008-05-14 18:06:58 +00:00
|
|
|
// hash init assumes we get clean memory
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
void Hash_InitTable(hashtable_t *table, unsigned int numbucks, void *mem)
|
2004-08-23 01:38:21 +00:00
|
|
|
{
|
|
|
|
table->numbuckets = numbucks;
|
|
|
|
table->bucket = (bucket_t **)mem;
|
|
|
|
}
|
|
|
|
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
unsigned int Hash_Key(const char *name, unsigned int modulus)
|
2004-08-23 01:38:21 +00:00
|
|
|
{ //fixme: optimize.
|
|
|
|
unsigned int key;
|
|
|
|
for (key=0;*name; name++)
|
|
|
|
key += ((key<<3) + (key>>28) + *name);
|
|
|
|
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
return (key%modulus);
|
2004-08-23 01:38:21 +00:00
|
|
|
}
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
unsigned int Hash_KeyInsensative(const char *name, unsigned int modulus)
|
2004-12-05 16:32:44 +00:00
|
|
|
{ //fixme: optimize.
|
|
|
|
unsigned int key;
|
|
|
|
for (key=0;*name; name++)
|
|
|
|
{
|
|
|
|
if (*name >= 'A' && *name <= 'Z')
|
|
|
|
key += ((key<<3) + (key>>28) + (*name-'A'+'a'));
|
|
|
|
else
|
|
|
|
key += ((key<<3) + (key>>28) + *name);
|
|
|
|
}
|
|
|
|
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
return (key%modulus);
|
2004-12-05 16:32:44 +00:00
|
|
|
}
|
2004-08-23 01:38:21 +00:00
|
|
|
|
2009-04-01 22:03:56 +00:00
|
|
|
void *Hash_Get(hashtable_t *table, const char *name)
|
2004-08-23 01:38:21 +00:00
|
|
|
{
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
unsigned int bucknum = Hash_Key(name, table->numbuckets);
|
2004-08-23 01:38:21 +00:00
|
|
|
bucket_t *buck;
|
|
|
|
|
|
|
|
buck = table->bucket[bucknum];
|
|
|
|
|
|
|
|
while(buck)
|
|
|
|
{
|
2007-09-17 20:35:39 +00:00
|
|
|
if (!STRCMP(name, buck->key.string))
|
2004-08-23 01:38:21 +00:00
|
|
|
return buck->data;
|
|
|
|
|
|
|
|
buck = buck->next;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
2009-04-01 22:03:56 +00:00
|
|
|
void *Hash_GetInsensative(hashtable_t *table, const char *name)
|
2004-12-05 16:32:44 +00:00
|
|
|
{
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
unsigned int bucknum = Hash_KeyInsensative(name, table->numbuckets);
|
2004-12-05 16:32:44 +00:00
|
|
|
bucket_t *buck;
|
|
|
|
|
|
|
|
buck = table->bucket[bucknum];
|
|
|
|
|
|
|
|
while(buck)
|
|
|
|
{
|
2007-09-17 20:35:39 +00:00
|
|
|
if (!stricmp(name, buck->key.string))
|
2004-12-05 16:32:44 +00:00
|
|
|
return buck->data;
|
|
|
|
|
|
|
|
buck = buck->next;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
2012-05-09 15:30:53 +00:00
|
|
|
void *Hash_GetInsensativeBucket(hashtable_t *table, const char *name)
|
|
|
|
{
|
|
|
|
unsigned int bucknum = Hash_KeyInsensative(name, table->numbuckets);
|
|
|
|
bucket_t *buck;
|
|
|
|
|
|
|
|
buck = table->bucket[bucknum];
|
|
|
|
|
|
|
|
while(buck)
|
|
|
|
{
|
|
|
|
if (!stricmp(name, buck->key.string))
|
|
|
|
return buck;
|
|
|
|
|
|
|
|
buck = buck->next;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
void *Hash_GetKey(hashtable_t *table, unsigned int key)
|
2004-08-23 01:38:21 +00:00
|
|
|
{
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
unsigned int bucknum = key%table->numbuckets;
|
2004-08-23 01:38:21 +00:00
|
|
|
bucket_t *buck;
|
|
|
|
|
|
|
|
buck = table->bucket[bucknum];
|
|
|
|
|
|
|
|
while(buck)
|
|
|
|
{
|
2007-09-17 20:35:39 +00:00
|
|
|
if (buck->key.value == key)
|
2004-08-23 01:38:21 +00:00
|
|
|
return buck->data;
|
|
|
|
|
|
|
|
buck = buck->next;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-08-28 17:14:38 +00:00
|
|
|
/*Does _NOT_ support items that are added with two names*/
|
|
|
|
void *Hash_GetNextKey(hashtable_t *table, unsigned int key, void *old)
|
|
|
|
{
|
|
|
|
unsigned int bucknum = key%table->numbuckets;
|
|
|
|
bucket_t *buck;
|
|
|
|
|
|
|
|
buck = table->bucket[bucknum];
|
|
|
|
|
|
|
|
while(buck)
|
|
|
|
{
|
|
|
|
if (buck->data == old) //found the old one
|
|
|
|
break;
|
|
|
|
buck = buck->next;
|
|
|
|
}
|
|
|
|
if (!buck)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
buck = buck->next;//don't return old
|
|
|
|
while(buck)
|
|
|
|
{
|
|
|
|
if (buck->key.value == key)
|
|
|
|
return buck->data;
|
|
|
|
|
|
|
|
buck = buck->next;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
/*Does _NOT_ support items that are added with two names*/
|
2010-07-11 10:53:13 +00:00
|
|
|
void *Hash_GetNext(hashtable_t *table, const char *name, void *old)
|
2004-08-23 01:38:21 +00:00
|
|
|
{
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
unsigned int bucknum = Hash_Key(name, table->numbuckets);
|
2004-08-23 01:38:21 +00:00
|
|
|
bucket_t *buck;
|
|
|
|
|
|
|
|
buck = table->bucket[bucknum];
|
|
|
|
|
|
|
|
while(buck)
|
|
|
|
{
|
2010-08-28 17:14:38 +00:00
|
|
|
if (buck->data == old) //found the old one
|
|
|
|
// if (!STRCMP(name, buck->key.string))
|
2004-08-23 01:38:21 +00:00
|
|
|
break;
|
|
|
|
buck = buck->next;
|
|
|
|
}
|
|
|
|
if (!buck)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
buck = buck->next;//don't return old
|
|
|
|
while(buck)
|
|
|
|
{
|
2007-09-17 20:35:39 +00:00
|
|
|
if (!STRCMP(name, buck->key.string))
|
2004-08-23 01:38:21 +00:00
|
|
|
return buck->data;
|
|
|
|
|
|
|
|
buck = buck->next;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
2010-08-28 17:14:38 +00:00
|
|
|
/*Does _NOT_ support items that are added with two names*/
|
2010-07-11 10:53:13 +00:00
|
|
|
void *Hash_GetNextInsensative(hashtable_t *table, const char *name, void *old)
|
2004-08-23 01:38:21 +00:00
|
|
|
{
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
unsigned int bucknum = Hash_KeyInsensative(name, table->numbuckets);
|
2005-02-09 19:32:30 +00:00
|
|
|
bucket_t *buck;
|
2004-08-23 01:38:21 +00:00
|
|
|
|
2005-02-09 19:32:30 +00:00
|
|
|
buck = table->bucket[bucknum];
|
2004-08-23 01:38:21 +00:00
|
|
|
|
2005-02-09 19:32:30 +00:00
|
|
|
while(buck)
|
|
|
|
{
|
2010-08-28 17:14:38 +00:00
|
|
|
if (buck->data == old) //found the old one
|
2005-02-09 19:32:30 +00:00
|
|
|
{
|
2010-08-28 17:14:38 +00:00
|
|
|
// if (!stricmp(name, buck->key.string))
|
2005-02-09 19:32:30 +00:00
|
|
|
break;
|
|
|
|
}
|
2004-08-23 01:38:21 +00:00
|
|
|
|
2005-02-09 19:32:30 +00:00
|
|
|
buck = buck->next;
|
|
|
|
}
|
|
|
|
if (!buck)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
buck = buck->next;//don't return old
|
|
|
|
while(buck)
|
|
|
|
{
|
2010-08-28 17:14:38 +00:00
|
|
|
if (!stricmp(name, buck->key.string))
|
2005-02-09 19:32:30 +00:00
|
|
|
return buck->data;
|
|
|
|
|
|
|
|
buck = buck->next;
|
|
|
|
}
|
|
|
|
return NULL;
|
2004-08-23 01:38:21 +00:00
|
|
|
}
|
2005-02-09 19:32:30 +00:00
|
|
|
|
|
|
|
|
2010-07-11 10:53:13 +00:00
|
|
|
void *Hash_Add(hashtable_t *table, const char *name, void *data, bucket_t *buck)
|
2004-08-23 01:38:21 +00:00
|
|
|
{
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
unsigned int bucknum = Hash_Key(name, table->numbuckets);
|
2004-08-23 01:38:21 +00:00
|
|
|
|
|
|
|
buck->data = data;
|
2007-09-17 20:35:39 +00:00
|
|
|
buck->key.string = name;
|
2004-08-23 01:38:21 +00:00
|
|
|
buck->next = table->bucket[bucknum];
|
|
|
|
table->bucket[bucknum] = buck;
|
|
|
|
|
|
|
|
return buck;
|
|
|
|
}
|
2010-07-11 10:53:13 +00:00
|
|
|
void *Hash_AddInsensative(hashtable_t *table, const char *name, void *data, bucket_t *buck)
|
2004-12-05 16:32:44 +00:00
|
|
|
{
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
unsigned int bucknum = Hash_KeyInsensative(name, table->numbuckets);
|
2004-12-05 16:32:44 +00:00
|
|
|
|
|
|
|
buck->data = data;
|
2007-09-17 20:35:39 +00:00
|
|
|
buck->key.string = name;
|
2004-12-05 16:32:44 +00:00
|
|
|
buck->next = table->bucket[bucknum];
|
|
|
|
table->bucket[bucknum] = buck;
|
|
|
|
|
|
|
|
return buck;
|
|
|
|
}
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
void *Hash_AddKey(hashtable_t *table, unsigned int key, void *data, bucket_t *buck)
|
2004-08-23 01:38:21 +00:00
|
|
|
{
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
unsigned int bucknum = key%table->numbuckets;
|
2004-08-23 01:38:21 +00:00
|
|
|
|
|
|
|
buck->data = data;
|
2007-09-17 20:35:39 +00:00
|
|
|
buck->key.value = key;
|
2004-08-23 01:38:21 +00:00
|
|
|
buck->next = table->bucket[bucknum];
|
|
|
|
table->bucket[bucknum] = buck;
|
|
|
|
|
|
|
|
return buck;
|
|
|
|
}
|
|
|
|
|
2010-07-11 10:53:13 +00:00
|
|
|
void Hash_Remove(hashtable_t *table, const char *name)
|
2004-08-23 01:38:21 +00:00
|
|
|
{
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
unsigned int bucknum = Hash_Key(name, table->numbuckets);
|
2004-08-23 01:38:21 +00:00
|
|
|
bucket_t *buck;
|
|
|
|
|
|
|
|
buck = table->bucket[bucknum];
|
|
|
|
|
2007-09-17 20:35:39 +00:00
|
|
|
if (!STRCMP(name, buck->key.string))
|
2004-08-23 01:38:21 +00:00
|
|
|
{
|
|
|
|
table->bucket[bucknum] = buck->next;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
while(buck->next)
|
|
|
|
{
|
2007-09-17 20:35:39 +00:00
|
|
|
if (!STRCMP(name, buck->next->key.string))
|
2004-08-23 01:38:21 +00:00
|
|
|
{
|
|
|
|
buck->next = buck->next->next;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
buck = buck->next;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-07-11 10:53:13 +00:00
|
|
|
void Hash_RemoveData(hashtable_t *table, const char *name, void *data)
|
2004-08-23 01:38:21 +00:00
|
|
|
{
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
unsigned int bucknum = Hash_Key(name, table->numbuckets);
|
2012-05-09 15:30:53 +00:00
|
|
|
bucket_t **link, *buck;
|
2004-08-23 01:38:21 +00:00
|
|
|
|
2012-05-09 15:30:53 +00:00
|
|
|
for (link = &table->bucket[bucknum]; *link; link = &(*link)->next)
|
|
|
|
{
|
|
|
|
buck = *link;
|
|
|
|
if (buck->data == data && !stricmp(name, buck->key.string))
|
2004-08-23 01:38:21 +00:00
|
|
|
{
|
2012-05-09 15:30:53 +00:00
|
|
|
*link = buck->next;
|
2004-08-23 01:38:21 +00:00
|
|
|
return;
|
|
|
|
}
|
2012-05-09 15:30:53 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
void Hash_RemoveBucket(hashtable_t *table, const char *name, bucket_t *data)
|
|
|
|
{
|
|
|
|
unsigned int bucknum = Hash_Key(name, table->numbuckets);
|
|
|
|
bucket_t **link, *buck;
|
2004-08-23 01:38:21 +00:00
|
|
|
|
2012-05-09 15:30:53 +00:00
|
|
|
for (link = &table->bucket[bucknum]; *link; link = &(*link)->next)
|
2004-08-23 01:38:21 +00:00
|
|
|
{
|
2012-05-09 15:30:53 +00:00
|
|
|
buck = *link;
|
|
|
|
if (buck == data && !stricmp(name, buck->key.string))
|
|
|
|
{
|
|
|
|
*link = buck->next;
|
|
|
|
return;
|
|
|
|
}
|
2004-08-23 01:38:21 +00:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
void Hash_RemoveKey(hashtable_t *table, unsigned int key)
|
2004-08-23 01:38:21 +00:00
|
|
|
{
|
Fixes, workarounds, and breakages. Hexen2 should work much better (-hexen2 says no mission pack, -portals says h2mp). Started working on splitting bigcoords per client, far too much work still to go on that. Removed gl_ztrick entirely. Enabled csprogs download by default. Added client support for fitzquake's 666 protocol, needs testing, some cleanup for dp protocols too, no server support, couldn't selectively enable it anyway. Now attempting to cache shadow meshes for explosions and stuff. Played with lightmaps a little, should potentially run a little faster on certain (intel?) cards. Tweeked npfte a little to try to avoid deadlocks and crashes. Fixed sky worldspawn parsing. Added h2mp's model format. Fixed baseline issue in q2 client, made servers generate q2 baselines. MOVETYPE_PUSH will not rotate extra if rotation is forced. Made status command show allowed client types. Changed lighting on weapons - should now be shaded.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3572 fc73d0e0-1445-4013-8a0c-d673dee63da5
2010-08-11 03:36:31 +00:00
|
|
|
unsigned int bucknum = key%table->numbuckets;
|
2004-08-23 01:38:21 +00:00
|
|
|
bucket_t *buck;
|
|
|
|
|
|
|
|
buck = table->bucket[bucknum];
|
|
|
|
|
2007-09-17 20:35:39 +00:00
|
|
|
if (buck->key.value == key)
|
2004-08-23 01:38:21 +00:00
|
|
|
{
|
|
|
|
table->bucket[bucknum] = buck->next;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
while(buck->next)
|
|
|
|
{
|
2007-09-17 20:35:39 +00:00
|
|
|
if (buck->next->key.value == key)
|
2004-08-23 01:38:21 +00:00
|
|
|
{
|
|
|
|
buck->next = buck->next->next;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
buck = buck->next;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|