[Scummvm-git-logs] scummvm master -> 658b58419b0c30efbb671431f3b4158d225cec7d

sev- sev at scummvm.org
Fri Mar 30 19:08:02 CEST 2018


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
658b58419b BLADERUNNER: Further work on acquireCluesByRelations()


Commit: 658b58419b0c30efbb671431f3b4158d225cec7d
    https://github.com/scummvm/scummvm/commit/658b58419b0c30efbb671431f3b4158d225cec7d
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2018-03-30T19:07:44+02:00

Commit Message:
BLADERUNNER: Further work on acquireCluesByRelations()

Changed paths:
    engines/bladerunner/actor_clues.cpp
    engines/bladerunner/actor_clues.h


diff --git a/engines/bladerunner/actor_clues.cpp b/engines/bladerunner/actor_clues.cpp
index 3665f4d..16b9002 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 8bf9011..aa8693f 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();
 





More information about the Scummvm-git-logs mailing list