From 29933c01eb9fc3558d1251fd944ab62128a306f6 Mon Sep 17 00:00:00 2001 From: uykek Date: Wed, 27 May 2020 21:44:11 +0200 Subject: [PATCH] Allow eleven (instead of ten) sudokus to be saved by the GameStateManager if one of them is the daily sudoku --- .../controller/GameStateManager.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/GameStateManager.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/GameStateManager.java index bebec31..c50ba6c 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/GameStateManager.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/controller/GameStateManager.java @@ -20,6 +20,7 @@ public class GameStateManager { Context context; private SharedPreferences settings; + private boolean includesDaily; private static String FILE_EXTENSION = ".txt"; private static String SAVE_PREFIX = "save_"; @@ -87,6 +88,11 @@ public class GameStateManager { gic.parseSetValues(values[i++]); gic.parseNotes(values[i++]); gic.parseHintsUsed(values[i++]); + + if (gic.getID() == GameController.DAILY_SUDOKU_ID) { + includesDaily = true; + } + } catch(IllegalArgumentException e) { file.delete(); continue; @@ -108,7 +114,7 @@ public class GameStateManager { LinkedList removeList = new LinkedList<>(); for(int i = 0; i < list.size(); i++) { - if(i >= MAX_NUM_OF_SAVED_GAMES) { + if((i >= MAX_NUM_OF_SAVED_GAMES && !includesDaily) || i > MAX_NUM_OF_SAVED_GAMES) { deleteGameStateFile(list.get(i)); removeList.add(list.get(i)); }