[Scummvm-git-logs] scummvm master -> 780ee54d3a41a8a42753b5632b847dfc6bd3ab54

elasota noreply at scummvm.org
Sat Jul 2 05:15:30 UTC 2022


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:
780ee54d3a MTROPOLIS: Use the first variable in a scope for name linkage when there are name collisions


Commit: 780ee54d3a41a8a42753b5632b847dfc6bd3ab54
    https://github.com/scummvm/scummvm/commit/780ee54d3a41a8a42753b5632b847dfc6bd3ab54
Author: elasota (ejlasota at gmail.com)
Date: 2022-07-02T01:15:00-04:00

Commit Message:
MTROPOLIS: Use the first variable in a scope for name linkage when there are name collisions

Changed paths:
    engines/mtropolis/runtime.cpp


diff --git a/engines/mtropolis/runtime.cpp b/engines/mtropolis/runtime.cpp
index c39adf4f1ef..8a9376bcd46 100644
--- a/engines/mtropolis/runtime.cpp
+++ b/engines/mtropolis/runtime.cpp
@@ -3099,8 +3099,16 @@ void ObjectLinkingScope::setParent(ObjectLinkingScope *parent) {
 void ObjectLinkingScope::addObject(uint32 guid, const Common::String &name, const Common::WeakPtr<RuntimeObject> &object) {
 	_guidToObject[guid] = object;
 
-	if (name.size() > 0)
-		_nameToObject[toCaseInsensitive(name)] = object;
+	if (name.size() > 0) {
+		// Have to keep the first instance we find and ignore later instances.
+		// Obsidian depends on this to properly resolve the scene destination when returning to the plane from the Statue
+		// because there are two "sDest" variables but the first one is the correct one (and the one matching the GUID
+		// link from the script that assigns to it)
+		Common::WeakPtr<RuntimeObject> &objRef = _nameToObject[toCaseInsensitive(name)];
+
+		if (objRef.expired())
+			objRef = object;
+	}
 }
 
 Common::WeakPtr<RuntimeObject> ObjectLinkingScope::resolve(uint32 staticGUID) const {




More information about the Scummvm-git-logs mailing list