Merge pull request #60 from Vermilingua/save-fix

Save fix
This commit is contained in:
Michael Townsend
2013-10-30 15:20:11 -07:00
+6
View File
@@ -230,11 +230,17 @@ var Engine = {
export64: function() {
Engine.saveGame();
var string64 = Base64.encode(localStorage.gameState);
string64 = string64.replace(/\s/g, '');
string64 = string64.replace(/\W/g, '');
string64 = string64.replace(/\n/g, '');
prompt("save this.",string64);
},
import64: function() {
var string64 = prompt("put the save code here.","");
string64 = string64.replace(/\s/g, '');
string64 = string64.replace(/\W/g, '');
string64 = string64.replace(/\n/g, '');
var decodedSave = Base64.decode(string64);
localStorage.gameState = decodedSave;
location.reload();