Do not complain about missing music files in the PAK file.

This commit is contained in:
Guus Sliepen 2012-02-26 22:22:27 +01:00
parent fdd63c14cc
commit 230620a1f1
3 changed files with 9 additions and 3 deletions

View File

@ -81,7 +81,8 @@ void loadMusic(const char *filename)
Mix_FreeMusic(engine.music); Mix_FreeMusic(engine.music);
#if USEPACK #if USEPACK
unpack(filename, PAK_MOD); if(!unpack(filename, PAK_MOD))
return;
char musicFilename[PATH_MAX]; char musicFilename[PATH_MAX];
strcpy(musicFilename, ""); strcpy(musicFilename, "");

View File

@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Searches the pak file for the required data. When Searches the pak file for the required data. When
it is found, the data is read into a character buffer. it is found, the data is read into a character buffer.
*/ */
void unpack(const char *file, signed char fileType) bool unpack(const char *file, signed char fileType)
{ {
unsigned char *packBuffer; unsigned char *packBuffer;
char packFilename[60]; char packFilename[60];
@ -49,6 +49,10 @@ void unpack(const char *file, signed char fileType)
if (!fread(packFilename, 1, 56, pak)) if (!fread(packFilename, 1, 56, pak))
{ {
fclose(pak); fclose(pak);
if (fileType == PAK_MOD || fileType == PAK_S3M)
return false;
if (fileType != PAK_FONT) if (fileType != PAK_FONT)
{ {
showErrorAndExit(0, file); showErrorAndExit(0, file);
@ -97,6 +101,7 @@ void unpack(const char *file, signed char fileType)
engine.sdlrw = SDL_RWFromMem(packBuffer, packFSize); engine.sdlrw = SDL_RWFromMem(packBuffer, packFSize);
fclose(pak); fclose(pak);
return true;
} }
/* /*

View File

@ -18,5 +18,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
extern void unpack(const char *file, signed char fileType); extern bool unpack(const char *file, signed char fileType);
extern int locateDataInPak(const char *file, bool required); extern int locateDataInPak(const char *file, bool required);