engine: server: sv_init: compiling error fix & minor cleanup

This commit is contained in:
SNMetamorph 2023-03-19 00:05:52 +04:00 committed by Alibek Omarov
parent a03019f5e4
commit eac8c116a8
1 changed files with 4 additions and 3 deletions

View File

@ -278,7 +278,7 @@ model_t *SV_ModelHandle( int modelindex )
static resourcetype_t SV_DetermineResourceType( const char *filename )
{
if( !Q_strncmp( filename, "sound/", 6 ) && Sound_SupportedFileFormat( COM_FileExtension( filename )))
if( !Q_strncmp( filename, DEFAULT_SOUNDPATH, sizeof( DEFAULT_SOUNDPATH ) - 1 ) && Sound_SupportedFileFormat( COM_FileExtension( filename )))
return t_sound;
else
return t_generic;
@ -289,6 +289,7 @@ void SV_ReadResourceList( const char *filename )
string token;
byte *afile;
char *pfile;
resourcetype_t restype;
afile = FS_LoadFile( filename, NULL, false );
if( !afile ) return;
@ -304,7 +305,7 @@ void SV_ReadResourceList( const char *filename )
continue;
COM_FixSlashes( token );
resourcetype_t restype = SV_DetermineResourceType( token );
restype = SV_DetermineResourceType( token );
Con_DPrintf( " %s (%s)\n", token, COM_GetResourceTypeName( restype ));
switch( restype )
{
@ -312,7 +313,7 @@ void SV_ReadResourceList( const char *filename )
case t_sound:
{
const char *filepath = token;
filepath += 6; // skip "sound/" part
filepath += sizeof( DEFAULT_SOUNDPATH ) - 1; // skip "sound/" part
SV_SoundIndex( filepath );
break;
}