From 413332462f8bab11397c72cb0f675fb562e0e539 Mon Sep 17 00:00:00 2001 From: lucas lelievre Date: Sat, 30 Apr 2022 23:06:14 +0200 Subject: [PATCH] more readable version of it --- src/main/java/dev/slimevr/VRServer.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/main/java/dev/slimevr/VRServer.java b/src/main/java/dev/slimevr/VRServer.java index 43b513266..8862a3482 100644 --- a/src/main/java/dev/slimevr/VRServer.java +++ b/src/main/java/dev/slimevr/VRServer.java @@ -306,21 +306,18 @@ public class VRServer extends Thread { } public Tracker getTrackerById(TrackerIdT id) { - for (Tracker tracker : trackers) { if (tracker.getTrackerNum() != id.getTrackerNum()) { continue; } // Handle synthetic devices - if (id.getDeviceId() == null) { - if (tracker.getDevice() == null) - return tracker; - continue; + if (id.getDeviceId() == null && tracker.getDevice() == null) { + return tracker; } - // We now know that the argument is not a synthetic tracker - if (tracker.getDevice() != null && id.getDeviceId().getId() == tracker.getDevice().getId()) { + if (tracker.getDevice() != null && id.getDeviceId() != null && id.getDeviceId().getId() == tracker.getDevice().getId()) { + // This is a physical tracker, and both device id and the tracker num match return tracker; } }