Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

...
 
Commits (1)
  • Deucе's avatar
    Disconnect Commit #2 · c27dd09f
    Deucе authored
    - In dorkit, start the timer if keyboard is invoked and
      dk.connection.active is false.
    - In LORD2, check for a CONNECTION_CLOSED key after getkey() where
      appropriate.
    - Also in LORD2, allow the busy flag to suspend pending timeouts.
    c27dd09f
......@@ -492,6 +492,13 @@ var dk = {
}
else if (js.terminated) {
dk.connection.inactive_time = system.timer;
js.terminate = true;
mswait(1);
return true;
}
else if (dk.connection.active === false) {
dk.connection.inactive_time = system.timer;
js.terminate = true;
mswait(1);
return true;
}
......
......@@ -52,6 +52,9 @@ function menu(title, blank_line, opts, cur)
dk.console.gotoxy(0, y + mctx.cur);
lw(' ');
switch(ret) {
case 'CONNECTION_CLOSED':
done = true;
break;
case 'KEY_UP':
case '8':
mctx.cur--;
......@@ -265,6 +268,7 @@ menu('`r0`c `r1 `%LORD II: CONFIGURE JS `r0', true, [
case 'KEY_ALT_7':
map.mapinfo[getoffset(x, y)].backcolour = 7;
break;
case 'CONNECTION_CLOSED':
case '\x1b':
dk.console.gotoxy(0, 22);
dk.console.attr.value = 2;
......@@ -305,6 +309,7 @@ menu('`r0`c `r1 `%LORD II: CONFIGURE JS `r0', true, [
if (++x >= 80)
x = 0;
break;
case 'CONNECTION_CLOSED':
case 'q':
return;
case '?':
......@@ -757,6 +762,7 @@ menu('`r0`c `r1 `%LORD II: CONFIGURE JS `r0', true, [
showname = !showname;
redraw = true;
break;
case 'CONNECTION_CLOSED':
case 'Q':
return false;
}
......@@ -1384,20 +1390,22 @@ menu('`r0`c `r1 `%LORD II: CONFIGURE JS `r0', true, [
{text:' `2(`4Q`2)uit & Save', shortcut:'Q', callback:function() {
var tmp;
dk.console.gotoxy(0, 23);
lln(' `0Saving changes. Thanks for using this product.');
if (save.game !== undefined)
save.game.put();
if (save.world !== undefined)
save.world.put();
for (tmp in save.map) {
save.map[tmp].put();
}
for (tmp in save.player) {
save.player[tmp].put();
}
for (tmp in save.item) {
save.item[tmp].put();
if (dk.connection.active) {
dk.console.gotoxy(0, 23);
lln(' `0Saving changes. Thanks for using this product.');
if (save.game !== undefined)
save.game.put();
if (save.world !== undefined)
save.world.put();
for (tmp in save.map) {
save.map[tmp].put();
}
for (tmp in save.player) {
save.player[tmp].put();
}
for (tmp in save.item) {
save.item[tmp].put();
}
}
return true
......
......@@ -514,6 +514,7 @@ function getkeyw()
var timeout = lastkey + idle_timeout;
var tl;
var now;
var ret;
do {
if (time_callback !== undefined) {
......@@ -531,7 +532,13 @@ function getkeyw()
}
} while(!dk.console.waitkey(1000));
lastkey = time();
return dk.console.getkey();
ret = dk.console.getkey();
if (ret === dk.console.key.CONNECTION_CLOSED) {
if (time_callback !== undefined) {
time_callback('DISCONNECTED');
}
}
return ret;
}
var curlinenum = 1;
......
......@@ -39,8 +39,9 @@ var pending_timeout;
function handle_timeout(reason)
{
if (player.battle) {
if (player.battle || player.busy) {
pending_timeout = reason;
dk.console.active = false;
return;
}
switch (reason) {
......@@ -51,6 +52,8 @@ function handle_timeout(reason)
case 'IDLE':
run_ref('notime', 'help.ref');
break;
case 'DISCONNECT':
break;
}
run_ref('endgame', 'gametxt.ref');
exit(0);
......@@ -207,6 +210,9 @@ function yes_no(y, title, question) {
do {
ch = getkey().toUpperCase();
switch (ch) {
case 'CONNECTION_CLOSED':
ch = '\r';
break;
case '8':
case 'KEY_UP':
case '4':
......@@ -461,7 +467,7 @@ function insane_run_ref(sec, fname, refret)
throw new Error('@do readspecial requires two arguments');
do {
ch = getkey().toUpperCase();
if (ch === '\r' || ch === '\x1b')
if (ch === '\r' || ch === '\x1b' || ch === 'CONNECTION_CLOSED')
ch = opts.substr(0, 1);
} while (opts.indexOf(ch) === -1);
setvar(args[0], ch);
......@@ -750,13 +756,14 @@ function insane_run_ref(sec, fname, refret)
lw(' `2They have nothing to sell. (press `%Q `2to continue)');
do {
ch = getkey.toUpperCase();
} while(ch !== 'Q');
} while(ch !== 'Q' && ch !== 'CONNECTION_CLOSED');
}
while(1) {
choice = items_menu(itms, cur, true, false, '', y+1, 22)
cur = choice.cur;
switch(choice.ch) {
case 'CONNECTION_CLOSED':
case 'Q':
return;
case '\r':
......@@ -1682,7 +1689,7 @@ rescan:
lw('`r0 `2You have nothing to sell. (press `%Q `2to continue)');
do {
ch = getkey().toUpperCase();
} while (ch != 'Q');
} while (ch != 'Q' && ch !== 'CONNECTION_CLOSED');
return;
}
......@@ -1793,6 +1800,7 @@ rescan:
case 'S':
p = 0;
break;
case 'CONNECTION_CLOSED':
case 'Q':
dk.console.attr.value = sattr;
return;
......@@ -2147,7 +2155,7 @@ function mail_check(messenger)
update_bar('`2A messenger stops you with the following news. (press `0R`2 to read it)', true);
do {
ch = getkey().toUpperCase();
} while (ch !== 'R');
} while (ch !== 'R' && ch !== 'CONNECTION_CLOSED');
lw('`r0`c');
}
......@@ -2339,6 +2347,7 @@ function hailed(pl)
}
if (dk.console.waitkey(game.delay)) {
switch(getkey().toUpperCase()) {
case 'CONNECTION_CLOSED':
case 'A':
exit = true;
break;
......@@ -2720,7 +2729,7 @@ rescan:
lw('`2 You are carrying nothing! (press `%Q`2 to continue)');
do {
ch = getkey().toUpperCase();
} while (ch != 'Q');
} while (ch != 'Q' && ch !== 'CONNECTION_CLOSED');
return;
}
else {
......@@ -2890,6 +2899,7 @@ function hbar(x, y, opts, cur)
if (cur >= opts.length)
cur = 0;
break;
case 'CONNECTION_CLOSED':
case '\r':
return cur;
}
......@@ -3172,7 +3182,7 @@ function mail_to(pl, quotes)
ch = '\r';
}
}
} while (ch !== '\r');
} while (ch !== '\r' && ch !== 'CONNECTION_CLOSED');
if (l.length === 0 && msg.length === 0) {
sln('');
lln(' `2Mail aborted');
......@@ -3304,6 +3314,7 @@ function vbar(choices, args)
}
ret.cur = choices.length - 1;
break;
case 'CONNECTION_CLOSED':
case '\r':
movetoend();
return ret;
......@@ -3723,7 +3734,7 @@ function hail()
lw('`r0 `2You have nothing to give, loser. (press `%Q `2to continue)');
do {
ch = getkey().toUpperCase();
} while (ch !== 'Q');
} while (ch !== 'Q' && ch !== 'CONNECTION_CLOSED');
}
else {
if (online) {
......@@ -3906,6 +3917,7 @@ function hail()
if (page != pages - 1)
erase_menu();
page = pages - 1;
case 'CONNECTION_CLOSED':
case '\r':
break;
}
......@@ -4259,12 +4271,15 @@ function do_map()
case 'P':
run_ref('whoison', 'help.ref');
break;
case 'CONNECTION_CLOSED':
ch = 'Q';
break;
case 'Q':
dk.console.gotoxy(0, 22);
lw('`r0`2 Are you sure you want to quit back to the BBS? [`%Y`2] : ');
do {
ch = getkey().toUpperCase();
} while('YN\r'.indexOf(ch) === -1);
} while(['Y', 'N', '\r', 'CONNECTION_CLOSED'].indexOf(ch) === -1);
if (ch === 'N') {
dk.console.gotoxy(0, 22);
dk.console.cleareol();
......
No preview for this file type