[Scummvm-git-logs] scummvm master -> afd2e589be1b097d5f682176a2046f6de090b237

whiterandrek whiterandrek at gmail.com
Fri Jun 5 17:48:33 UTC 2020


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
afd2e589be PETKA: added vm field to SoundMgr


Commit: afd2e589be1b097d5f682176a2046f6de090b237
    https://github.com/scummvm/scummvm/commit/afd2e589be1b097d5f682176a2046f6de090b237
Author: Andrei Prykhodko (whiterandrek at gmail.com)
Date: 2020-06-05T20:48:16+03:00

Commit Message:
PETKA: added vm field to SoundMgr

Changed paths:
    engines/petka/petka.cpp
    engines/petka/sound.cpp
    engines/petka/sound.h


diff --git a/engines/petka/petka.cpp b/engines/petka/petka.cpp
index dfbfd72e39..5e9dba76d0 100644
--- a/engines/petka/petka.cpp
+++ b/engines/petka/petka.cpp
@@ -90,7 +90,7 @@ Common::Error PetkaEngine::run() {
 
 	_console.reset(new Console(this));
 	_fileMgr.reset(new FileMgr());
-	_soundMgr.reset(new SoundMgr());
+	_soundMgr.reset(new SoundMgr(*this));
 	_vsys.reset(new VideoSystem());
 
 	loadPart(2);
diff --git a/engines/petka/sound.cpp b/engines/petka/sound.cpp
index 4d8e6ef819..85abd42f8c 100644
--- a/engines/petka/sound.cpp
+++ b/engines/petka/sound.cpp
@@ -81,10 +81,10 @@ Sound *SoundMgr::addSound(const Common::String &name, Audio::Mixer::SoundType ty
 	Sound *sound = findSound(name);
 	if (sound)
 		return sound;
-	Common::SeekableReadStream *s = g_vm->openFile(name, false);
+	Common::SeekableReadStream *s = _vm.openFile(name, false);
 	if (s) {
 		debug("SoundMgr: added sound %s", name.c_str());
-		sound = new Sound(g_vm->openFile(name, false), type);
+		sound = new Sound(_vm.openFile(name, false), type);
 		_sounds.getVal(name).reset(sound);
 	}
 	return sound;
diff --git a/engines/petka/sound.h b/engines/petka/sound.h
index f577b784bd..b22dcb4087 100644
--- a/engines/petka/sound.h
+++ b/engines/petka/sound.h
@@ -56,8 +56,12 @@ private:
 	Audio::SoundHandle _handle;
 };
 
+class PetkaEngine;
+
 class SoundMgr {
 public:
+	SoundMgr(PetkaEngine &vm) : _vm(vm) {}
+
 	Sound *addSound(const Common::String &name, Audio::Mixer::SoundType type);
 	Sound *findSound(const Common::String &name) const;
 
@@ -67,6 +71,7 @@ public:
 
 private:
 	typedef Common::HashMap<Common::String, Common::ScopedPtr<Sound>, Common::CaseSensitiveString_Hash> SoundsMap;
+	PetkaEngine &_vm;
 	SoundsMap _sounds;
 };
 




More information about the Scummvm-git-logs mailing list