aboutsummaryrefslogtreecommitdiff
path: root/engines/titanic
diff options
context:
space:
mode:
authorPaul Gilbert2018-03-17 14:06:26 -0400
committerPaul Gilbert2018-03-17 14:06:26 -0400
commit9ef97cd265172cabf69ec8dbfcbdc3c5a370a50e (patch)
tree5fb3c6897d63832896a177638c819b90bfa2367a /engines/titanic
parent5b50bad5e95808052048b9e5cd58cacc8c0dfac2 (diff)
downloadscummvm-rg350-9ef97cd265172cabf69ec8dbfcbdc3c5a370a50e.tar.gz
scummvm-rg350-9ef97cd265172cabf69ec8dbfcbdc3c5a370a50e.tar.bz2
scummvm-rg350-9ef97cd265172cabf69ec8dbfcbdc3c5a370a50e.zip
TITANIC: Fix DoorbotScript _stateIndex cycling check
Thanks to eriktorbjorn for pointing out the Coverity warning
Diffstat (limited to 'engines/titanic')
-rw-r--r--engines/titanic/true_talk/doorbot_script.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/engines/titanic/true_talk/doorbot_script.cpp b/engines/titanic/true_talk/doorbot_script.cpp
index d7389d1cb7..0b33704ba5 100644
--- a/engines/titanic/true_talk/doorbot_script.cpp
+++ b/engines/titanic/true_talk/doorbot_script.cpp
@@ -71,6 +71,8 @@ static const RoomDialogueId ROOM_DIALOGUES2_DE[] = {
DoorbotScript::DoorbotScript(int val1, const char *charClass, int v2,
const char *charName, int v3, int val2, int v4, int v5, int v6, int v7) :
TTnpcScript(val1, charClass, v2, charName, v3, val2, v4, v5, v6, v7) {
+ _stateIndex = _doorbotState = 0;
+
loadRanges("Ranges/Doorbot");
loadResponses("Responses/Doorbot");
setupSentences();
@@ -108,7 +110,7 @@ void DoorbotScript::setupSentences() {
int DoorbotScript::chooseResponse(const TTroomScript *roomScript, const TTsentence *sentence, uint tag) {
if (tag == MKTAG('D', 'N', 'A', '1') || tag == MKTAG('H', 'H', 'G', 'Q') ||
tag == MKTAG('A', 'N', 'S', 'W') || tag == MKTAG('S', 'U', 'M', 'S')) {
- if (_stateIndex > 9)
+ if (_stateIndex > 8)
_stateIndex = 0;
addResponse(TRANSLATE(STATE_ARRAY_EN[_stateIndex], STATE_ARRAY_DE[_stateIndex]));
applyResponse();