DRAGONS: Fix Format Truncation GCC Compiler Warnings

This commit is contained in:
D G Turner 2023-02-14 23:48:06 +00:00
parent 588cf4b52c
commit b7831c7755

View File

@ -510,26 +510,24 @@ void SoundManager::stopAllVoices() {
}
void SoundManager::playMusic(int16 song) {
char sceneName[5] = "nnnn";
char filename[12] = "xxxxznn.msq";
if (_currentSong == song) {
return;
}
_currentSong = song;
memcpy(sceneName, _vm->_dragonRMS->getSceneName(_vm->getCurrentSceneId()), 4);
snprintf(filename, 12, "%sz%02d.msq", sceneName, song);
debug(1, "Load music file %s", filename);
// Music filenames have format "xxxxznn.msq" where xxxx is the four character scene name and nn is the two digit song number
Common::String filename = Common::String(_vm->_dragonRMS->getSceneName(_vm->getCurrentSceneId()), 4);
filename += Common::String::format("z%02d.msq", song);
debug(1, "Load music file %s", filename.c_str());
if (!_bigFileArchive->doesFileExist(filename)) {
warning("Could not find music file %s", filename);
if (!_bigFileArchive->doesFileExist(filename.c_str())) {
warning("Could not find music file %s", filename.c_str());
return;
}
uint32 dataSize;
byte *seqData = _bigFileArchive->load(filename, dataSize);
byte *seqData = _bigFileArchive->load(filename.c_str(), dataSize);
Common::MemoryReadStream *seq = new Common::MemoryReadStream(seqData, dataSize, DisposeAfterUse::YES);
_midiPlayer->playSong(seq);
delete seq;