Describe the bug
TileList.finish() passes this.getData() to the constructor of a CopyOnWriteArrayList. This copies all of the tiles into tileList. The for loop in this function also adds every tile to the list with tileList.add().
Stack Trace
No error for this bug.
To Reproduce
Steps to reproduce the behavior:
Load a map
Call map.getTileLayers() to get a collection of the map's layers
Call layer.getTiles().size() on one of the layers.
Result: the size is twice the expected size.
Expected behavior
I would expect layer.getTiles().size() to return the map's tileWidth * tileHeight.
Screenshots
In my particular case, I'm adding collision boxes based on tile IDs. Because I was using layer.getTiles() to retrieve all of the tiles, my code was adding every collision box twice:
Describe the bug TileList.finish() passes this.getData() to the constructor of a CopyOnWriteArrayList. This copies all of the tiles into tileList. The for loop in this function also adds every tile to the list with tileList.add().
Stack Trace No error for this bug.
To Reproduce Steps to reproduce the behavior:
Expected behavior I would expect layer.getTiles().size() to return the map's tileWidth * tileHeight.
Screenshots In my particular case, I'm adding collision boxes based on tile IDs. Because I was using layer.getTiles() to retrieve all of the tiles, my code was adding every collision box twice:![image](https://user-images.githubusercontent.com/6335915/190878738-8299650d-53f4-4715-b9dc-5c856242c59b.png)
Your System:
Additional context Looks like this is the commit that added this bug: https://github.com/gurkenlabs/litiengine/commit/4cfe6edddef1deafe1bf64d35bd8531b17332ea2