From 6c4ae7f19883dd7fa6de4fc3234351f1e33ba7a3 Mon Sep 17 00:00:00 2001 From: Ľubomír Remák Date: Sat, 21 Jul 2018 15:17:17 +0200 Subject: MUTATIONOFJB: Implement multiple speeches in one response line. --- engines/mutationofjb/commands/talkcommand.cpp | 5 ++--- engines/mutationofjb/commands/talkcommand.h | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'engines/mutationofjb/commands') diff --git a/engines/mutationofjb/commands/talkcommand.cpp b/engines/mutationofjb/commands/talkcommand.cpp index 18ce956696..8411e9080a 100644 --- a/engines/mutationofjb/commands/talkcommand.cpp +++ b/engines/mutationofjb/commands/talkcommand.cpp @@ -56,14 +56,13 @@ bool TalkCommandParser::parse(const Common::String &line, ScriptParseContext &, Command::ExecuteResult TalkCommand::execute(ScriptExecutionContext &scriptExeCtx) { if (!_task) { - _task = new ConversationTask(scriptExeCtx.getGameData()._currentScene, scriptExeCtx.getGame().getGameData()._conversationInfo); + _task = TaskPtr(new ConversationTask(scriptExeCtx.getGameData()._currentScene, scriptExeCtx.getGame().getGameData()._conversationInfo, _mode)); scriptExeCtx.getGame().getTaskManager().addTask(_task); } if (_task->getState() == Task::FINISHED) { scriptExeCtx.getGame().getTaskManager().removeTask(_task); - delete _task; - _task = nullptr; + _task.reset(); return Command::Finished; } diff --git a/engines/mutationofjb/commands/talkcommand.h b/engines/mutationofjb/commands/talkcommand.h index 09424b2f06..15b185c613 100644 --- a/engines/mutationofjb/commands/talkcommand.h +++ b/engines/mutationofjb/commands/talkcommand.h @@ -25,6 +25,7 @@ #include "mutationofjb/commands/seqcommand.h" #include "common/scummsys.h" +#include "mutationofjb/tasks/task.h" namespace MutationOfJB { @@ -43,13 +44,13 @@ public: CARNIVAL_TICKET_SELLER_MODE }; - TalkCommand(Mode mode) : _mode(mode), _task(nullptr) {} + TalkCommand(Mode mode) : _mode(mode) {} virtual ExecuteResult execute(ScriptExecutionContext &scriptExecCtx) override; virtual Common::String debugString() const; private: Mode _mode; - ConversationTask *_task; + TaskPtr _task; }; } -- cgit v1.2.3