From 805dc466d02344a1368181f3cb852771d64a48a9 Mon Sep 17 00:00:00 2001 From: Thanasis Antoniou Date: Tue, 26 Mar 2019 02:06:33 +0200 Subject: BLADERUNNER: Resolve dead end state with Zuben McCoy should now always be able to gather enough clues to trigger Zuben throwing the soup (via the VK test question if he does not have the Lucy photo clue). --- engines/bladerunner/actor_clues.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'engines/bladerunner/actor_clues.cpp') diff --git a/engines/bladerunner/actor_clues.cpp b/engines/bladerunner/actor_clues.cpp index 1350b8d455..63dbbbf810 100644 --- a/engines/bladerunner/actor_clues.cpp +++ b/engines/bladerunner/actor_clues.cpp @@ -66,16 +66,25 @@ ActorClues::ActorClues(BladeRunnerEngine *vm, int cluesLimit) { void ActorClues::acquire(int clueId, bool flag2, int fromActorId) { int clueIndex = findClueIndex(clueId); - _clues[clueIndex].flags |= 0x01; - _clues[clueIndex].flags = (_clues[clueIndex].flags & ~0x02) | ((flag2 << 1) & 0x02); - _clues[clueIndex].fromActorId = fromActorId; - + if (clueIndex == -1) { // prevent assertion fault + // debug("Actor could not acquire clue: \"%s\" from %d", _vm->_crimesDatabase->getClueText(clueId), fromActorId); + return; + } else { + _clues[clueIndex].flags |= 0x01; + _clues[clueIndex].flags = (_clues[clueIndex].flags & ~0x02) | ((flag2 << 1) & 0x02); + _clues[clueIndex].fromActorId = fromActorId; // debug("Actor acquired clue: \"%s\" from %d", _vm->_crimesDatabase->getClueText(clueId), fromActorId); + } } void ActorClues::lose(int clueId) { int clueIndex = findClueIndex(clueId); - _clues[clueIndex].flags = 0; + if (clueIndex == -1) { // prevent assertion fault + // debug("Actor could not lose clue: \"%s\"", _vm->_crimesDatabase->getClueText(clueId)); + return; + } else { + _clues[clueIndex].flags = 0; + } } bool ActorClues::isAcquired(int clueId) const { -- cgit v1.2.3