diff options
author | Paul Gilbert | 2017-08-05 15:49:17 -0400 |
---|---|---|
committer | Paul Gilbert | 2017-08-05 15:49:17 -0400 |
commit | 5984111a26775f8b2065e3b4abc630cc539e13cd (patch) | |
tree | 9c20f64950adabf09bb61a558920cb922ec01a87 /engines/titanic | |
parent | 1fdf0c70d4c8359ba7799da771884b66a2ebc733 (diff) | |
download | scummvm-rg350-5984111a26775f8b2065e3b4abc630cc539e13cd.tar.gz scummvm-rg350-5984111a26775f8b2065e3b4abc630cc539e13cd.tar.bz2 scummvm-rg350-5984111a26775f8b2065e3b4abc630cc539e13cd.zip |
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
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/core/multi_drop_target.cpp | 19 | ||||
-rw-r--r-- | engines/titanic/core/multi_drop_target.h | 6 |
2 files changed, 15 insertions, 10 deletions
diff --git a/engines/titanic/core/multi_drop_target.cpp b/engines/titanic/core/multi_drop_target.cpp index b95696577f..bcdbcde173 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 ab552f96e1..048ce9df23 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 |