Fix the 'Executing NaN bunnies' bug, I hope

This commit is contained in:
Eric Fredricksen
2018-09-13 22:21:00 -07:00
committed by Eric Fredricksen
parent 18720d057b
commit 8dc94f2c2a
+7 -7
View File
@@ -233,7 +233,7 @@ function MonsterTask(level) {
var qty = 1; var qty = 1;
if (level-lev > 10) { if (level-lev > 10) {
// lev is too low. multiply... // lev is too low. multiply...
qty = Math.floor((level + Random(lev)) / Max(lev,1)); qty = Math.floor((level + Random(Max(lev,1))) / Max(lev,1));
if (qty < 1) qty = 1; if (qty < 1) qty = 1;
level = Math.floor(level / qty); level = Math.floor(level / qty);
} }
@@ -970,9 +970,9 @@ function FormCreate() {
if (window.showModalDialog) if (window.showModalDialog)
pause(100); pause(100);
// Just accept some data loss - alert is too ugly. Maybe increase save // Just accept some data loss - alert is too ugly. Maybe increase save
// frequency. // frequency.
// else alert("Game saved"); // else alert("Game saved");
} }
}); });
@@ -988,7 +988,7 @@ function FormCreate() {
function pause(msec) { function pause(msec) {
window.showModalDialog("javascript:document.writeln ('<script>window.setTimeout(" + window.showModalDialog("javascript:document.writeln ('<script>window.setTimeout(" +
"function () { window.close(); }," + msec + ");</script>')", "function () { window.close(); }," + msec + ");</script>')",
null, null,
"dialogWidth:0;dialogHeight:0;dialogHide:yes;unadorned:yes;"+ "dialogWidth:0;dialogHeight:0;dialogHide:yes;unadorned:yes;"+
"status:no;scroll:no;center:no;dialogTop:-10000;dialogLeft:-10000"); "status:no;scroll:no;center:no;dialogTop:-10000;dialogLeft:-10000");
} }
@@ -1056,7 +1056,7 @@ function LoadGame(sheet) {
if (iOS) title = GameSaveName(); if (iOS) title = GameSaveName();
document.title = title; document.title = title;
} }
randseed(game.seed); randseed(game.seed);
$.each(AllBars.concat(AllLists), function (i, e) { e.load(game); }); $.each(AllBars.concat(AllLists), function (i, e) { e.load(game); });
@@ -1123,12 +1123,12 @@ function FormKeyDown(e) {
Brag('brag'); Brag('brag');
//Navigate(GetHostAddr() + 'name=' + UrlEncode(Get(Traits,'Name'))); //Navigate(GetHostAddr() + 'name=' + UrlEncode(Get(Traits,'Name')));
} }
if (key === 'g') { if (key === 'g') {
game.guild = InputBox('Choose a guild.\r\rMake sure you undestand the guild rules before you join one. To learn more about guilds, visit http://progressquest.com/guilds.php', game.guild); game.guild = InputBox('Choose a guild.\r\rMake sure you undestand the guild rules before you join one. To learn more about guilds, visit http://progressquest.com/guilds.php', game.guild);
Brag("guild"); Brag("guild");
} }
if (key === 'm') { if (key === 'm') {
game.motto = InputBox('Declare your motto!', game.motto); game.motto = InputBox('Declare your motto!', game.motto);
Brag('motto'); Brag('motto');