Skip to content

Conversation

@AnimaRain
Copy link
Owner

After beating the last level defined in the spawn pattern file and the game tries to go to the next level, the number of the next round exceeds the number of levels defined in the file. This patch fixes the game to loop back to the top of the pattern file, and know how to map any round to a level in the file.

Spawners where not always being stashed correctly. This caused
errors with the recursion, which led to not enough spawners being
added to the list, and not having enough spawners to assign the patterns.

Function SpawnerFactory had to be heavily reworked. Now it works correclty,
but is also simpler, and makes more sense.

Function ParseSpawnPattern is changed to return a dictionary instead of an array:
1) It is more convenient for being "piped" into SpawnerFactory.
2) It doesn't make sense converting the data from a dictionary to an array
before returning, and then converting the array back to a dictionary.

Signed-off-by: AnimaRain <[email protected]>
This refactoring is reverting some changes in commit 1cc85a6,
with some additional changes.

There is a possibility that, previously, convertions to ulong
were messing up the arithmetic results, but that has not been
confirmed. Either way, after these changes, there shouldn't be
this problem anyway.

Signed-off-by: AnimaRain <[email protected]>
Instead of, every time the number of levels is requested, going through
the XML file and counting the nodes, it is calculated once and stored
in a public property when the pattern file is loaded.

Signed-off-by: AnimaRain <[email protected]>
@AnimaRain AnimaRain requested a review from 25thBam May 29, 2021 16:03
@AnimaRain AnimaRain self-assigned this May 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants