[Scummvm-git-logs] scummvm master -> 1f7df903da4e1d02803da17bb249485d6e6e420c

dreammaster dreammaster at scummvm.org
Sun Jan 22 04:40:23 CET 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:
1f7df903da TITANIC: Fix second parameter for isEquals method


Commit: 1f7df903da4e1d02803da17bb249485d6e6e420c
    https://github.com/scummvm/scummvm/commit/1f7df903da4e1d02803da17bb249485d6e6e420c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-01-21T22:40:13-05:00

Commit Message:
TITANIC: Fix second parameter for isEquals method

Changed paths:
    engines/titanic/carry/hose.cpp
    engines/titanic/core/drop_target.cpp
    engines/titanic/core/drop_target.h
    engines/titanic/core/named_item.cpp
    engines/titanic/core/named_item.h
    engines/titanic/core/tree_item.h


diff --git a/engines/titanic/carry/hose.cpp b/engines/titanic/carry/hose.cpp
index 3bfb4ea..cbca3be 100644
--- a/engines/titanic/carry/hose.cpp
+++ b/engines/titanic/carry/hose.cpp
@@ -103,7 +103,7 @@ bool CHose::HoseConnectedMsg(CHoseConnectedMsg *msg) {
 		CHose *hose = dynamic_cast<CHose *>(findChildInstanceOf(CHose::_type));
 		if (hose) {
 			setVisible(true);
-			petAddToInventory();
+			hose->petAddToInventory();
 		}
 	}
 
diff --git a/engines/titanic/core/drop_target.cpp b/engines/titanic/core/drop_target.cpp
index ffeab03..d021705 100644
--- a/engines/titanic/core/drop_target.cpp
+++ b/engines/titanic/core/drop_target.cpp
@@ -34,7 +34,7 @@ BEGIN_MESSAGE_MAP(CDropTarget, CGameObject)
 END_MESSAGE_MAP()
 
 CDropTarget::CDropTarget() : CGameObject(), _itemFrame(0),
-		_itemMatchSize(0), _showItem(false), _dropEnabled(false), _dropFrame(0),
+		_itemMatchStartsWith(false), _showItem(false), _dropEnabled(false), _dropFrame(0),
 		_dragFrame(0), _dragCursorId(CURSOR_ARROW), _dropCursorId(CURSOR_HAND),
 		_clipFlags(20) {
 }
@@ -44,7 +44,7 @@ void CDropTarget::save(SimpleFile *file, int indent) {
 	file->writePoint(_pos1, indent);
 	file->writeNumberLine(_itemFrame, indent);
 	file->writeQuotedLine(_itemMatchName, indent);
-	file->writeNumberLine(_itemMatchSize, indent);
+	file->writeNumberLine(_itemMatchStartsWith, indent);
 	file->writeQuotedLine(_soundName, indent);
 	file->writeNumberLine(_showItem, indent);
 	file->writeQuotedLine(_itemName, indent);
@@ -64,7 +64,7 @@ void CDropTarget::load(SimpleFile *file) {
 	_pos1 = file->readPoint();
 	_itemFrame = file->readNumber();
 	_itemMatchName = file->readString();
-	_itemMatchSize = file->readNumber();
+	_itemMatchStartsWith = file->readNumber();
 	_soundName = file->readString();
 	_showItem = file->readNumber();
 	_itemName = file->readString();
@@ -87,7 +87,7 @@ bool CDropTarget::DropObjectMsg(CDropObjectMsg *msg) {
 		}
 	}
 
-	if (!msg->_item->isEquals(_itemMatchName, _itemMatchSize))
+	if (!msg->_item->isEquals(_itemMatchName, _itemMatchStartsWith))
 		return false;
 
 	msg->_item->detach();
diff --git a/engines/titanic/core/drop_target.h b/engines/titanic/core/drop_target.h
index bdf8891..d77efb4 100644
--- a/engines/titanic/core/drop_target.h
+++ b/engines/titanic/core/drop_target.h
@@ -38,7 +38,7 @@ protected:
 	Point _pos1;
 	int _itemFrame;
 	CString _itemMatchName;
-	int _itemMatchSize;
+	bool _itemMatchStartsWith;
 	CString _soundName;
 	bool _showItem;
 	CString _itemName;
diff --git a/engines/titanic/core/named_item.cpp b/engines/titanic/core/named_item.cpp
index 9c4c28d..5fb4f8d 100644
--- a/engines/titanic/core/named_item.cpp
+++ b/engines/titanic/core/named_item.cpp
@@ -51,9 +51,9 @@ void CNamedItem::load(SimpleFile *file) {
 	CTreeItem::load(file);
 }
 
-bool CNamedItem::isEquals(const CString &name, int maxLen) const {
-	if (maxLen) {
-		return getName().left(maxLen).compareToIgnoreCase(name) == 0;
+bool CNamedItem::isEquals(const CString &name, bool startsWith) const {
+	if (startsWith) {
+		return getName().left(name.size()).compareToIgnoreCase(name) == 0;
 	} else {
 		return getName().compareToIgnoreCase(name) == 0;
 	}
diff --git a/engines/titanic/core/named_item.h b/engines/titanic/core/named_item.h
index 9ee3d49..9d46fe0 100644
--- a/engines/titanic/core/named_item.h
+++ b/engines/titanic/core/named_item.h
@@ -61,7 +61,7 @@ public:
 	/**
 	 * Returns true if the item's name matches a passed name
 	 */
-	virtual bool isEquals(const CString &name, int maxLen = 0) const;
+	virtual bool isEquals(const CString &name, bool startsWith = false) const;
 
 	/**
 	 * Find a parent node for the item
diff --git a/engines/titanic/core/tree_item.h b/engines/titanic/core/tree_item.h
index e92f5cd..498d2da4 100644
--- a/engines/titanic/core/tree_item.h
+++ b/engines/titanic/core/tree_item.h
@@ -127,7 +127,7 @@ public:
 	/**
 	 * Returns true if the item's name matches a passed name
 	 */
-	virtual bool isEquals(const CString &name, int maxLen = 0) const { return false; }
+	virtual bool isEquals(const CString &name, bool startsWith = false) const{ return false; }
 
 	/**
 	 * Compares the name of the item to a passed name





More information about the Scummvm-git-logs mailing list