diff options
author | Eugene Sandulenko | 2018-03-30 19:06:31 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2018-03-30 19:07:44 +0200 |
commit | 658b58419b0c30efbb671431f3b4158d225cec7d (patch) | |
tree | d4cc0c0a6e1e2929970af231058abb49b41038a5 | |
parent | 695e1de737a03f01df4eff96415c07ca5c03cc19 (diff) | |
download | scummvm-rg350-658b58419b0c30efbb671431f3b4158d225cec7d.tar.gz scummvm-rg350-658b58419b0c30efbb671431f3b4158d225cec7d.tar.bz2 scummvm-rg350-658b58419b0c30efbb671431f3b4158d225cec7d.zip |
BLADERUNNER: Further work on acquireCluesByRelations()
-rw-r--r-- | engines/bladerunner/actor_clues.cpp | 35 | ||||
-rw-r--r-- | engines/bladerunner/actor_clues.h | 8 |
2 files changed, 43 insertions, 0 deletions
diff --git a/engines/bladerunner/actor_clues.cpp b/engines/bladerunner/actor_clues.cpp index 3665f4de09..16b9002765 100644 --- a/engines/bladerunner/actor_clues.cpp +++ b/engines/bladerunner/actor_clues.cpp @@ -21,6 +21,7 @@ */ #include "bladerunner/actor_clues.h" +#include "bladerunner/actor.h" #include "bladerunner/bladerunner.h" #include "bladerunner/game_info.h" @@ -88,10 +89,40 @@ bool ActorClues::isAcquired(int clueId) const { #endif } +int ActorClues::getWeight(int clueId) const { + int clueIndex = findClueIndex(clueId); + if (clueIndex == -1) { + return 0; + } + return _clues[clueIndex].weight; +} + void ActorClues::acquireCluesByRelations(int actorId, int otherActorId) { warning("TODO: acquireCluesByRelations"); } +int ActorClues::findAcquirableCluesFromActor(int actorId, int targetActorId, CluesUS *list, int size) { + Actor *actor = _vm->_actors[actorId]; + Actor *otherActor = _vm->_actors[targetActorId]; + int count = 0; + int cluesCount = actor->_clues->getCount(); + + for (int i = 0; i < cluesCount; i++) { + int clueId = actor->_clues->getClueIdByIndex(i); + + if (actor->_clues->isAcquired(clueId) + && otherActor->_clues->getWeight(clueId) > 0 + && !otherActor->_clues->isAcquired(clueId)) { + list[count].clueId = clueId; + list[count].modifier = 0; + + count++; + } + } + + return count; +} + int ActorClues::getFromActorId(int clueId) const { int clueIndex = findClueIndex(clueId); if (clueIndex == -1) { @@ -171,6 +202,10 @@ int ActorClues::getCount() const { return _count; } +int ActorClues::getClueIdByIndex(int index) const { + return _clues[index].clueId; +} + void ActorClues::removeAll() { _count = 0; for (int i = 0; i < _maxCount; ++i) { diff --git a/engines/bladerunner/actor_clues.h b/engines/bladerunner/actor_clues.h index 8bf9011937..aa8693f71b 100644 --- a/engines/bladerunner/actor_clues.h +++ b/engines/bladerunner/actor_clues.h @@ -45,6 +45,11 @@ class ActorClues { byte flags; }; + struct CluesUS { + int clueId; + int modifier; + }; + BladeRunnerEngine *_vm; int _count; @@ -59,8 +64,10 @@ public: void acquire(int clueId, bool flag2, int fromActorId); void lose(int clueId); bool isAcquired(int clueId) const; + int getWeight(int clueId) const; void acquireCluesByRelations(int actorId, int otherActorId); + int findAcquirableCluesFromActor(int actorId, int targetActorId, CluesUS *list, int size); int getFromActorId(int clueId) const; @@ -75,6 +82,7 @@ public: int getField1(int clueId) const; int getCount() const; + int getClueIdByIndex(int index) const; void removeAll(); |