mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-02-19 20:12:01 +00:00
musicdef_t: Add hash field
Slight optimisation for S_FindMusicDef, but will net us some big wins with our next feature.
This commit is contained in:
parent
7868f21dd0
commit
cb4d9b527e
2 changed files with 11 additions and 7 deletions
|
|
@ -1368,16 +1368,18 @@ struct cursongcredit cursongcredit; // Currently displayed song credit info
|
|||
//
|
||||
musicdef_t *S_FindMusicDef(const char *name)
|
||||
{
|
||||
musicdef_t *def = musicdefstart;
|
||||
UINT32 hash = quickncasehash (name, 6);
|
||||
musicdef_t *def;
|
||||
|
||||
while (def)
|
||||
for (def = musicdefstart; def; def = def->next)
|
||||
{
|
||||
if (!stricmp(def->name, name))
|
||||
{
|
||||
return def;
|
||||
}
|
||||
if (hash != def->hash)
|
||||
continue;
|
||||
|
||||
def = def->next;
|
||||
if (stricmp(def->name, name))
|
||||
continue;
|
||||
|
||||
return def;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
|
@ -1439,6 +1441,7 @@ ReadMusicDefFields
|
|||
|
||||
STRBUFCPY(def->name, value);
|
||||
strlwr(def->name);
|
||||
def->hash = quickncasehash (def->name, 6);
|
||||
def->volume = DEFAULT_MUSICDEF_VOLUME;
|
||||
|
||||
def->next = musicdefstart;
|
||||
|
|
|
|||
|
|
@ -178,6 +178,7 @@ boolean S_SpeedMusic(float speed);
|
|||
struct musicdef_t
|
||||
{
|
||||
char name[7];
|
||||
UINT32 hash;
|
||||
char *title;
|
||||
char *author;
|
||||
char *source;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue