From b3508245a0940bbe9829f2bcae926c49c39c38b8 Mon Sep 17 00:00:00 2001 From: dafioram Date: Thu, 18 Jul 2019 12:23:28 -0400 Subject: BLADERUNNER: Make subtitles variable local (#1753) --- engines/bladerunner/subtitles.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/engines/bladerunner/subtitles.cpp b/engines/bladerunner/subtitles.cpp index 2170638815..36daee3d4c 100644 --- a/engines/bladerunner/subtitles.cpp +++ b/engines/bladerunner/subtitles.cpp @@ -122,14 +122,14 @@ Subtitles::~Subtitles() { // void Subtitles::init(void) { // Loading subtitles versioning info if available - TextResource *versionTxtResource = new TextResource(_vm); - if ( versionTxtResource->open(SUBTITLES_VERSION_TRENAME, false)) { - _subtitlesInfo.credits = versionTxtResource->getText((uint32)0); - _subtitlesInfo.versionStr = versionTxtResource->getText((uint32)1); - _subtitlesInfo.dateOfCompile = versionTxtResource->getText((uint32)2); - _subtitlesInfo.languageMode = versionTxtResource->getText((uint32)3); - Common::String fontType = versionTxtResource->getText((uint32)4); - _subtitlesInfo.fontName = versionTxtResource->getText((uint32)5); + TextResource versionTxtResource(_vm); + if ( versionTxtResource.open(SUBTITLES_VERSION_TRENAME, false)) { + _subtitlesInfo.credits = versionTxtResource.getText((uint32)0); + _subtitlesInfo.versionStr = versionTxtResource.getText((uint32)1); + _subtitlesInfo.dateOfCompile = versionTxtResource.getText((uint32)2); + _subtitlesInfo.languageMode = versionTxtResource.getText((uint32)3); + Common::String fontType = versionTxtResource.getText((uint32)4); + _subtitlesInfo.fontName = versionTxtResource.getText((uint32)5); if (fontType.equalsIgnoreCase("ttf")) { _subtitlesInfo.fontType = Subtitles::kSubtitlesFontTypeTTF; @@ -147,8 +147,6 @@ void Subtitles::init(void) { _subtitlesInfo.languageMode.c_str(), _subtitlesInfo.credits.c_str()); - delete versionTxtResource; - versionTxtResource = nullptr; } else { debug("Subtitles version info: N/A"); } -- cgit v1.2.3