aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanasis Antoniou2019-09-05 13:13:21 +0300
committerThanasis Antoniou2019-09-05 13:17:53 +0300
commitac912a5023c83c4ac87a6e77c213f99d501cdd6b (patch)
tree96dd1b4ca982bfdee6551401b8b3c3ba247d58ae
parent541689eeb2f4ffd70ae7989e8313b2928de3ef11 (diff)
downloadscummvm-rg350-ac912a5023c83c4ac87a6e77c213f99d501cdd6b.tar.gz
scummvm-rg350-ac912a5023c83c4ac87a6e77c213f99d501cdd6b.tar.bz2
scummvm-rg350-ac912a5023c83c4ac87a6e77c213f99d501cdd6b.zip
BLADERUNNER: Revert previous changes in clues listing
Keep the important bug fix which was in KIASectionSuspects::populateAcquiredClues Some of the changes in the previous commit were due to confusing the role of the getClueIdByIndex method
-rw-r--r--engines/bladerunner/actor.cpp2
-rw-r--r--engines/bladerunner/actor_clues.cpp4
-rw-r--r--engines/bladerunner/ui/kia_section_clues.cpp4
-rw-r--r--engines/bladerunner/ui/kia_section_crimes.cpp4
-rw-r--r--engines/bladerunner/ui/kia_section_suspects.cpp2
5 files changed, 9 insertions, 7 deletions
diff --git a/engines/bladerunner/actor.cpp b/engines/bladerunner/actor.cpp
index e1ecefd8ae..7080b330a7 100644
--- a/engines/bladerunner/actor.cpp
+++ b/engines/bladerunner/actor.cpp
@@ -1254,7 +1254,7 @@ bool Actor::copyClues(int actorId) {
bool newCluesAcquired = false;
Actor *otherActor = _vm->_actors[actorId];
for (int i = 0; i < (int)_vm->_gameInfo->getClueCount(); i++) {
- int clueId = _clues->getClueIdByIndex(i);
+ int clueId = i;
if (hasClue(clueId) && !_clues->isPrivate(clueId) && otherActor->canAcquireClue(clueId) && !otherActor->hasClue(clueId)) {
int fromActorId = _id;
if (_id == BladeRunnerEngine::kActorVoiceOver) {
diff --git a/engines/bladerunner/actor_clues.cpp b/engines/bladerunner/actor_clues.cpp
index 4946113713..462cdc1bc3 100644
--- a/engines/bladerunner/actor_clues.cpp
+++ b/engines/bladerunner/actor_clues.cpp
@@ -318,7 +318,9 @@ int ActorClues::getCount() const {
}
int ActorClues::getClueIdByIndex(int index) const {
- if (index < 0) {
+ assert(index < _count);
+
+ if (index < 0 || index >= _count) {
return -1;
}
return _clues[index].clueId;
diff --git a/engines/bladerunner/ui/kia_section_clues.cpp b/engines/bladerunner/ui/kia_section_clues.cpp
index 9b9f6b7c00..ce14b9450d 100644
--- a/engines/bladerunner/ui/kia_section_clues.cpp
+++ b/engines/bladerunner/ui/kia_section_clues.cpp
@@ -283,7 +283,7 @@ void KIASectionClues::populateFilters() {
};
for (int i = 0; i < kClueCount; ++i) {
- int clueId = _clues->getClueIdByIndex(i);
+ int clueId = i;
if (_clues->isAcquired(clueId)) {
int assetType = _vm->_crimesDatabase->getAssetType(clueId);
int crimeId = _vm->_crimesDatabase->getCrime(clueId);
@@ -383,7 +383,7 @@ void KIASectionClues::populateFilters() {
void KIASectionClues::populateClues() {
_cluesScrollBox->clearLines();
for (int i = 0; i < kClueCount; ++i) {
- int clueId = _clues->getClueIdByIndex(i);
+ int clueId = i;
if (_clues->isAcquired(clueId)) {
int assetType = _vm->_crimesDatabase->getAssetType(clueId);
int crimeId = _vm->_crimesDatabase->getCrime(clueId);
diff --git a/engines/bladerunner/ui/kia_section_crimes.cpp b/engines/bladerunner/ui/kia_section_crimes.cpp
index 9061fff78b..8729002cf8 100644
--- a/engines/bladerunner/ui/kia_section_crimes.cpp
+++ b/engines/bladerunner/ui/kia_section_crimes.cpp
@@ -287,7 +287,7 @@ void KIASectionCrimes::onButtonPressed(int buttonId) {
void KIASectionCrimes::populateAcquiredClues() {
_acquiredClueCount = 0;
for (int i = 0; i < kClueCount; ++i) {
- int clueId = _clues->getClueIdByIndex(i);
+ int clueId = i;
if (_clues->isAcquired(clueId)) {
_acquiredClues[_acquiredClueCount].clueId = clueId;
_acquiredClues[_acquiredClueCount].actorId = _clues->getFromActorId(clueId);
@@ -377,7 +377,7 @@ void KIASectionCrimes::populateVisibleClues() {
_cluesScrollBox->clearLines();
if (_crimeSelected != -1) {
for (uint i = 0; i < kClueCount; ++i) {
- int clueId = _clues->getClueIdByIndex(i);
+ int clueId = i;
if (_vm->_crimesDatabase->getAssetType(clueId) != -1
&& _vm->_crimesDatabase->getCrime(clueId) == _crimeSelected
&& _clues->isAcquired(clueId)
diff --git a/engines/bladerunner/ui/kia_section_suspects.cpp b/engines/bladerunner/ui/kia_section_suspects.cpp
index ba1f6a5f7f..c98c2c77bf 100644
--- a/engines/bladerunner/ui/kia_section_suspects.cpp
+++ b/engines/bladerunner/ui/kia_section_suspects.cpp
@@ -380,7 +380,7 @@ void KIASectionSuspects::onButtonPressed(int buttonId) {
void KIASectionSuspects::populateAcquiredClues() {
_acquiredClueCount = 0;
for (int i = 0; i < kClueCount; ++i) {
- int clueId = _clues->getClueIdByIndex(i);
+ int clueId = i;
if (_clues->isAcquired(clueId)) {
_acquiredClues[_acquiredClueCount].clueId = clueId;
_acquiredClues[_acquiredClueCount].actorId = _clues->getFromActorId(clueId);