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

moralrecordings code at moral.net.au
Sat May 23 14:28:02 UTC 2020


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:
b76c52efe1 DIRECTOR: LINGO: Fix cb_proplist


Commit: b76c52efe14ab52d685224e2e3c1efc62586941b
    https://github.com/scummvm/scummvm/commit/b76c52efe14ab52d685224e2e3c1efc62586941b
Author: Scott Percival (code at moral.net.au)
Date: 2020-05-23T22:27:31+08:00

Commit Message:
DIRECTOR: LINGO: Fix cb_proplist

Changed paths:
    engines/director/lingo/lingo-bytecode.cpp


diff --git a/engines/director/lingo/lingo-bytecode.cpp b/engines/director/lingo/lingo-bytecode.cpp
index 1f6075eccc..9e898d1532 100644
--- a/engines/director/lingo/lingo-bytecode.cpp
+++ b/engines/director/lingo/lingo-bytecode.cpp
@@ -369,29 +369,30 @@ void LC::cb_list() {
 
 
 void LC::cb_proplist() {
-	Datum list = g_lingo->pop();
-	if (list.type != ARRAY) {
-		error("cb_proplist: first arg should be of type ARRAY, not %s", list.type2str());
+	Datum nargs = g_lingo->pop();
+	if ((nargs.type != ARGC) && (nargs.type != ARGCNORET)) {
+		error("cb_proplist: first arg should be of type ARGC or ARGCNORET, not %s", nargs.type2str());
 	}
-	Datum result;
-	result.type = PARRAY;
-	result.u.parr = new PropertyArray;
-	uint arraySize = list.u.farr->size();
+	int arraySize = nargs.u.i;
 	if (arraySize % 2) {
 		warning("cb_proplist: list should have an even number of entries, ignoring the last one");
 	}
+
+	Datum result;
+	result.type = PARRAY;
+	result.u.parr = new PropertyArray;
 	arraySize /= 2;
 
-	for (uint i = 0; i < arraySize; i += 1) {
-		Datum p = list.u.farr->operator[](i);
-		Datum v = list.u.farr->operator[](i + 1);
+	for (int i = 0; i < arraySize; i++) {
+		Datum p = g_lingo->pop();
+		Datum v = g_lingo->pop();
 
 		PCell cell = PCell(p, v);
 		result.u.parr->insert_at(0, cell);
 	};
-	delete list.u.farr;
-	list.u.i = 0;
-	list.type = VOID;
+
+	if (nargs.u.i % 2)
+		g_lingo->pop();
 
 	g_lingo->push(result);
 }




More information about the Scummvm-git-logs mailing list