Loreinator / Shuffle-Move

Program to help choose moves in the Pokemon Shuffle puzzle game
GNU General Public License v3.0
95 stars 18 forks source link

Bug when applying edits to the team in the Team Editor #81

Closed kpwbo closed 8 years ago

kpwbo commented 8 years ago

Bug Report (click on the "Download This File" button).

There seems to be a bug that may happen when editing the team while loading a new stage with an initial layout. Here's an example on how to replicate the bug (based on the bug report file above) : 1) Open Shuffle Move. The board should be empty and set on stage 216 (Gothorita), with a team of 5 Pokémon and Metal blocks. 2) Open the Team Editor (Team -> Edit). 3) Select stage 205 (Excadrill) in the drop-down list 4) Click on the "Clear Team" button. 5) Click on the "Apply" button. Stage 205's initial layout should now be shown on the board. However, the team is still the same (it is not cleared as it would have been expected to be). A second click on the "Apply" button is needed to clear the team.

Loreinator commented 8 years ago

Confirmed reproducible in v0.3.32. Investigating cause now.

Loreinator commented 8 years ago

Cause found:

Line 444 in ShuffleModel.java was setting the team to the previous team if the new stage has no team or an empty team.

The logic after this fix will be as follows:

In the team editor, allow inheritance of the previous team or the default team if the new stage does not have a non-empty team.

When the team editor sets its data into the model, first set the stage then set the team data. This ensures that the team data mirrors the team editor's data exactly.

When stages switch in the main program normally they will still retain the previous functionality of inheritance of the old team if the new stage's team is not a non-empty team.