aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Snover2018-01-30 10:42:08 -0600
committerD G Turner2018-08-01 16:44:51 +0100
commit8f7f7a9c2bde9be595d53aee1c41f1f6918ddd6e (patch)
tree0e5970be8bdcf85aed6aeb47611a491228d636ef
parent65b108b4cf95158d446b0e3d9a772a84ed417312 (diff)
downloadscummvm-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.cpp5
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());
}