Adjust GameInfoContainer and GameActivity so that importing a sudoku containing an invalid fixed value (e.g. a 9x9 sudoku containing an 'A' as a fixed value) no longer causes an exception.
This commit is contained in:
parent
80fa401666
commit
a8629fc75c
2 changed files with 6 additions and 1 deletions
|
@ -104,6 +104,11 @@ public class GameInfoContainer {
|
|||
fixedValues = new int[s.length()];
|
||||
for(int i = 0; i < s.length(); i++) {
|
||||
fixedValues[i] = Symbol.getValue(Symbol.SaveFormat, String.valueOf(s.charAt(i)))+1;
|
||||
if (gameType != GameType.Unspecified && gameType != null) {
|
||||
if (fixedValues[i] < 0 || fixedValues[i] > gameType.getSize()) {
|
||||
throw new IllegalArgumentException("Fixed values must each be smaller than " + gameType.getSize() + ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -125,8 +125,8 @@ public class GameActivity extends BaseActivity implements NavigationView.OnNavig
|
|||
GameType.Unspecified, new int [boardSize], new int [boardSize], new boolean [boardSize][sectionSize]);
|
||||
|
||||
try {
|
||||
container.parseFixedValues(input);
|
||||
container.parseGameType("Default_" + sectionSize + "x" + sectionSize);
|
||||
container.parseFixedValues(input);
|
||||
|
||||
difficultyCheck = new QQWing(container.getGameType(), GameDifficulty.Unspecified);
|
||||
difficultyCheck.setRecordHistory(true);
|
||||
|
|
Loading…
Reference in a new issue