[Scummvm-git-logs] scummvm master -> ba40bb3b6cff10c32a4d48578318d4ccea5b8079

dwatteau noreply at scummvm.org
Mon Oct 6 08:11:02 UTC 2025


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
ba40bb3b6c SCUMM: MACGUI: Fix engine build with MSVC 2015


Commit: ba40bb3b6cff10c32a4d48578318d4ccea5b8079
    https://github.com/scummvm/scummvm/commit/ba40bb3b6cff10c32a4d48578318d4ccea5b8079
Author: Donovan Watteau (contrib at dwatteau.fr)
Date: 2025-10-06T10:09:35+02:00

Commit Message:
SCUMM: MACGUI: Fix engine build with MSVC 2015

MSVC 2015 doesn't like accessing members of an enclosing class like
it was done with ARRAYSIZE(_slots).  It'd be a shame if the oldest
supported (kinda) MSVC release couldn't build the oldest ScummVM engine.

(I waited a day before pushing this particular commit, to see if some
message from one of our best writers would show up.  It did!)

Changed paths:
    engines/scumm/macgui/macgui_indy3.cpp
    engines/scumm/macgui/macgui_indy3.h


diff --git a/engines/scumm/macgui/macgui_indy3.cpp b/engines/scumm/macgui/macgui_indy3.cpp
index 1de3d2166b4..0b9a6728354 100644
--- a/engines/scumm/macgui/macgui_indy3.cpp
+++ b/engines/scumm/macgui/macgui_indy3.cpp
@@ -706,9 +706,6 @@ void MacIndy3Gui::Inventory::Slot::draw() {
 // more objects than are visible on screen.
 // ---------------------------------------------------------------------------
 
-// NB: This class makes several references to ARRAYSIZE(_slots), but accessing
-//     members of the enclosing class like that should be ok in C++11.
-
 MacIndy3Gui::Inventory::ScrollBar::ScrollBar(int x, int y, int width, int height) : MacIndy3Gui::Widget(x, y, width, height) {
 }
 
@@ -731,7 +728,7 @@ bool MacIndy3Gui::Inventory::ScrollBar::handleEvent(Common::Event &event) {
 		if (event.mouse.y <= pos + 4)
 			_invOffset = 0;
 		else if (event.mouse.y >= pos + 6)
-			_invOffset = _invCount - ARRAYSIZE(_slots);
+			_invOffset = _invCount - INDY3_INVENTORY_SLOT_SIZE;
 
 		_gui->setInventoryScrollOffset(_invOffset);
 		setRedraw(true);
@@ -744,7 +741,7 @@ void MacIndy3Gui::Inventory::ScrollBar::setInventoryParameters(int invCount, int
 	if (invOffset != _invOffset)
 		setRedraw(true);
 
-	if (invCount != _invCount && _invCount >= ARRAYSIZE(_slots))
+	if (invCount != _invCount && _invCount >= INDY3_INVENTORY_SLOT_SIZE)
 		setRedraw(true);
 
 	_invCount = invCount;
@@ -753,7 +750,7 @@ void MacIndy3Gui::Inventory::ScrollBar::setInventoryParameters(int invCount, int
 
 void MacIndy3Gui::Inventory::ScrollBar::scroll(ScrollDirection dir) {
 	int newOffset = _invOffset;
-	int maxOffset = _invCount - ARRAYSIZE(_slots);
+	int maxOffset = _invCount - INDY3_INVENTORY_SLOT_SIZE;
 
 	if (dir == kScrollUp)
 		newOffset--;
@@ -779,7 +776,7 @@ int MacIndy3Gui::Inventory::ScrollBar::getHandlePosition() {
 	// Hopefully this matches the original scroll handle position.
 
 	int maxPos = _bounds.height() - 8;
-	int maxOffset = _invCount - ARRAYSIZE(_slots);
+	int maxOffset = _invCount - INDY3_INVENTORY_SLOT_SIZE;
 
 	if (_invOffset >= maxOffset)
 		return maxPos;
diff --git a/engines/scumm/macgui/macgui_indy3.h b/engines/scumm/macgui/macgui_indy3.h
index 26cc6548b6d..da005ba454c 100644
--- a/engines/scumm/macgui/macgui_indy3.h
+++ b/engines/scumm/macgui/macgui_indy3.h
@@ -32,6 +32,8 @@
 
 namespace Scumm {
 
+#define INDY3_INVENTORY_SLOT_SIZE	6
+
 class MacGuiImpl;
 
 class MacIndy3Gui : public MacGuiImpl {
@@ -251,7 +253,7 @@ private:
 			void draw() override;
 		};
 
-		Slot *_slots[6];
+		Slot *_slots[INDY3_INVENTORY_SLOT_SIZE];
 		ScrollBar *_scrollBar;
 		ScrollButton *_scrollButtons[2];
 




More information about the Scummvm-git-logs mailing list