Allow eleven (instead of ten) sudokus to be saved by the GameStateManager if one of them is the daily sudoku

This commit is contained in:
uykek 2020-05-27 21:44:11 +02:00
parent 56db7277ca
commit 29933c01eb

View file

@ -20,6 +20,7 @@ public class GameStateManager {
Context context; Context context;
private SharedPreferences settings; private SharedPreferences settings;
private boolean includesDaily;
private static String FILE_EXTENSION = ".txt"; private static String FILE_EXTENSION = ".txt";
private static String SAVE_PREFIX = "save_"; private static String SAVE_PREFIX = "save_";
@ -87,6 +88,11 @@ public class GameStateManager {
gic.parseSetValues(values[i++]); gic.parseSetValues(values[i++]);
gic.parseNotes(values[i++]); gic.parseNotes(values[i++]);
gic.parseHintsUsed(values[i++]); gic.parseHintsUsed(values[i++]);
if (gic.getID() == GameController.DAILY_SUDOKU_ID) {
includesDaily = true;
}
} catch(IllegalArgumentException e) { } catch(IllegalArgumentException e) {
file.delete(); file.delete();
continue; continue;
@ -108,7 +114,7 @@ public class GameStateManager {
LinkedList<GameInfoContainer> removeList = new LinkedList<>(); LinkedList<GameInfoContainer> removeList = new LinkedList<>();
for(int i = 0; i < list.size(); i++) { 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)); deleteGameStateFile(list.get(i));
removeList.add(list.get(i)); removeList.add(list.get(i));
} }