[Scummvm-git-logs] scummvm master -> 979713419f3ba77bcd6a23500aa0a1a80404087c

neuromancer noreply at scummvm.org
Sat Nov 8 18:01:53 UTC 2025


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

Summary:
1c1dcc51da PRIVATE: avoid crash when opening the diary without visiting any location
979713419f PRIVATE: do not show items in the inventory list of the diary, if the player decides not to take them


Commit: 1c1dcc51dab0e534d4ddf7b577ccd502a00870e4
    https://github.com/scummvm/scummvm/commit/1c1dcc51dab0e534d4ddf7b577ccd502a00870e4
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2025-11-08T18:34:15+01:00

Commit Message:
PRIVATE: avoid crash when opening the diary without visiting any location

Changed paths:
    engines/private/private.cpp


diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 332333f2569..8e9b7a3a2ec 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -112,7 +112,7 @@ PrivateEngine::PrivateEngine(OSystem *syst, const ADGameDescription *gd)
 
 	// Diary
 	_diaryLocPrefix = "inface/diary/loclist/";
-	_currentDiaryPage = 0;
+	_currentDiaryPage = -1;
 
 	// Safe
 	_safeNumberPath = "sg/search_s/sgsaf%d.bmp";
@@ -282,7 +282,7 @@ Common::Error PrivateEngine::run() {
 	_compositeSurface->create(_screenW, _screenH, _pixelFormat);
 	_compositeSurface->setTransparentColor(_transparentColor);
 
-	_currentDiaryPage = 0;
+	_currentDiaryPage = -1;
 
 	// Load the game frame once
 	byte *palette;
@@ -2016,6 +2016,9 @@ void PrivateEngine::loadInventory(uint32 x, const Common::Rect &r1, const Common
 }
 
 void PrivateEngine::loadMemories(const Common::Rect &rect, uint rightPageOffset, uint verticalOffset) {
+	if (_currentDiaryPage < 0);
+		return;
+
 	Common::String s = Common::String::format("inface/diary/loctabs/drytab%d.bmp", _diaryPages[_currentDiaryPage].locationID);
 	loadImage(s, 0, 0);
 


Commit: 979713419f3ba77bcd6a23500aa0a1a80404087c
    https://github.com/scummvm/scummvm/commit/979713419f3ba77bcd6a23500aa0a1a80404087c
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2025-11-08T19:01:07+01:00

Commit Message:
PRIVATE: do not show items in the inventory list of the diary, if the player decides not to take them

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 31ac7443fc6..2fa78bad00d 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -359,14 +359,6 @@ static void fLoseInventory(ArgArray args) {
 	g_private->inventory.clear();
 }
 
-bool inInventory(Common::String &bmp) {
-	for (NameList::const_iterator it = g_private->inventory.begin(); it != g_private->inventory.end(); ++it) {
-		if (*it == bmp)
-			return true;
-	}
-	return false;
-}
-
 static void fInventory(ArgArray args) {
 	// assert types
 	Datum b1 = args[0];
@@ -414,6 +406,7 @@ static void fInventory(ArgArray args) {
 		} else
 			m.flag2 = nullptr;
 
+		m.inventoryItem = bmp;
 		g_private->_masks.push_front(m);
 		g_private->_toTake = true;
 		Common::String sound(snd.u.str);
@@ -423,23 +416,20 @@ static void fInventory(ArgArray args) {
 		} else {
 			g_private->playSound(g_private->getTakeLeaveSound(), 1, false, false);
 		}
-
-		if (!inInventory(bmp))
-			g_private->inventory.push_back(bmp);
 	} else {
 		if (v1.type == NAME) {
 			v1.u.sym = g_private->maps.lookupVariable(v1.u.sym->name);
 			if (strcmp(c.u.str, "\"REMOVE\"") == 0) {
 				v1.u.sym->u.val = 0;
-				if (inInventory(bmp))
+				if (g_private->inInventory(bmp))
 					g_private->inventory.remove(bmp);
 			} else {
 				v1.u.sym->u.val = 1;
-				if (!inInventory(bmp))
+				if (!g_private->inInventory(bmp))
 					g_private->inventory.push_back(bmp);
 			}
 		} else {
-			if (!inInventory(bmp))
+			if (!g_private->inInventory(bmp))
 				g_private->inventory.push_back(bmp);
 		}
 		if (v2.type == NAME) {
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index 8e9b7a3a2ec..a59986a5a49 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -822,9 +822,11 @@ void PrivateEngine::selectMask(Common::Point mousePos) {
 			}
 
 			if (m.flag1 != nullptr) { // TODO: check this
-				setSymbol(m.flag1, 1);
 				// an item was taken
 				if (_toTake) {
+					if (!inInventory(m.inventoryItem))
+						inventory.push_back(m.inventoryItem);
+					setSymbol(m.flag1, 1);
 					playSound(getTakeSound(), 1, false, false);
 					_toTake = false;
 				}
@@ -994,6 +996,14 @@ void PrivateEngine::addMemory(const Common::String &path) {
 	_diaryPages.insert_at(0, diaryPage);
 }
 
+bool PrivateEngine::inInventory(const Common::String &bmp) const {
+	for (NameList::const_iterator it = inventory.begin(); it != inventory.end(); ++it) {
+		if (*it == bmp)
+			return true;
+	}
+	return false;
+}
+
 void PrivateEngine::selectAMRadioArea(Common::Point mousePos) {
 	if (_AMRadioArea.surf == nullptr)
 		return;
diff --git a/engines/private/private.h b/engines/private/private.h
index 32096b37208..e0b6007a782 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -87,6 +87,7 @@ typedef struct MaskInfo {
 	Symbol *flag1;
 	Symbol *flag2;
 	Common::String cursor;
+	Common::String inventoryItem;
 
 	void clear() {
 		surf = nullptr;
@@ -95,6 +96,7 @@ typedef struct MaskInfo {
 		nextSetting.clear();
 		cursor.clear();
 		point = Common::Point();
+		inventoryItem.clear();
 	}
 } MaskInfo;
 
@@ -311,6 +313,7 @@ public:
 
 	// Diary
 	InvList inventory;
+	bool inInventory(const Common::String &bmp) const;
 	Common::String _diaryLocPrefix;
 	void loadLocations(const Common::Rect &);
 	void loadInventory(uint32, const Common::Rect &, const Common::Rect &);




More information about the Scummvm-git-logs mailing list