Changeset 627


Ignore:
Timestamp:
May 9, 2011, 9:21:51 PM (6 years ago)
Author:
sam
Message:

sdlport: make the SFX availability check more robust.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/sdlport/sound.cpp

    r617 r627  
    4444{
    4545    char *sfxdir, *datadir;
    46     FILE *fd = NULL;
     46    FILE *f = NULL;
    4747
    4848    // Disable sound if requested.
     
    5656    // Check for the sfx directory, disable sound if we can't find it.
    5757    datadir = get_filename_prefix();
    58     sfxdir = (char *)malloc( strlen( datadir ) + 5 + 1 );
    59     sprintf( sfxdir, "%s/sfx/", datadir );
    60     if( (fd = fopen( sfxdir,"r" )) == NULL )
     58    sfxdir = (char *)malloc(strlen(datadir) + 5 + 1);
     59    sprintf(sfxdir, "%s/sfx/ambcave1.wav", datadir);
     60    FILE *f = fopen(sfxdir, "r");
     61    if (!f)
    6162    {
    6263        // Didn't find the directory, so disable sound.
     
    6465        return 0;
    6566    }
    66     free( sfxdir );
     67    fclose(f);
     68    free(sfxdir);
    6769
    6870    if (Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 128) < 0)
Note: See TracChangeset for help on using the changeset viewer.