diff options
author | craigsc | 2020-01-11 12:08:21 -0800 |
---|---|---|
committer | craigsc | 2020-01-11 12:08:21 -0800 |
commit | 3dd4fb16f017a8eab5c6c11fd119a397b457866e (patch) | |
tree | 5b80b5c5038d8577c2d674a5a4742b335deca515 /engines/director/resource.cpp | |
parent | f9f81ea9baecb714f26cf1c17a1b0ae58431467b (diff) | |
parent | 5893672b80f00fced33c42e63471d68ba47d7dd4 (diff) | |
download | scummvm-rg350-3dd4fb16f017a8eab5c6c11fd119a397b457866e.tar.gz scummvm-rg350-3dd4fb16f017a8eab5c6c11fd119a397b457866e.tar.bz2 scummvm-rg350-3dd4fb16f017a8eab5c6c11fd119a397b457866e.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'engines/director/resource.cpp')
-rw-r--r-- | engines/director/resource.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/engines/director/resource.cpp b/engines/director/resource.cpp index 4d5f9a9cd4..d0f802a715 100644 --- a/engines/director/resource.cpp +++ b/engines/director/resource.cpp @@ -63,8 +63,13 @@ Archive *DirectorEngine::openMainArchive(const Common::String movie) { _mainArchive = createArchive(); - if (!_mainArchive->openFile(movie)) - error("Could not open '%s'", movie.c_str()); + if (!_mainArchive->openFile(movie)) { + delete _mainArchive; + _mainArchive = nullptr; + + warning("openMainArchive(): Could not open '%s'", movie.c_str()); + return nullptr; + } return _mainArchive; } @@ -256,14 +261,21 @@ void DirectorEngine::clearSharedCast() { delete _sharedScore; + _sharedScore = nullptr; + delete _sharedDIB; delete _sharedSTXT; delete _sharedSound; delete _sharedBMP; + + _sharedDIB = nullptr; + _sharedSTXT = nullptr; + _sharedSound = nullptr; + _sharedBMP = nullptr; } void DirectorEngine::loadSharedCastsFrom(Common::String filename) { - if (_sharedScore) { + if (_sharedScore && _sharedScore->_movieArchive) { if (_sharedScore->_movieArchive->getFileName().equalsIgnoreCase(filename)) return; } @@ -272,10 +284,6 @@ void DirectorEngine::loadSharedCastsFrom(Common::String filename) { Archive *shardcst = createArchive(); - debug(0, "\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); - debug(0, "@@@@ Loading Shared cast '%s'", filename.c_str()); - debug(0, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"); - _sharedDIB = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>; _sharedSTXT = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>; _sharedSound = new Common::HashMap<int, Common::SeekableSubReadStreamEndian *>; @@ -284,11 +292,15 @@ void DirectorEngine::loadSharedCastsFrom(Common::String filename) { if (!shardcst->openFile(filename)) { warning("No shared cast %s", filename.c_str()); - _sharedScore = new Score(this); + delete shardcst; return; } + debug(0, "\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); + debug(0, "@@@@ Loading Shared cast '%s'", filename.c_str()); + debug(0, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n"); + _sharedScore = new Score(this); _sharedScore->setArchive(shardcst); |