diff options
Diffstat (limited to 'engines/titanic/messages/messages.cpp')
-rw-r--r-- | engines/titanic/messages/messages.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/engines/titanic/messages/messages.cpp b/engines/titanic/messages/messages.cpp index c2a6197d4a..f9648f9dfb 100644 --- a/engines/titanic/messages/messages.cpp +++ b/engines/titanic/messages/messages.cpp @@ -22,6 +22,7 @@ #include "titanic/messages/messages.h" #include "titanic/core/game_object.h" +#include "titanic/core/tree_item.h" namespace Titanic { @@ -37,4 +38,32 @@ void CMessage::load(SimpleFile *file) { CSaveableObject::load(file); } +bool CMessage::execute(CTreeItem *target, const ClassDef *classDef, int flags) { + // If no target was specified, then there's nothing to do + if (!target) + return false; + + bool result = false; + CTreeItem *item = target; + CTreeItem *nextItem = nullptr; + do { + if (flags & MSGFLAG_SCAN) + nextItem = item->scan(target); + + if (!(flags & MSGFLAG_CLASS_DEF) || item->isInstanceOf(*classDef)) { + bool handled = true; // item->handleEvent(this); + + if (handled) { + result = true; + if (flags & MSGFLAG_BREAK_IF_HANDLED) + return true; + } + } + + item = nextItem; + } while (nextItem); + + return result; +} + } // End of namespace Titanic |