diff options
author | Colin Snover | 2018-01-30 10:42:08 -0600 |
---|---|---|
committer | D G Turner | 2018-08-01 16:44:51 +0100 |
commit | 8f7f7a9c2bde9be595d53aee1c41f1f6918ddd6e (patch) | |
tree | 0e5970be8bdcf85aed6aeb47611a491228d636ef | |
parent | 65b108b4cf95158d446b0e3d9a772a84ed417312 (diff) | |
download | scummvm-rg350-8f7f7a9c2bde9be595d53aee1c41f1f6918ddd6e.tar.gz scummvm-rg350-8f7f7a9c2bde9be595d53aee1c41f1f6918ddd6e.tar.bz2 scummvm-rg350-8f7f7a9c2bde9be595d53aee1c41f1f6918ddd6e.zip |
PARALLACTION: Fix invalid array access at dialogue selection
Also removes an unnecessary second condition check for oldAnswer
by moving that closer to its point of use.
-rw-r--r-- | engines/parallaction/dialogue.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp index 4dbedc8dbe..ee92eee439 100644 --- a/engines/parallaction/dialogue.cpp +++ b/engines/parallaction/dialogue.cpp @@ -253,15 +253,14 @@ int16 DialogueManager::selectAnswerN() { _selection = _balloonMan->hitTestDialogueBalloon(_mousePos.x, _mousePos.y); - VisibleAnswer *oldAnswer = (_oldSelection == NO_ANSWER_SELECTED) ? NULL : &_visAnswers[_oldSelection]; - VisibleAnswer *answer = &_visAnswers[_selection]; - if (_selection != _oldSelection) { if (_oldSelection != NO_ANSWER_SELECTED) { + VisibleAnswer *oldAnswer = &_visAnswers[_oldSelection]; _balloonMan->setBalloonText(oldAnswer->_balloon, oldAnswer->_a->_text, BalloonManager::kUnselectedColor); } if (_selection != NO_ANSWER_SELECTED) { + VisibleAnswer *answer = &_visAnswers[_selection]; _balloonMan->setBalloonText(answer->_balloon, answer->_a->_text, BalloonManager::kSelectedColor); _gfx->setItemFrame(_faceId, answer->_a->speakerMood()); } |