Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/humla.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/se/lublin/humla/model/WhisperTargetList.java5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main/java/se/lublin/humla/model/WhisperTargetList.java b/src/main/java/se/lublin/humla/model/WhisperTargetList.java
index e76cc0a..172999a 100644
--- a/src/main/java/se/lublin/humla/model/WhisperTargetList.java
+++ b/src/main/java/se/lublin/humla/model/WhisperTargetList.java
@@ -42,7 +42,7 @@ public class WhisperTargetList {
*/
public byte append(WhisperTarget target) {
byte freeId = -1;
- for (byte i = TARGET_MIN; i < TARGET_MAX; i++) {
+ for (byte i = TARGET_MIN; i <= TARGET_MAX; i++) {
if ((mTakenIds & (1 << i)) == 0) {
freeId = i;
break;
@@ -50,13 +50,14 @@ public class WhisperTargetList {
}
if (freeId != -1) {
mActiveTargets[freeId - TARGET_MIN] = target;
+ mTakenIds |= (1 << freeId);
}
return freeId;
}
public WhisperTarget get(byte id) {
- if ((mTakenIds & (1 << id)) > 0)
+ if ((mTakenIds & (1 << id)) == 0)
return null;
return mActiveTargets[id - TARGET_MIN];
}