[Scummvm-git-logs] scummvm master -> 5984111a26775f8b2065e3b4abc630cc539e13cd

dreammaster dreammaster at scummvm.org
Sat Aug 5 21:50:23 CEST 2017


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:
5984111a26 TITANIC: Cleanup and fix for multi drop targets


Commit: 5984111a26775f8b2065e3b4abc630cc539e13cd
    https://github.com/scummvm/scummvm/commit/5984111a26775f8b2065e3b4abc630cc539e13cd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-08-05T15:49:17-04:00

Commit Message:
TITANIC: Cleanup and fix for multi drop targets

The fix deals with a bug in the original that if an item was used
that the drop target didn't handle, the item wouldn't be returned
to the player's inventory

Changed paths:
    engines/titanic/core/multi_drop_target.cpp
    engines/titanic/core/multi_drop_target.h


diff --git a/engines/titanic/core/multi_drop_target.cpp b/engines/titanic/core/multi_drop_target.cpp
index b956965..bcdbcde 100644
--- a/engines/titanic/core/multi_drop_target.cpp
+++ b/engines/titanic/core/multi_drop_target.cpp
@@ -22,6 +22,7 @@
 
 #include "titanic/core/multi_drop_target.h"
 #include "titanic/support/string_parser.h"
+#include "titanic/carry/carry.h"
 
 namespace Titanic {
 
@@ -31,33 +32,37 @@ END_MESSAGE_MAP()
 
 void CMultiDropTarget::save(SimpleFile *file, int indent) {
 	file->writeNumberLine(1, indent);
-	file->writeQuotedLine(_string5, indent);
-	file->writeQuotedLine(_string6, indent);
+	file->writeQuotedLine(_dropFrames, indent);
+	file->writeQuotedLine(_dropNames, indent);
 
 	CDropTarget::save(file, indent);
 }
 
 void CMultiDropTarget::load(SimpleFile *file) {
 	file->readNumber();
-	_string5 = file->readString();
-	_string6 = file->readString();
+	_dropFrames = file->readString();
+	_dropNames = file->readString();
 
 	CDropTarget::load(file);
 }
 
 bool CMultiDropTarget::DropObjectMsg(CDropObjectMsg *msg) {
-	CStringParser parser1(_string5);
-	CStringParser parser2(_string6);
+	CStringParser parser1(_dropFrames);
+	CStringParser parser2(_dropNames);
 	CString seperatorChars = ",";
 
+	// WORKAROUND: The original didn't break out of loop if a drop target
+	// succeeded, nor did it return the item to the inventory if incorrect
 	while (parser2.parse(_itemMatchName, seperatorChars)) {
 		_dropFrame = parser1.readInt();
-		CDropTarget::DropObjectMsg(msg);
+		if (CDropTarget::DropObjectMsg(msg))
+			return true;
 
 		parser1.skipSeperators(seperatorChars);
 		parser2.skipSeperators(seperatorChars);
 	}
 
+	msg->_item->petAddToInventory();
 	return true;
 }
 
diff --git a/engines/titanic/core/multi_drop_target.h b/engines/titanic/core/multi_drop_target.h
index ab552f9..048ce9d 100644
--- a/engines/titanic/core/multi_drop_target.h
+++ b/engines/titanic/core/multi_drop_target.h
@@ -31,11 +31,11 @@ class CMultiDropTarget : public CDropTarget {
 	DECLARE_MESSAGE_MAP;
 	bool DropObjectMsg(CDropObjectMsg *msg);
 public:
-	CString _string5;
-	CString _string6;
+	CString _dropFrames;
+	CString _dropNames;
 public:
 	CLASSDEF;
-	CMultiDropTarget() : CDropTarget(), _string5("1,2") {}
+	CMultiDropTarget() : CDropTarget(), _dropFrames("1,2") {}
 
 	/**
 	 * Save the data for the class to file





More information about the Scummvm-git-logs mailing list