[Scummvm-git-logs] scummvm master -> 0993718e530e005342751aea26f7cab350d19adb

neuromancer noreply at scummvm.org
Sun Nov 23 07:19:16 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:
0993718e53 PRIVATE: Fix addMemory crash when helping Mavis


Commit: 0993718e530e005342751aea26f7cab350d19adb
    https://github.com/scummvm/scummvm/commit/0993718e530e005342751aea26f7cab350d19adb
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2025-11-23T08:19:13+01:00

Commit Message:
PRIVATE: Fix addMemory crash when helping Mavis

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 d9ae5259809..d79c4f53603 100644
--- a/engines/private/funcs.cpp
+++ b/engines/private/funcs.cpp
@@ -53,12 +53,8 @@ static void fChgMode(ArgArray args) {
 
 	if (args.size() == 3) {
 		Symbol *location = g_private->maps.lookupLocation(args[2].u.sym->name);
-		if (location->u.val == 0) {
-			// visited locations have non-zero values.
-			// set to an incrementing value to record the order visited.
-			int maxLocationValue = g_private->getMaxLocationValue();
-			setSymbol(location, maxLocationValue + 1);
-		}
+		g_private->setLocationAsVisited(location);
+
 		// set a game flag when visiting the police station.
 		if (!g_private->isDemo()) {
 			if (*(args[2].u.sym->name) == g_private->getPoliceStationLocation()) {
diff --git a/engines/private/private.cpp b/engines/private/private.cpp
index bdbcccce9d0..6db85c1e491 100644
--- a/engines/private/private.cpp
+++ b/engines/private/private.cpp
@@ -1108,7 +1108,7 @@ void PrivateEngine::addMemory(const Common::String &path) {
 
 	uint locationIndex = 0;
 	for (auto &it : maps.locationList) {
-		const Private::Symbol *sym = maps.locations.getVal(it);
+		Private::Symbol *sym = maps.locations.getVal(it);
 		locationIndex++;
 
 		Common::String currentLocation = it.substr(9);
@@ -1146,7 +1146,13 @@ void PrivateEngine::addMemory(const Common::String &path) {
 		}
 
 		currentLocation.toLowercase();
-		if (sym->u.val && currentLocation == location) {
+		if (currentLocation == location) {
+			// Ensure that the location is marked as visited.
+			// Police station video spoc00xs can be played before the
+			// police station has been visited if the player has not
+			// been busted by the police yet.
+			setLocationAsVisited(sym);
+
 			diaryPage.locationID = locationIndex;
 			break;
 		}
@@ -2474,6 +2480,15 @@ void PrivateEngine::loadMemories(const Common::Rect &rect, uint rightPageOffset,
 	}
 }
 
+void PrivateEngine::setLocationAsVisited(Symbol *location) {
+	if (location->u.val == 0) {
+		// visited locations have non-zero values.
+		// set to an incrementing value to record the order visited.
+		int maxLocationValue = getMaxLocationValue();
+		setSymbol(location, maxLocationValue + 1);
+	}
+}
+
 int PrivateEngine::getMaxLocationValue() {
 	int maxValue = 0;
 	for (SymbolMap::iterator it = maps.locations.begin(); it != maps.locations.end(); ++it) {
diff --git a/engines/private/private.h b/engines/private/private.h
index 21b6b97e2c1..78a99c05c6a 100644
--- a/engines/private/private.h
+++ b/engines/private/private.h
@@ -362,6 +362,7 @@ public:
 	Common::Array<MaskInfo> _locationMasks;
 	Common::Array<MaskInfo> _memoryMasks;
 	bool selectMemory(const Common::Point &mousePos);
+	void setLocationAsVisited(Symbol *location);
 	int getMaxLocationValue();
 
 	// Save/Load games




More information about the Scummvm-git-logs mailing list