[Scummvm-git-logs] scummvm master -> 78b14649beb833ecbc9c573e04078b626558ddc1

antoniou79 antoniou at cti.gr
Sun Feb 24 22:41:08 CET 2019


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:
78b14649be BLADERUNNER: Possible fix for clang warning for subtitles


Commit: 78b14649beb833ecbc9c573e04078b626558ddc1
    https://github.com/scummvm/scummvm/commit/78b14649beb833ecbc9c573e04078b626558ddc1
Author: Thanasis Antoniou (a.antoniou79 at gmail.com)
Date: 2019-02-24T23:39:52+02:00

Commit Message:
BLADERUNNER: Possible fix for clang warning for subtitles

Changed paths:
    engines/bladerunner/subtitles.cpp
    engines/bladerunner/subtitles.h


diff --git a/engines/bladerunner/subtitles.cpp b/engines/bladerunner/subtitles.cpp
index 8edf27c..3a21625 100644
--- a/engines/bladerunner/subtitles.cpp
+++ b/engines/bladerunner/subtitles.cpp
@@ -55,41 +55,7 @@ namespace BladeRunner {
  * DONE - OK - CHECK what happens in VQA when no corresponding TRE subs file?
  */
 
-const Common::String Subtitles::SUBTITLES_FONT_FILENAME_EXTERNAL = "SUBTLS_E.FON";
-
-/*
-* All entries need to have the language code appended (after a '_').
-* And all entries should get the suffix extension ".TRx"; the last letter in extension "TR*" should also be the language code
-* If/When adding new Text Resources here --> Update kMaxTextResourceEntries and also update method getIdxForSubsTreName()
-*/
-const Common::String Subtitles::SUBTITLES_FILENAME_PREFIXES[kMaxTextResourceEntries] = {
-	"INGQUO",           // 0 // (in-game subtitles, not VQA subtitles)
-	"WSTLGO",           // 1 // all game (language) versions have the English ('E') version of WSTLGO
-	"BRLOGO",           // 2 // all game (language) versions have the English ('E') version of BRLOGO
-	"INTRO",            // 3
-	"MW_A",             // 4
-	"MW_B01",           // 5
-	"MW_B02",           // 6
-	"MW_B03",           // 7
-	"MW_B04",           // 8
-	"MW_B05",           // 9
-	"INTRGT",           // 10
-	"MW_C01",           // 11
-	"MW_C02",           // 12
-	"MW_C03",           // 13
-	"MW_D",             // 14
-	"END04A",           // 15
-	"END04B",           // 16
-	"END04C",           // 17
-	"END06",            // 18
-	"END01A",           // 19
-	"END01B",           // 20
-	"END01C",           // 21
-	"END01D",           // 22
-	"END01E",           // 23
-	"END01F",           // 24
-	"END03"             // 25
-};
+// Note: Expected subtitles font file name int the SUBTITLES.MIX file is "SUBTLS_E.FON" (SUBTITLES_FONT_FILENAME_EXTERNAL)
 
 /**
 * Subtitles Constructor
@@ -129,6 +95,8 @@ Subtitles::~Subtitles() {
 // Init is kept separated from constructor to allow not loading up resources if subtitles system is disabled
 //
 void Subtitles::init(void) {
+	const Common::String &SUBTITLES_FONT_FILENAME_EXTERNAL = "SUBTLS_E.FON";
+
 	if (_subtitlesSystemInactive) {
 		return;
 	}
@@ -137,11 +105,12 @@ void Subtitles::init(void) {
 	for (int i = 0; i < kMaxTextResourceEntries; i++) {
 		_vqaSubsTextResourceEntries[i] = new TextResource(_vm);
 		Common::String tmpConstructedFileName = "";
-		if (SUBTITLES_FILENAME_PREFIXES[i] == "WSTLGO" || SUBTITLES_FILENAME_PREFIXES[i] == "BRLOGO") {
-			tmpConstructedFileName = SUBTITLES_FILENAME_PREFIXES[i] + "_E"; // Only English versions of these exist
+		const Common::String &prefixInFilenamesTable = SUBTITLES_FILENAME_PREFIXES[i];
+		if (prefixInFilenamesTable == "WSTLGO" || prefixInFilenamesTable == "BRLOGO") {
+			tmpConstructedFileName = prefixInFilenamesTable + "_E"; // Only English versions of these exist
 		}
 		else {
-			tmpConstructedFileName = SUBTITLES_FILENAME_PREFIXES[i] + "_" + _vm->_languageCode;
+			tmpConstructedFileName = prefixInFilenamesTable + "_" + _vm->_languageCode;
 		}
 
 		if ( _vqaSubsTextResourceEntries[i]->open(tmpConstructedFileName)) {
@@ -184,11 +153,12 @@ void Subtitles::setSubtitlesSystemInactive(bool flag) {
 int Subtitles::getIdxForSubsTreName(const Common::String &treName) const {
 	Common::String tmpConstructedFileName = "";
 	for (int i = 0; i < kMaxTextResourceEntries; ++i) {
-		if (SUBTITLES_FILENAME_PREFIXES[i] == "WSTLGO" || SUBTITLES_FILENAME_PREFIXES[i] == "BRLOGO") {
-			tmpConstructedFileName = SUBTITLES_FILENAME_PREFIXES[i] + "_E"; // Only English versions of these exist
+		const Common::String &prefixInFilenamesTable = SUBTITLES_FILENAME_PREFIXES[i];
+		if (prefixInFilenamesTable == "WSTLGO" || prefixInFilenamesTable == "BRLOGO") {
+			tmpConstructedFileName = prefixInFilenamesTable + "_E"; // Only English versions of these exist
 		}
 		else {
-			tmpConstructedFileName = SUBTITLES_FILENAME_PREFIXES[i] + "_" + _vm->_languageCode;
+			tmpConstructedFileName = prefixInFilenamesTable + "_" + _vm->_languageCode;
 		}
 		if (tmpConstructedFileName == treName) {
 			return i;
diff --git a/engines/bladerunner/subtitles.h b/engines/bladerunner/subtitles.h
index 5daf570..f43d688 100644
--- a/engines/bladerunner/subtitles.h
+++ b/engines/bladerunner/subtitles.h
@@ -49,9 +49,46 @@ class Subtitles {
 	static const int kMaxNumOfSubtitlesLines = 3;
 	static const int kMaxWidthPerLineToAutoSplitThresholdPx = 610;
 	static const int kMaxTextResourceEntries = 1 + 25; // Support in-game subs (1) and all possible VQAs (25) with spoken dialogue or translatable text!
-	static const Common::String SUBTITLES_FILENAME_PREFIXES[kMaxTextResourceEntries];
-	static const Common::String SUBTITLES_FONT_FILENAME_EXTERNAL;
 
+	// 'static const' declaration for SUBTITLES_FILENAME_PREFIXES (and init in cpp) causes warning:
+	// "declaration requires a global destructor [-Wglobal-constructors]"
+	// So, we declare it as a plain member should be fine, since we only use one instance of Subtitles anyway.
+	/*
+	* All supported TRE entries that can be in the SUBTITLES.MIX files need to:
+	* 1. Have the language code appended (after an underscore delimiter '_').
+	* 2. Have the suffix extension ".TRx"; the last letter in extension "TR*" should also be the language code
+	*
+	* Important Note: If/When adding new Text Resources here --> Update kMaxTextResourceEntries
+	* and also check if method getIdxForSubsTreName() needs updating.
+	*/
+	const char *SUBTITLES_FILENAME_PREFIXES[kMaxTextResourceEntries]{
+		"INGQUO",           // 0 // (in-game subtitles, not VQA subtitles)
+		"WSTLGO",           // 1 // all game (language) versions have the English ('E') version of WSTLGO
+		"BRLOGO",           // 2 // all game (language) versions have the English ('E') version of BRLOGO
+		"INTRO",            // 3
+		"MW_A",             // 4
+		"MW_B01",           // 5
+		"MW_B02",           // 6
+		"MW_B03",           // 7
+		"MW_B04",           // 8
+		"MW_B05",           // 9
+		"INTRGT",           // 10
+		"MW_C01",           // 11
+		"MW_C02",           // 12
+		"MW_C03",           // 13
+		"MW_D",             // 14
+		"END04A",           // 15
+		"END04B",           // 16
+		"END04C",           // 17
+		"END06",            // 18
+		"END01A",           // 19
+		"END01B",           // 20
+		"END01C",           // 21
+		"END01D",           // 22
+		"END01E",           // 23
+		"END01F",           // 24
+		"END03"             // 25
+	};
 
 	BladeRunnerEngine *_vm;
 





More information about the Scummvm-git-logs mailing list