diff options
author | Paul Gilbert | 2014-04-24 09:21:21 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-04-24 09:21:21 -0400 |
commit | f18104e7564b9d0b7a0377bd9510959d7a2d8867 (patch) | |
tree | 6b163db99cf8640ae431e089ffcae51e51fa2c5c | |
parent | 1098246f2be705de82dd3077dd25323380c32dd1 (diff) | |
download | scummvm-rg350-f18104e7564b9d0b7a0377bd9510959d7a2d8867.tar.gz scummvm-rg350-f18104e7564b9d0b7a0377bd9510959d7a2d8867.tar.bz2 scummvm-rg350-f18104e7564b9d0b7a0377bd9510959d7a2d8867.zip |
MADS: Fixed Conversation::read method
-rw-r--r-- | engines/mads/user_interface.cpp | 12 | ||||
-rw-r--r-- | engines/mads/user_interface.h | 5 |
2 files changed, 11 insertions, 6 deletions
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 |