diff options
author | Paul Gilbert | 2017-09-24 14:09:24 -0400 |
---|---|---|
committer | Paul Gilbert | 2017-09-24 14:09:24 -0400 |
commit | 65811506f8bc92f8fd3bbf5c3ce51ef74da11af6 (patch) | |
tree | a7359c5255c4a48721e22f5304e8020e6a5396b1 | |
parent | 26183f7289281f515298cf0363a24d6ee4f5b685 (diff) | |
download | scummvm-rg350-65811506f8bc92f8fd3bbf5c3ce51ef74da11af6.tar.gz scummvm-rg350-65811506f8bc92f8fd3bbf5c3ce51ef74da11af6.tar.bz2 scummvm-rg350-65811506f8bc92f8fd3bbf5c3ce51ef74da11af6.zip |
TITANIC: Don't launch further bot speeches when exiting game
Previously, notifying bots to the end of a speech fragment was
done in ~TTtalker. Which caused problems when in progress talkers
were freed when exiting the game with a speech was in progress,
since it would try to start the next following speech fragment.
-rw-r--r-- | engines/titanic/true_talk/true_talk_manager.cpp | 1 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_talker.cpp | 12 | ||||
-rw-r--r-- | engines/titanic/true_talk/tt_talker.h | 7 |
3 files changed, 13 insertions, 7 deletions
diff --git a/engines/titanic/true_talk/true_talk_manager.cpp b/engines/titanic/true_talk/true_talk_manager.cpp index a7766e8d18..f8ac185351 100644 --- a/engines/titanic/true_talk/true_talk_manager.cpp +++ b/engines/titanic/true_talk/true_talk_manager.cpp @@ -212,6 +212,7 @@ void CTrueTalkManager::removeCompleted() { if (talker->_done) { i = _talkers.erase(i); + talker->speechEnded(); delete talker; } else { ++i; diff --git a/engines/titanic/true_talk/tt_talker.cpp b/engines/titanic/true_talk/tt_talker.cpp index b296ec25d1..a2c5e4cc97 100644 --- a/engines/titanic/true_talk/tt_talker.cpp +++ b/engines/titanic/true_talk/tt_talker.cpp @@ -34,7 +34,12 @@ void TTtalker::speechStarted(const CString &dialogueStr, uint dialogueId, uint s msg.execute(_npc, nullptr, MSGFLAG_BREAK_IF_HANDLED); } -TTtalker::~TTtalker() { +void TTtalker::endSpeech(int val) { + _done = true; + _talkEndState = val; +} + +void TTtalker::speechEnded() { CPetControl *petControl = _npc->getPetControl(); if (petControl) // Add in final line @@ -45,9 +50,4 @@ TTtalker::~TTtalker() { endedMsg.execute(_npc, nullptr, MSGFLAG_BREAK_IF_HANDLED); } -void TTtalker::endSpeech(int val) { - _done = true; - _talkEndState = val; -} - } // End of namespace Titanic diff --git a/engines/titanic/true_talk/tt_talker.h b/engines/titanic/true_talk/tt_talker.h index 60a2e56499..4f0b59c044 100644 --- a/engines/titanic/true_talk/tt_talker.h +++ b/engines/titanic/true_talk/tt_talker.h @@ -44,7 +44,6 @@ public: _dialogueId(0), _talkEndState(0), _done(0) {} TTtalker(CTrueTalkManager *owner, CTrueTalkNPC *npc) : _owner(owner), _npc(npc), _dialogueId(0), _talkEndState(0), _done(0) {} - ~TTtalker(); /** * Start a new speech @@ -55,6 +54,12 @@ public: * End the speech */ void endSpeech(int val); + + /** + * Called when a speech is finished, to signal to the associated character + * that the speech is over + */ + void speechEnded(); }; class TTtalkerList : public List<TTtalker> { |