From 448cc158c7569e56f692294b97f4fc7a7ffc5baa Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 28 Mar 2016 18:38:17 -0400 Subject: TITANIC: Fleshed out CStartAction class --- engines/titanic/game/start_action.cpp | 21 +++++++++++++++++---- engines/titanic/game/start_action.h | 12 +++++++++--- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/engines/titanic/game/start_action.cpp b/engines/titanic/game/start_action.cpp index 9bafd01282..05ceb9d0b0 100644 --- a/engines/titanic/game/start_action.cpp +++ b/engines/titanic/game/start_action.cpp @@ -21,6 +21,7 @@ */ #include "titanic/game/start_action.h" +#include "titanic/messages/messages.h" namespace Titanic { @@ -29,18 +30,30 @@ CStartAction::CStartAction() : CBackground() { void CStartAction::save(SimpleFile *file, int indent) const { file->writeNumberLine(1, indent); - file->writeQuotedLine(_string3, indent); - file->writeQuotedLine(_string4, indent); + file->writeQuotedLine(_msgTarget, indent); + file->writeQuotedLine(_msgAction, indent); CBackground::save(file, indent); } void CStartAction::load(SimpleFile *file) { file->readNumber(); - _string3 = file->readString(); - _string4 = file->readString(); + _msgTarget = file->readString(); + _msgAction = file->readString(); CBackground::load(file); } +bool CStartAction::handleMessage(CMouseButtonDownMsg &msg) { + // Dispatch the desired action to the desired target + CActMsg actMsg(_msgAction); + actMsg.execute(_msgTarget); + + return true; +} + +bool CStartAction::handleMessage(CMouseButtonUpMsg &msg) { + return true; +} + } // End of namespace Titanic diff --git a/engines/titanic/game/start_action.h b/engines/titanic/game/start_action.h index fc7a2ea514..2b19e77fe2 100644 --- a/engines/titanic/game/start_action.h +++ b/engines/titanic/game/start_action.h @@ -24,13 +24,19 @@ #define TITANIC_START_ACTION_H #include "titanic/core/background.h" +#include "titanic/messages/mouse_messages.h" namespace Titanic { -class CStartAction : public CBackground { +class CStartAction : public CBackground, + public CMouseButtonDownMsgTarget, + public CMouseButtonUpMsgTarget { protected: - CString _string3; - CString _string4; + CString _msgTarget; + CString _msgAction; +protected: + virtual bool handleMessage(CMouseButtonDownMsg &msg); + virtual bool handleMessage(CMouseButtonUpMsg &msg); public: CLASSDEF CStartAction(); -- cgit v1.2.3