[Scummvm-git-logs] scummvm master -> 6990c1ccbf549f1a7bba7c562e372b2f718bcb29

lephilousophe noreply at scummvm.org
Thu Dec 28 07:47:55 UTC 2023


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:
6990c1ccbf ACCESS: Remove use of statically allocated variable


Commit: 6990c1ccbf549f1a7bba7c562e372b2f718bcb29
    https://github.com/scummvm/scummvm/commit/6990c1ccbf549f1a7bba7c562e372b2f718bcb29
Author: Le Philousophe (lephilousophe at users.noreply.github.com)
Date: 2023-12-28T08:44:56+01:00

Commit Message:
ACCESS: Remove use of statically allocated variable

Even if this is a const and Rect is constexpr, this instantiation can't
be done at compile time as the parameters of Rect are defined in another
translation unit.
Using this construct make the compiler emit code at init which is
forbidden as per our rules.

Changed paths:
    engines/access/amazon/amazon_scripts.cpp


diff --git a/engines/access/amazon/amazon_scripts.cpp b/engines/access/amazon/amazon_scripts.cpp
index 8e223263a1f..00d0845b786 100644
--- a/engines/access/amazon/amazon_scripts.cpp
+++ b/engines/access/amazon/amazon_scripts.cpp
@@ -414,14 +414,15 @@ void AmazonScripts::cmdHelp_v2() {
 
 	_game->drawHelp(helpMessage);
 
+	const Common::Rect butn1 = Common::Rect(HELP1COORDS[0][0], HELP1COORDS[0][2], HELP1COORDS[0][1], HELP1COORDS[0][3]);
+	const Common::Rect butn2 = Common::Rect(HELP1COORDS[1][0], HELP1COORDS[1][2], HELP1COORDS[1][1], HELP1COORDS[1][3]);
+
 	while (!_vm->shouldQuit()) {
 		while (!_vm->shouldQuit() && !_vm->_events->_leftButton)
 			_vm->_events->pollEventsAndWait();
 
 		_vm->_events->debounceLeft();
 
-		static const Common::Rect butn1 = Common::Rect(HELP1COORDS[0][0], HELP1COORDS[0][2], HELP1COORDS[0][1], HELP1COORDS[0][3]);
-		static const Common::Rect butn2 = Common::Rect(HELP1COORDS[1][0], HELP1COORDS[1][2], HELP1COORDS[1][1], HELP1COORDS[1][3]);
 		const Common::Point pt = _vm->_events->_mousePos;
 
 		int choice = -1;




More information about the Scummvm-git-logs mailing list