From a35550d200a9e19894571758afe992185c6c6176 Mon Sep 17 00:00:00 2001 From: athrxx Date: Tue, 27 Dec 2011 21:50:07 +0100 Subject: KYRA: (EOB) - fix invalid string access in EOB 1 (when entering the memorize/pray menu without having a mage/cleric) --- engines/kyra/eobcommon.cpp | 3 +++ engines/kyra/gui_eob.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/engines/kyra/eobcommon.cpp b/engines/kyra/eobcommon.cpp index bc01fead6b..304d1a4539 100644 --- a/engines/kyra/eobcommon.cpp +++ b/engines/kyra/eobcommon.cpp @@ -1059,6 +1059,9 @@ int EoBCoreEngine::countCharactersWithSpecificItems(int16 itemType, int16 itemVa } int EoBCoreEngine::checkInventoryForItem(int character, int16 itemType, int16 itemValue) { + if (character < 0 ) + return -1; + for (int i = 0; i < 27; i++) { uint16 inv = _characters[character].inventory[i]; if (!inv) diff --git a/engines/kyra/gui_eob.cpp b/engines/kyra/gui_eob.cpp index a80ef03201..512c13a977 100644 --- a/engines/kyra/gui_eob.cpp +++ b/engines/kyra/gui_eob.cpp @@ -3543,7 +3543,7 @@ int GUI_EoB::selectCharacterDialogue(int id) { _vm->removeInputTop(); _charSelectRedraw = false; - bool abort = false; + bool starvedUnconscious = false; int count = 0; int result = -1; int found[6]; @@ -3558,7 +3558,7 @@ int GUI_EoB::selectCharacterDialogue(int id) { continue; if (id != 53 && (!_vm->_characters[i].food || !_vm->testCharacter(i, 4))) { - abort = true; + starvedUnconscious = true; } else { found[i] = 0; result = i; @@ -3569,9 +3569,9 @@ int GUI_EoB::selectCharacterDialogue(int id) { if (!count) { int eid = 0; if (id == 23) - eid = abort ? 28 : 72; + eid = (starvedUnconscious || _vm->game() == GI_EOB1) ? 28 : 72; else if (id == 26) - eid = abort ? 27 : 73; + eid = (starvedUnconscious || _vm->game() == GI_EOB1) ? 27 : 73; else if (id == 49) eid = 52; -- cgit v1.2.3