Skip to content

Commit

Permalink
feat: add backreference from Room tile to UniqueRoom holder
Browse files Browse the repository at this point in the history
  • Loading branch information
My-Name-Is-Jeff committed Aug 15, 2024
1 parent c5f1556 commit 221debd
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class Room(override val x: Int, override val z: Int, var data: RoomData) : Tile
else -> CatlasConfig.colorRoom
}
}
var uniqueRoom: UniqueRoom? = null

fun getArrayPosition(): Pair<Int, Int> {
return Pair((x - DungeonScanner.startX) / 16, (z - DungeonScanner.startZ) / 16)
Expand All @@ -51,9 +52,13 @@ class Room(override val x: Int, override val z: Int, var data: RoomData) : Tile
val unique = DungeonInfo.uniqueRooms.find { it.name == roomName }

if (unique == null) {
DungeonInfo.uniqueRooms.add(UniqueRoom(column, row, this))
UniqueRoom(column, row, this).let {
DungeonInfo.uniqueRooms.add(it)
uniqueRoom = it
}
} else {
unique.addTile(column, row, this)
uniqueRoom = unique
}
}
}

0 comments on commit 221debd

Please sign in to comment.