Change the way a custom sudoku is saved (add 'true' at the end of the byte stream) so that the GameStateManager can recognise custom levels when loading the sudokus the user has saved on his device

This commit is contained in:
uykek 2020-07-14 09:50:48 +02:00
parent 1c6be6e5c4
commit 2df51ac5ba
2 changed files with 10 additions and 0 deletions

View file

@ -89,6 +89,10 @@ public class GameStateManager {
gic.parseNotes(values[i++]); gic.parseNotes(values[i++]);
gic.parseHintsUsed(values[i++]); gic.parseHintsUsed(values[i++]);
if (values.length > i) {
gic.setCustom(true);
}
if (gic.getID() == GameController.DAILY_SUDOKU_ID) { if (gic.getID() == GameController.DAILY_SUDOKU_ID) {
includesDaily = true; includesDaily = true;
} }

View file

@ -185,6 +185,7 @@ public class GameInfoContainer {
public static String getGameInfo(GameController controller) { public static String getGameInfo(GameController controller) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
Date today = new Date(); Date today = new Date();
boolean custom = controller.gameIsCustom();
sb.append(controller.getGameType().name()); sb.append(controller.getGameType().name());
sb.append("/"); sb.append("/");
@ -202,6 +203,11 @@ public class GameInfoContainer {
sb.append("/"); sb.append("/");
sb.append(controller.getUsedHints()); sb.append(controller.getUsedHints());
if (custom) {
sb.append("/");
sb.append(custom);
}
String result = sb.toString(); String result = sb.toString();
Log.d("getGameInfo", result); Log.d("getGameInfo", result);