[Scummvm-git-logs] scummvm master -> 63ca8cdeef1e1f37ed252ed4b7a21b30aabf5b3a

digitall 547637+digitall at users.noreply.github.com
Sat Mar 6 21:51:35 UTC 2021


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:
63ca8cdeef PRIVATE: Fix GCC Unused Variable Warnings from Header Constants


Commit: 63ca8cdeef1e1f37ed252ed4b7a21b30aabf5b3a
    https://github.com/scummvm/scummvm/commit/63ca8cdeef1e1f37ed252ed4b7a21b30aabf5b3a
Author: D G Turner (digitall at scummvm.org)
Date: 2021-03-06T21:48:59Z

Commit Message:
PRIVATE: Fix GCC Unused Variable Warnings from Header Constants

It is not generally a good idea to define variables in headers so
fixing these warnings by using the string value directly as initialization
to various Common::String variables / parameters.

Changed paths:
    engines/private/funcs.cpp
    engines/private/private.cpp
    engines/private/private.h


diff --git a/engines/private/funcs.cpp b/engines/private/funcs.cpp
index b6d8a7fcc5..b55ba16580 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -170,7 +170,7 @@ static void fPoliceBust(ArgArray args) {
 		if (args[1].u.val == 2) {
 			// Unclear what it means
 		} else if (args[1].u.val == 3) {
-			g_private->_nextSetting = kMainDesktop;
+			g_private->_nextSetting = "kMainDesktop";
 			g_private->_mode = 0;
 			g_private->_origin = Common::Point(kOriginZero[0], kOriginZero[1]);
 		} else
@@ -184,7 +184,7 @@ static void fBustMovie(ArgArray args) {
 	// assert types
 	assert (args.size() == 1);
 	debugC(1, kPrivateDebugScript, "BustMovie(%s)", args[0].u.str);
-	uint policeIndex = g_private->maps.variables.getVal(kPoliceIndex)->u.val;
+	uint policeIndex = g_private->maps.variables.getVal("kPoliceIndex")->u.val;
 	int videoIndex = policeIndex/2 - 1;
 	if (videoIndex < 0)
 		videoIndex = 0;
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 30eadb7255..095c504b64 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -194,8 +194,7 @@ Common::Error PrivateEngine::run() {
 	if (saveSlot >= 0) { // load the savegame
 		loadGameState(saveSlot);
 	} else {
-		_nextSetting = kGoIntro;
-		//setNextSetting(new Common::String(kGoIntro));
+		_nextSetting = "kGoIntro";
 	}
 
 	while (!shouldQuit()) {
@@ -260,7 +259,7 @@ Common::Error PrivateEngine::run() {
 			continue;
 		}
 
-		if (!_nextVS.empty() && _currentSetting == kMainDesktop) {
+		if (!_nextVS.empty() && _currentSetting == "kMainDesktop") {
 			loadImage(_nextVS, 160, 120);
 			drawScreen();
 		}
@@ -345,7 +344,7 @@ void PrivateEngine::clearAreas() {
 
 void PrivateEngine::startPoliceBust() {
 	// This logic was extracted from the binary
-	int policeIndex = maps.variables.getVal(kPoliceIndex)->u.val;
+	int policeIndex = maps.variables.getVal("kPoliceIndex")->u.val;
 	int r = _rnd->getRandomNumber(0xc);
 	if (policeIndex > 0x14) {
 		policeIndex = 0x15;
@@ -372,12 +371,12 @@ void PrivateEngine::checkPoliceBust() {
 	}
 
 	if (_numberClicks == _maxNumberClicks+1) {
-		uint policeIndex = maps.variables.getVal(kPoliceIndex)->u.val;
+		uint policeIndex = maps.variables.getVal("kPoliceIndex")->u.val;
 		_policeBustSetting = _currentSetting;
 		if (policeIndex <= 13) {
-			_nextSetting = kPOGoBustMovie;
+			_nextSetting = "kPOGoBustMovie";
 		} else {
-			_nextSetting = kPoliceBustFromMO;
+			_nextSetting = "kPoliceBustFromMO";
 		}
 		clearAreas();
 		_policeBustEnabled = false;
@@ -460,7 +459,7 @@ void PrivateEngine::selectPauseMovie(Common::Point mousePos) {
 		if (!window.contains(mousePos)) {
 			if (!_pausedSetting.empty()) {
 				_pausedSetting = _currentSetting;
-				_nextSetting = kPauseMovie;
+				_nextSetting = "kPauseMovie";
 			}
 		}
 	}
@@ -694,7 +693,7 @@ Common::Error PrivateEngine::loadGameStream(Common::SeekableReadStream *stream)
 
 	Common::Serializer s(stream, nullptr);
 	debugC(1, kPrivateDebugFunction, "loadGameStream");
-	_nextSetting = kStartGame;
+	_nextSetting = "kStartGame";
 	int val;
 
 	for (NameList::iterator it = maps.variableList.begin(); it != maps.variableList.end(); ++it) {
diff --git a/engines/private/private.h b/engines/private/private.h
index 5706a49d96..b7a4c0fe22 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -68,16 +68,6 @@ const int kOriginOne[2]  = {64, 48};
 
 extern Gen::VM *Gen::g_vm;
 
-// settings
-
-static const char *kPauseMovie = "kPauseMovie";
-static const char *kGoIntro = "kGoIntro";
-static const char *kPoliceBustFromMO = "kPoliceBustFromMO";
-static const char *kMainDesktop = "kMainDesktop";
-static const char *kPoliceIndex = "kPoliceIndex";
-static const char *kPOGoBustMovie = "kPOGoBustMovie";
-static const char *kStartGame = "kStartGame";
-
 // structs
 
 typedef struct ExitInfo {




More information about the Scummvm-git-logs mailing list