aboutsummaryrefslogtreecommitdiff
path: root/engines/bladerunner/actor_clues.cpp
diff options
context:
space:
mode:
authorPeter Kohaut2016-10-06 00:59:11 +0200
committerPeter Kohaut2016-10-06 00:59:11 +0200
commite0efee2eba7328914741340c2330056be8f27205 (patch)
tree5c5d9e370f8385cd9e330f27eba5e5a2d6b0a4a1 /engines/bladerunner/actor_clues.cpp
parent5d1e1131dc48f65de2f7c00bef3989df8d0d809f (diff)
downloadscummvm-rg350-e0efee2eba7328914741340c2330056be8f27205.tar.gz
scummvm-rg350-e0efee2eba7328914741340c2330056be8f27205.tar.bz2
scummvm-rg350-e0efee2eba7328914741340c2330056be8f27205.zip
BLADERUNNER: added suspects db & fixed crimes db
Diffstat (limited to 'engines/bladerunner/actor_clues.cpp')
-rw-r--r--engines/bladerunner/actor_clues.cpp54
1 files changed, 32 insertions, 22 deletions
diff --git a/engines/bladerunner/actor_clues.cpp b/engines/bladerunner/actor_clues.cpp
index 9c0a61c2cc..a84d54906b 100644
--- a/engines/bladerunner/actor_clues.cpp
+++ b/engines/bladerunner/actor_clues.cpp
@@ -22,7 +22,7 @@
#include "bladerunner/actor_clues.h"
-#include "bladerunner/clues.h"
+#include "bladerunner/crimes_database.h"
#include "common/debug.h"
@@ -53,20 +53,23 @@ ActorClues::ActorClues(BladeRunnerEngine *vm, int cluesType) {
return;
}
- if (_maxCount > 0)
+ if (_maxCount > 0) {
_clues = new ActorClue[_maxCount];
- else
- _clues = NULL;
+ } else {
+ _clues = nullptr;
+ }
- if (_clues)
+ if (_clues) {
removeAll();
- else
+ } else {
_maxCount = 0;
+ }
}
ActorClues::~ActorClues() {
- if (_clues)
+ if (_clues) {
delete[] _clues;
+ }
_maxCount = 0;
_count = 0;
@@ -78,7 +81,7 @@ void ActorClues::acquire(int clueId, char flag2, int fromActorId) {
_clues[_count]._flags = (_clues[_count]._flags & ~0x02) | ((flag2 << 1) & 0x02);
_clues[clueIndex]._fromActorId = fromActorId;
- debug("Actor acquired clue: \"%s\" from %d", _vm->_clues->getClueText(clueId), fromActorId);
+ debug("Actor acquired clue: \"%s\" from %d", _vm->_crimesDatabase->getClueText(clueId), fromActorId);
}
void ActorClues::lose(int clueId) {
@@ -88,51 +91,58 @@ void ActorClues::lose(int clueId) {
bool ActorClues::isAcquired(int clueId) {
int clueIndex = findClueIndex(clueId);
- if (clueIndex == -1)
- return 0;
+ if (clueIndex == -1) {
+ return false;
+ }
return _clues[clueIndex]._flags & 0x01;
}
int ActorClues::getFromActorId(int clueId) {
int clueIndex = findClueIndex(clueId);
- if (clueIndex == -1)
+ if (clueIndex == -1) {
return -1;
+ }
return _clues[clueIndex]._fromActorId;
}
bool ActorClues::isFlag2(int clueId) {
int clueIndex = findClueIndex(clueId);
- if (clueIndex == -1)
- return 0;
+ if (clueIndex == -1) {
+ return false;
+ }
return (_clues[clueIndex]._flags & 0x02) >> 1;
}
bool ActorClues::isFlag3(int clueId) {
int clueIndex = findClueIndex(clueId);
- if (clueIndex == -1)
- return 0;
+ if (clueIndex == -1) {
+ return false;
+ }
return (_clues[clueIndex]._flags & 0x04) >> 2;
}
bool ActorClues::isFlag4(int clueId) {
int clueIndex = findClueIndex(clueId);
- if (clueIndex == -1)
- return 0;
+ if (clueIndex == -1) {
+ return false;
+ }
return (_clues[clueIndex]._flags & 0x08) >> 3;
}
int ActorClues::getField1(int clueId) {
- if (!_count)
+ if (!_count) {
return 0;
+ }
int clueIndex = findClueIndex(clueId);
- if (clueIndex == -1)
+ if (clueIndex == -1) {
return 0;
+ }
return _clues[clueIndex]._field1;
}
@@ -160,7 +170,7 @@ int ActorClues::findClueIndex(int clueId) {
void ActorClues::add(int actorId, int clueId, int unknown, bool acquired, bool unknownFlag, int fromActorId) {
assert(_count < _maxCount);
- debug("Actor %d added clue: \"%s\" from %d", actorId, _vm->_clues->getClueText(clueId), fromActorId);
+ debug("Actor %d added clue: \"%s\" from %d", actorId, _vm->_crimesDatabase->getClueText(clueId), fromActorId);
_clues[_count]._clueId = clueId;
_clues[_count]._field1 = unknown;
@@ -174,8 +184,8 @@ void ActorClues::add(int actorId, int clueId, int unknown, bool acquired, bool u
}
void ActorClues::remove(int index) {
- if (_vm->_clues)
- debug("Actor removed clue: \"%s\"", _vm->_clues->getClueText(_clues[index]._clueId));
+ if (_vm->_crimesDatabase)
+ debug("Actor removed clue: \"%s\"", _vm->_crimesDatabase->getClueText(_clues[index]._clueId));
_clues[index]._clueId = -1;
_clues[index]._field1 = 0;