From a752e9001c0b8cdd3928e2b7ed4413b3be3163a9 Mon Sep 17 00:00:00 2001 From: gregchan550 Date: Wed, 6 Sep 2023 21:11:51 +1000 Subject: [PATCH] Changed interator in getNearbyEntites to for loop because team 2 said it was breaking somewhere --- .../src/main/com/csse3200/game/entities/EntityService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/core/src/main/com/csse3200/game/entities/EntityService.java b/source/core/src/main/com/csse3200/game/entities/EntityService.java index c8c8823df..9c20b93d4 100644 --- a/source/core/src/main/com/csse3200/game/entities/EntityService.java +++ b/source/core/src/main/com/csse3200/game/entities/EntityService.java @@ -85,7 +85,9 @@ public Array getEntities() { public Array getNearbyEntities(Entity source, float radius) { Array nearbyEntities = new Array(); Array allEntities = ServiceLocator.getEntityService().getEntities(); - for (Entity otherEntity : allEntities) { + for (int i = 0; i < allEntities.size; i++) { + Entity otherEntity = allEntities.get(i); + if (source == otherEntity) continue; // Skip the source entity Vector2 positionSource = source.getPosition();