mkalus / JSpaceAlertMissionGenerator

Java-based mission generator for Czech games' Space Alert board game.
http://www.boardgamegeek.com/article/6878862
GNU General Public License v3.0
8 stars 6 forks source link

Not deep copying threatGroups #15

Closed nibuen closed 2 years ago

nibuen commented 2 years ago

In generatePhases() you aren't deep copying the new mutable object threatGroup which causes issues where you can generate missions with no threats as they have been removed in previous fitting patterns. Will link my fix to this in the Android repo.

https://github.com/mkalus/JSpaceAlertMissionGenerator/blob/9a007afc21b7ab63901dc8258fb1fce1b49714ef/src/main/java/de/beimax/spacealert/mission/MissionImpl.java#L744

nibuen commented 2 years ago

Here it is fixed on my repo, note I am probably going to significantly refactor into kotlin after this point so wanted to give you a sane spot to help fix: https://github.com/nibuen/SpaceAlertMissionGenerator/blob/94e5f6efcf3417e152cb8e815db0681f1fe298cc/app/src/main/java/com/boarbeard/generator/beimax/MissionImpl.java#L831

Here is the test that helped catch it: https://github.com/nibuen/SpaceAlertMissionGenerator/blob/94e5f6efcf3417e152cb8e815db0681f1fe298cc/app/src/test/java/com/boarbeard/generator/beimax/TestMissionImplJvm.kt#L112

mkalus commented 2 years ago

Arg, thanks for catching this! You are right, this is needed. And the move to Kotlin is definitely a sane one! I have been contemplating about something like this myself, but lack time to do so atm.