[Scummvm-git-logs] scummvm master -> 3caf5013a60dc1dfd43f4ff9fc04032343fda874

rvanlaar noreply at scummvm.org
Fri Jan 21 11:55:55 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:
3caf5013a6 DIRECTOR: Handle duplicate cast names


Commit: 3caf5013a60dc1dfd43f4ff9fc04032343fda874
    https://github.com/scummvm/scummvm/commit/3caf5013a60dc1dfd43f4ff9fc04032343fda874
Author: Roland van Laar (roland at rolandvanlaar.nl)
Date: 2022-01-21T12:49:53+01:00

Commit Message:
DIRECTOR: Handle duplicate cast names

Multiple casts can have the same name. The last encountered cast with
that name was save in a hashtable.
Director seems to use the cast that was encountered last.
This solves the problem by not writing existing cast names.

It happened in the game Louis Catorze. The name mainMenu was associated
with a TextCast but also a ScriptCast. The chunkexpression 'line 5 of
mainMenu' is not valid for a ScriptCast.

Changed paths:
    engines/director/cast.cpp


diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index 6b702ae5356..324f77d4aac 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -1205,7 +1205,12 @@ void Cast::loadCastInfo(Common::SeekableReadStreamEndian &stream, uint16 id) {
 		ci->name = castInfo.strings[1].readString();
 
 		if (!ci->name.empty()) {
-			_castsNames[ci->name] = id;
+			// Multiple casts can have the same name. In director only the first one is used.
+			if (!_castsNames.contains(ci->name)) {
+				_castsNames[ci->name] = id;
+			} else {
+				debugC(4, kDebugLoading, "Cast::loadCastInfo(): duplicate cast name: %s for castIDs: %s %s", ci->name.c_str(), numToCastNum(id), numToCastNum(_castsNames[ci->name]));
+			}
 		}
 		// fallthrough
 	case 1:




More information about the Scummvm-git-logs mailing list