From 55e1f66daaa54362dd7db43b382de45686b5b459 Mon Sep 17 00:00:00 2001 From: Bryson Zimmerman Date: Sun, 27 Oct 2024 21:58:10 -0400 Subject: [PATCH] Adjusted TileProperties to prevent issues with double-adding or double-removing the same direction, not that this should happen. --- src/main/kotlin/data/TileProperties.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/kotlin/data/TileProperties.kt b/src/main/kotlin/data/TileProperties.kt index 6561a59..b59f073 100644 --- a/src/main/kotlin/data/TileProperties.kt +++ b/src/main/kotlin/data/TileProperties.kt @@ -19,14 +19,15 @@ value class TileProperties(val connections: Int) { } //Remove a direction from the list of connections + @SuppressWarnings fun remove(dir: Directions): TileProperties { - return this - dir + return TileProperties(connections and(dir.dir.inv())) } //Add a direction to the list of connections //Should only be accessed by the Tile class fun add(dir: Directions): TileProperties { - return this + dir + return TileProperties(this.connections or(dir.dir)) } operator fun plus(dir: Directions): TileProperties {