equal
deleted
inserted
replaced
639 var maxValLimit = parseInt(document.getElementById("until-max-value").value); |
639 var maxValLimit = parseInt(document.getElementById("until-max-value").value); |
640 if (!isFinite(maxValLimit) || maxValLimit < 0 || maxValLimit > 13) { |
640 if (!isFinite(maxValLimit) || maxValLimit < 0 || maxValLimit > 13) { |
641 maxValLimit = 1; |
641 maxValLimit = 1; |
642 document.getElementById("until-max-value").value = maxValLimit; |
642 document.getElementById("until-max-value").value = maxValLimit; |
643 } |
643 } |
|
644 localStorage.untilScore = scoreLimit; |
|
645 localStorage.untilMaxVal = maxValLimit; |
644 while (true) { |
646 while (true) { |
645 if (board.gameOver(ui.board.position)) { |
647 if (board.gameOver(ui.board.position)) { |
646 ui.game.setMessage("Game over!"); |
648 ui.game.setMessage("Game over!"); |
647 break; |
649 break; |
648 } |
650 } |
892 //////////////////////////////////////////////////////////////// |
894 //////////////////////////////////////////////////////////////// |
893 // Initialise game. |
895 // Initialise game. |
894 |
896 |
895 ui.brdEngine = BoardArr2d; // TODO make user selectable |
897 ui.brdEngine = BoardArr2d; // TODO make user selectable |
896 |
898 |
|
899 if (localStorage.untilScore) { |
|
900 var scoreLimit = parseInt(localStorage.untilScore); |
|
901 if (isFinite(scoreLimit) && scoreLimit > 0) |
|
902 document.getElementById("until-score").value = scoreLimit; |
|
903 } |
|
904 if (localStorage.untilMaxVal) { |
|
905 var maxValLimit = parseInt(localStorage.untilMaxVal); |
|
906 if (isFinite(maxValLimit) && maxValLimit > 0 && maxValLimit <= 13) |
|
907 document.getElementById("until-max-value").value = maxValLimit; |
|
908 } |
|
909 |
897 if (localStorage.val2048) { |
910 if (localStorage.val2048) { |
898 try { |
911 try { |
899 ui.board.val2048Dom.checked = JSON.parse(localStorage.val2048); |
912 ui.board.val2048Dom.checked = JSON.parse(localStorage.val2048); |
900 } catch (ex) { } |
913 } catch (ex) { } |
901 } |
914 } |