Skip to content

Commit f521599

Browse files
committed
patch squeaks
1 parent 2abb671 commit f521599

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

engine/src/main/battlecode/world/GameWorld.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,11 +1031,13 @@ public void squeak(InternalRobot robot, Message message) {
10311031
MapLocation robotLoc = robot.getLocation();
10321032
MapLocation[] locations = getAllLocationsWithinRadiusSquared(robotLoc, GameConstants.SQUEAK_RADIUS_SQUARED, 0); // chirality doesn't matter here
10331033

1034+
HashSet<Integer> squeakedIDs = new HashSet<>();
10341035
for (MapLocation loc : locations) {
10351036
InternalRobot otherRobot = getRobot(loc);
1036-
1037-
if (otherRobot != null && (otherRobot.getType().isCatType() || otherRobot.getTeam() == robot.getTeam())) {
1037+
1038+
if (otherRobot != null && (otherRobot.getID() != robot.getID()) && (!squeakedIDs.contains(otherRobot.getID())) && (otherRobot.getType().isCatType() || otherRobot.getTeam() == robot.getTeam())) {
10381039
otherRobot.addMessage(message.copy());
1040+
squeakedIDs.add(otherRobot.getID());
10391041
}
10401042
}
10411043

0 commit comments

Comments
 (0)