From 183571f7c2292b78f8e632cb4de01ff108bf207c Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Mon, 20 Nov 2017 20:19:15 +0100 Subject: FULLPIPE: Fix loading inventory items from saves In C++ the function parameter evaluation order is undefined. The count property was being read first from the stream, instead of the itemId. Fixes #10324. --- engines/fullpipe/inventory.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'engines/fullpipe') diff --git a/engines/fullpipe/inventory.cpp b/engines/fullpipe/inventory.cpp index 7cf8fe9712..1a3c234ef6 100644 --- a/engines/fullpipe/inventory.cpp +++ b/engines/fullpipe/inventory.cpp @@ -95,7 +95,9 @@ bool Inventory2::loadPartial(MfcArchive &file) { // Inventory2_SerializePartiall int numInvs = file.readUint32LE(); for (int i = 0; i < numInvs; i++) { - _inventoryItems.push_back(InventoryItem(file.readUint16LE(), file.readUint16LE())); + int16 itemId = file.readUint16LE(); + int16 count = file.readUint16LE(); + _inventoryItems.push_back(InventoryItem(itemId, count)); } return true; -- cgit v1.2.3