aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction/dialogue.cpp
diff options
context:
space:
mode:
authorNicola Mettifogo2009-10-15 13:40:39 +0000
committerNicola Mettifogo2009-10-15 13:40:39 +0000
commit017b0e0acb5b844bf002c093e11f03cfc343c34f (patch)
tree3a235bec9836ea7c03f1e611185cf72939824894 /engines/parallaction/dialogue.cpp
parente5c88ffc7a4a6b7d86d69a27900ae52b33f2e181 (diff)
downloadscummvm-rg350-017b0e0acb5b844bf002c093e11f03cfc343c34f.tar.gz
scummvm-rg350-017b0e0acb5b844bf002c093e11f03cfc343c34f.tar.bz2
scummvm-rg350-017b0e0acb5b844bf002c093e11f03cfc343c34f.zip
Fixed bug 2879785. Dialogue commands were partly executed too early: see comment at line 480 in dialogue.cpp.
svn-id: r45120
Diffstat (limited to 'engines/parallaction/dialogue.cpp')
-rw-r--r--engines/parallaction/dialogue.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp
index 20a33a59c4..f5fbb50bf6 100644
--- a/engines/parallaction/dialogue.cpp
+++ b/engines/parallaction/dialogue.cpp
@@ -477,17 +477,21 @@ void Parallaction::exitDialogueMode() {
debugC(1, kDebugDialogue, "Parallaction::exitDialogueMode()");
_input->_inputMode = Input::kInputModeGame;
- if (_dialogueMan->_cmdList) {
- _cmdExec->run(*_dialogueMan->_cmdList);
- }
-
- // The current instance of _dialogueMan must be destroyed before the zone commands
- // are executed, because they may create another instance of _dialogueMan that
- // overwrite the current one. This would cause headaches (and it did, actually).
+ /* Since the current instance of _dialogueMan must be destroyed before the
+ zone commands are executed, as they may create a new instance of _dialogueMan that
+ would overwrite the current, we need to save the references to the command lists.
+ */
+ CommandList *_cmdList = _dialogueMan->_cmdList;
ZonePtr z = _dialogueMan->_z;
+
+ // destroy the _dialogueMan here
delete _dialogueMan;
_dialogueMan = 0;
+ // run the lists saved
+ if (_cmdList) {
+ _cmdExec->run(*_cmdList);
+ }
_cmdExec->run(z->_commands, z);
}