aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2003-06-21 15:53:27 +0000
committerMax Horn2003-06-21 15:53:27 +0000
commit2b580871c2ab89e2116a384dfb12f6a4758dac38 (patch)
treec7e03e0f4a4874ddd2aac2eaecff11adf0d70737
parentceb1005f6cc4ff1860167810aacf51ae94d2d187 (diff)
downloadscummvm-rg350-2b580871c2ab89e2116a384dfb12f6a4758dac38.tar.gz
scummvm-rg350-2b580871c2ab89e2116a384dfb12f6a4758dac38.tar.bz2
scummvm-rg350-2b580871c2ab89e2116a384dfb12f6a4758dac38.zip
delete _sound when SimonState is destroyed; fix leak & enian bug in playSting (but somebody please test that, I don't have simon1dos)
svn-id: r8582
-rw-r--r--simon/simon.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/simon/simon.cpp b/simon/simon.cpp
index 05319d679d..8e0ebba88c 100644
--- a/simon/simon.cpp
+++ b/simon/simon.cpp
@@ -458,6 +458,8 @@ SimonEngine::~SimonEngine() {
delete _dummy_item_3;
delete [] _fcs_list;
+
+ delete _sound;
}
void SimonEngine::errorString(const char *buf1, char *buf2) {
@@ -1082,10 +1084,9 @@ void SimonEngine::playSting(uint a) {
return;
char filename[11];
- uint16 size;
File mus_file;
- uint16 *mus_offsets;
+ uint16 mus_offset;
sprintf(filename, "STINGS%i.MUS", _midi_sfx);
mus_file.open(filename, _gameDataPath);
@@ -1094,16 +1095,16 @@ void SimonEngine::playSting(uint a) {
return;
}
- size = mus_file.readUint16LE();
- mus_offsets = (uint16 *)malloc(size);
+ //uint16 size = mus_file.readUint16LE();
- mus_file.seek(0, SEEK_SET);
- if (mus_file.read(mus_offsets, size) != size)
- error("Can't read offsets");
+ mus_file.seek(a * 2, SEEK_SET);
+ mus_offset = mus_file.readUint16LE();
+ if (mus_file.ioFailed())
+ error("Can't read sting %d offset", a);
- mus_file.seek(mus_offsets[a], SEEK_SET);
- midi.loadSMF (&mus_file, a, true);
- midi.startTrack (0);
+ mus_file.seek(mus_offset, SEEK_SET);
+ midi.loadSMF(&mus_file, a, true);
+ midi.startTrack(0);
}
Subroutine *SimonEngine::getSubroutineByID(uint subroutine_id) {