Skip to content
Snippets Groups Projects
Commit 8f73e9b0 authored by deuce's avatar deuce
Browse files

Rewrite the Wrap() function to avoid the round-trip required for

console.getxy() which was potentially called multiple times per line.

Greatly speeds up menu display for non-local users.
parent f9c7f33e
No related branches found
No related tags found
No related merge requests found
......@@ -19,30 +19,24 @@ function ClearArea(fromRow,fromColumn,qty)
}
function Wrap(msg,lst)
{
var coords=console.getxy();
console.pushxy();
console.putmsg(msg);
console.gotoxy(30,coords.y); coords.y++;
console.popxy();
console.right(29);
console.putmsg("\1w\1h: ");
if(!lst.length)
{
console.crlf();
return;
}
var bb=0;
var col=32;
var delimiter="\1n\1g,";
for(aa=0;aa<lst.length;aa++)
{
if(bb>=16)
{
var check=console.getxy();
if(check.x>77) {
console.gotoxy(32,coords.y); coords.y++;
bb=0;
}
}
if(aa==lst.length-1) delimiter="";
console.putmsg("\1h\1g" + lst[aa] + delimiter);
bb++;
var item=lst[aa]+delimiter;
if((col + console.strlen(item))>79) {
console.crlf();
console.right(31);
col=32;
}
console.putmsg("\1h\1g" + item);
col += console.strlen(item);
}
console.crlf();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment