aboutsummaryrefslogtreecommitdiff
path: root/engines/supernova
diff options
context:
space:
mode:
Diffstat (limited to 'engines/supernova')
-rw-r--r--engines/supernova/supernova.cpp5
-rw-r--r--engines/supernova/supernova.h19
2 files changed, 17 insertions, 7 deletions
diff --git a/engines/supernova/supernova.cpp b/engines/supernova/supernova.cpp
index 8f4394c1c8..1f0eb9b917 100644
--- a/engines/supernova/supernova.cpp
+++ b/engines/supernova/supernova.cpp
@@ -121,6 +121,8 @@ SupernovaEngine::SupernovaEngine(OSystem *syst)
DebugMan.addDebugChannel(kDebugGeneral, "general", "Supernova general debug channel");
_rnd = new Common::RandomSource("supernova");
+ _soundMusic[0] = NULL;
+ _soundMusic[1] = NULL;
}
SupernovaEngine::~SupernovaEngine() {
@@ -130,9 +132,6 @@ SupernovaEngine::~SupernovaEngine() {
delete _rnd;
delete _console;
delete _gm;
- for (int i = 0; i < kAudioNumSamples; ++i) {
- delete[] _soundSamples[i]._buffer;
- }
delete _soundMusic[0];
delete _soundMusic[1];
}
diff --git a/engines/supernova/supernova.h b/engines/supernova/supernova.h
index 7a68b8ebcb..8b1fe40dad 100644
--- a/engines/supernova/supernova.h
+++ b/engines/supernova/supernova.h
@@ -76,6 +76,20 @@ private:
ScreenBuffer *_last;
};
+struct SoundSample {
+ SoundSample()
+ : _buffer(NULL)
+ , _length(0)
+ {}
+
+ ~SoundSample() {
+ delete _buffer;
+ }
+
+ byte *_buffer;
+ int _length;
+};
+
class SupernovaEngine : public Engine {
public:
explicit SupernovaEngine(OSystem *syst);
@@ -91,10 +105,7 @@ public:
byte _mouseNormal[256];
byte _mouseWait[256];
MSNImageDecoder *_currentImage;
- struct SoundSample {
- byte *_buffer;
- int _length;
- } _soundSamples[kAudioNumSamples];
+ SoundSample _soundSamples[kAudioNumSamples];
Common::MemoryReadStream *_soundMusic[2];
Common::Event _event;
int _screenWidth;