free slot and return NULL when it can't open bundle file

svn-id: r13612
This commit is contained in:
Paweł Kołodziejski 2004-04-24 15:33:36 +00:00
parent 14f74bb568
commit e369538e34

View File

@ -307,6 +307,10 @@ ImuseDigiSndMgr::soundStruct *ImuseDigiSndMgr::openSound(int32 soundId, const ch
result = openMusicBundle(slot);
else
error("ImuseDigiSndMgr::openSound() Don't know how load sound: %d", soundId);
if (!result) {
closeSound(&_sounds[slot]);
return NULL;
}
_sounds[slot].bundle->decompressSampleByIndex(soundId, 0, 0x2000, &ptr, 0, header_outside);
_sounds[slot].soundId = soundId;
_sounds[slot].type = soundType;
@ -323,6 +327,10 @@ ImuseDigiSndMgr::soundStruct *ImuseDigiSndMgr::openSound(int32 soundId, const ch
result = openMusicBundle(slot);
else
error("ImuseDigiSndMgr::openSound() Don't know how load sound: %d", soundId);
if (!result) {
closeSound(&_sounds[slot]);
return NULL;
}
_sounds[slot].bundle->decompressSampleByName(soundName, 0, 0x2000, &ptr, header_outside);
strcpy(_sounds[slot].name, soundName);
_sounds[slot].soundId = soundId;