yellowstonegames / SquidLib

Useful tools for roguelike, role-playing, strategy, and other grid-based games in Java. Feedback is welcome!
Other
454 stars 46 forks source link

DividedMazeGenerator.create throws java.lang.UnsupportedOperationException #206

Closed gioadami closed 5 years ago

gioadami commented 5 years ago

Invoking the following code (for S > 4)

DividedMazeGenerator mg = new DividedMazeGenerator(S, S); boolean map4[][] = mg.create();

generates the following stack trace:

Exception in thread "main" java.lang.UnsupportedOperationException: remove at java.base/java.util.Iterator.remove(Iterator.java:102) at java.base/java.util.AbstractCollection.remove(AbstractCollection.java:299) at squidpony.squidgrid.mapping.DividedMazeGenerator.process(DividedMazeGenerator.java:148) at squidpony.squidgrid.mapping.DividedMazeGenerator.create(DividedMazeGenerator.java:77) at squidtest.SquidMain.main(SquidMain.java:65)

tommyettinger commented 5 years ago

I'll take a look; I didn't write DividedMazeGenerator (or if I did, it was years ago), but this should be easy enough to fix. I may regret saying that...

tommyettinger commented 5 years ago

This has been fixed since April 5, 2018; my recommendation is to use JitPack to get the latest (or any recent) commit. You could just copy the relevant gradle configuration from a recently-updated SquidLib-Demos project, or from Epigon (links to both are in SquidLib's readme near the top). If you use Maven, you could copy working pom.xml dependencies from my tommyettinger/WarpWriter repo.

I haven't done an actual release in a while because JitPack has been working well for me. I may do a 3.0.0-b10 release at some point; some parts of SquidLib might need restructuring in some way (mainly related to simplex noise) and I don't want to release a stable 3.0.0 that's mid-refactor.

tommyettinger commented 5 years ago

The cause, for anyone interested, was that a List was made with Arrays.asList() and that doesn't support remove(). My solution is to avoid having a ton of List implementations around and to use Maker.makeList() to build an ArrayList directly, which does support deletion.