aboutsummaryrefslogtreecommitdiff
path: root/engines/saga
diff options
context:
space:
mode:
authorTorbjörn Andersson2009-03-23 20:25:25 +0000
committerTorbjörn Andersson2009-03-23 20:25:25 +0000
commit1a0dea396d21c84b364b511759253a4b33c71bfc (patch)
tree64409579609dac951ce75d2e73179d8873376cf4 /engines/saga
parent9ed052f38e0786246b7184005420a045cf23d6e6 (diff)
downloadscummvm-rg350-1a0dea396d21c84b364b511759253a4b33c71bfc.tar.gz
scummvm-rg350-1a0dea396d21c84b364b511759253a4b33c71bfc.tar.bz2
scummvm-rg350-1a0dea396d21c84b364b511759253a4b33c71bfc.zip
Made the music and sound file names part of the class, instead of local
variables. This fixes another Valgrind warning when SndRes::load() tries to access the file names. (I could also have made the variables static, but I've never been very fond of static variables.) svn-id: r39641
Diffstat (limited to 'engines/saga')
-rw-r--r--engines/saga/resource.cpp10
-rw-r--r--engines/saga/resource.h2
2 files changed, 6 insertions, 6 deletions
diff --git a/engines/saga/resource.cpp b/engines/saga/resource.cpp
index 6ab4fc878e..9590a99272 100644
--- a/engines/saga/resource.cpp
+++ b/engines/saga/resource.cpp
@@ -197,8 +197,6 @@ bool Resource::loadContext(ResourceContext *context) {
bool Resource::createContexts() {
int i;
ResourceContext *context;
- char musicFileName[256];
- char soundFileName[256];
int soundFileIndex = 0;
int voicesFileIndex = 0;
bool digitalMusic = false;
@@ -288,7 +286,7 @@ bool Resource::createContexts() {
if (Common::File::exists(curSoundfiles[i].fileName)) {
_contextsCount++;
soundFileIndex = _contextsCount - 1;
- strcpy(soundFileName, curSoundfiles[i].fileName);
+ strcpy(_soundFileName, curSoundfiles[i].fileName);
compressedSounds = curSoundfiles[i].isCompressed;
fileFound = true;
break;
@@ -431,7 +429,7 @@ bool Resource::createContexts() {
digitalMusic = true;
compressedMusic = musicFilesITE[i].isCompressed;
fileFound = true;
- strcpy(musicFileName, musicFilesITE[i].fileName);
+ strcpy(_musicFileName, musicFilesITE[i].fileName);
break;
}
}
@@ -451,11 +449,11 @@ bool Resource::createContexts() {
// For ITE, add the digital music file and sfx file information here
if (_vm->getGameId() == GID_ITE && digitalMusic && i == _contextsCount - 1) {
- context->fileName = musicFileName;
+ context->fileName = _musicFileName;
context->fileType = GAME_DIGITALMUSICFILE;
context->isCompressed = compressedMusic;
} else if (!soundFileInArray && i == soundFileIndex) {
- context->fileName = soundFileName;
+ context->fileName = _soundFileName;
context->fileType = GAME_SOUNDFILE;
context->isCompressed = compressedSounds;
} else if (_vm->_voiceFilesExist && i == voicesFileIndex && !(_vm->getGameId() == GID_IHNM && _vm->isMacResources())) {
diff --git a/engines/saga/resource.h b/engines/saga/resource.h
index f861f0f52e..c3554cf7ce 100644
--- a/engines/saga/resource.h
+++ b/engines/saga/resource.h
@@ -158,6 +158,8 @@ protected:
ResourceContext *_contexts;
int _contextsCount;
char _voicesFileName[8][256];
+ char _musicFileName[256];
+ char _soundFileName[256];
bool loadContext(ResourceContext *context);
virtual bool loadMacContext(ResourceContext *context) = 0;