From f18104e7564b9d0b7a0377bd9510959d7a2d8867 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 24 Apr 2014 09:21:21 -0400 Subject: MADS: Fixed Conversation::read method --- engines/mads/user_interface.cpp | 12 ++++++++---- engines/mads/user_interface.h | 5 +++-- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'engines') diff --git a/engines/mads/user_interface.cpp b/engines/mads/user_interface.cpp index 9a63ac32ad..d4ab0d3dc5 100644 --- a/engines/mads/user_interface.cpp +++ b/engines/mads/user_interface.cpp @@ -258,16 +258,20 @@ void Conversation::set(int quoteId, ...) { va_end(va); } -bool Conversation::read(int quoteId) { +int Conversation::read(int quoteId) { uint16 flags = _vm->_game->globals()[_globalId]; + int count = 0; for (uint idx = 0; idx < _quotes.size(); ++idx) { - if (_quotes[idx] == quoteId) { + if (flags & (1 << idx)) + ++count; + + if (_quotes[idx] == quoteId) return flags & (1 << idx); - } } - return false; + // Could not find it, simply return number of active quotes + return count; } void Conversation::write(int quoteId, bool flag) { diff --git a/engines/mads/user_interface.h b/engines/mads/user_interface.h index 1e07681a6f..9948278a55 100644 --- a/engines/mads/user_interface.h +++ b/engines/mads/user_interface.h @@ -114,9 +114,10 @@ public: void set(int quoteId, ...); /** - * Returns true whether the given quote is enabled in the conversation + * Returns the bit for a given quote to indicate whether it's active or not or, + * if 0 is passed, returns the number of currently active quotes */ - bool read(int quoteId); + int read(int quoteId); /** * Activates or deactivates the specified quote in the given conversation node -- cgit v1.2.3