1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940
|
/*
* node
*
* $Id: nOptions.c,v 1.7 2004/09/12 20:01:06 jon Exp $
*
* Copyright 1999-2004 Jon Trulson under the ARTISTIC LICENSE. (See LICENSE).
*/
#include "c_defs.h"
#include "context.h"
#include "global.h"
#include "datatypes.h"
#include "color.h"
#include "conf.h"
#include "conqcom.h"
#include "gldisplay.h"
#include "glmisc.h"
#include "node.h"
#include "client.h"
#include "clientlb.h"
#include "prm.h"
#include "nCP.h"
#include "nMenu.h"
#include "nDead.h"
#include "nOptions.h"
#include "cqkeys.h"
/* from conquestgl */
extern Unsgn8 clientFlags;
extern int lastServerError;
static int retnode; /* node to return to */
static int uopts = FALSE; /* are we doing user opts? */
#define S_NONE 0
#define S_USRMENU 1
#define S_SYSMENU 2
#define S_UOPTS 3 /* changing user opts */
#define S_MACROS 4 /* changing macros */
#define S_SOPTS 5 /* changing system opts */
#define S_GETPW 6 /* changing password */
#define S_GETRPW 7
#define S_HELP 8
static int state;
static prm_t prm;
static int prompting;
static char cbuf[BUFFER_SIZE];
static char *pwp = "Password: ";
static char *rpwp = "Retype Password: ";
static char *phelper = "Use any printable characters.";
static char *nodef = "<Not Defined>";
static char *mheader = "View/Edit Macros";
static char *uheader = "User Configurable Options";
static char *sheader = "System-wide Configurable Options";
static char *meprompt = "Enter Conquest commands. ([RETURN] = \\r, [TAB] = \\t)";
static char *eprompt = "Arrow keys to select an item, [SPACE] to change, any other key to quit.";
static char *eprompt2 = "Type '?' for help on an item.";
static char *mprompt = "Arrow keys to select a macro, [SPACE] to change, any other key to quit.";
static char *mprompt2 = "Type '?' for help.";
static const int settingcol = 65;
static char cursor = ' '; /* the cursor */
static const int umenuopts = 3; /* don't exceed 9 - one char input is used */
static int flin, llin, clin, pages, curpage;
static const int items_per_page = 18;
#define MAXOPTCOLS 128
static int cvec[MAXOPTCOLS]; /* hopefully big enough */
static int maxuopts;
static int maxsopts = 0; /* not impl yet */
static char *macrovec[MAX_MACROS];
static struct Conf *macroptr = NULL; /* points to macro element of ConfData */
static struct Conf *ConfigData = NULL;
static char *oheader = "";
static int oldstate; /* for returning from help */
static int nOptionsDisplay(dspConfig_t *);
static int nOptionsIdle(void);
static int nOptionsInput(int ch);
static scrNode_t nOptionsNode = {
nOptionsDisplay, /* display */
nOptionsIdle, /* idle */
nOptionsInput, /* input */
NULL /* next */
};
/* return to the correct node */
static void quitNode(void)
{
SaveUserConfig();
Context.updsec = UserConf.UpdatesPerSecond;
sendCommand(CPCMD_SETRATE, Context.updsec);
switch (retnode)
{
case DSP_NODE_CP:
setONode(NULL);
nCPInit();
break;
case DSP_NODE_MENU:
default:
setONode(NULL);
nMenuInit();
break;
}
return;
}
static void _changePasswd(int init)
{
static char pw[MAXUSERNAME], rpw[MAXUSERNAME];
clog("CHPW: init = %d, state = %d ", init, state);
if (init)
{ /* start prompting */
prm.pbuf = pwp;
pw[0] = EOS;
prm.buf = pw;
prm.preinit = FALSE;
prm.buflen = MAXUSERNAME - 1;
prm.terms = TERMS;
prm.index = MSG_LIN1;
prompting = TRUE;
}
else
{
if (state == S_GETPW)
{ /* got the pw, set up for the retry */
state = S_GETRPW;
prm.pbuf = rpwp;
rpw[0] = EOS;
prm.buf = rpw;
prm.preinit = FALSE;
prm.buflen = MAXUSERNAME - 1;
prm.terms = TERMS;
prm.index = MSG_LIN1;
prompting = TRUE;
}
else
{ /* done. do a compare and send new pw
if they match */
clog("CHPW: init = %dGETRPW?", init);
if (strcmp(pw, rpw) != 0)
{ /* pw's don't match */
mglBeep();
state = S_USRMENU;
clog("CHPW: init = %d, mismatch", init);
return;
}
else
sendAuth(cInfo.sock, CPAUTH_CHGPWD, "", pw);
prompting = FALSE;
state = S_USRMENU;
clog("CHPW: init = %d, changed", init);
}
}
return;
}
static void _changeMacro(int macronum, int init)
{
int lin;
static char prmpt[BUFFER_SIZE];
lin = MSG_LIN1;
if (init)
{ /* start prompting */
sprintf(prmpt, "f%2d = ", macronum);
strcpy(cbuf, Macro2Str(UserConf.MacrosF[macronum - 1]));
prm.preinit = TRUE;
prm.buf = cbuf;
prm.buflen = MAX_MACRO_LEN - 1;
prm.pbuf = prmpt;
prm.terms = TERMS;
prm.index = lin;
prompting = TRUE;
}
else
{ /* change it for real */
strncpy(UserConf.MacrosF[macronum - 1], Str2Macro(prm.buf),
MAX_MACRO_LEN);
UserConf.MacrosF[macronum - 1][MAX_MACRO_LEN - 1] = EOS;
}
return;
}
static void _changeOption(struct Conf *cdata, int init)
{
#define CBUFLEN 128
int j;
switch(cdata->ConfType)
{
case CTYPE_BOOL:
j = *(int *)(cdata->ConfValue);
if (j == TRUE)
j = FALSE;
else
j = TRUE;
*(int *)(cdata->ConfValue) = j;
break;
/* these will need prompting */
case CTYPE_STRING:
if (cdata->max > CBUFLEN)
{
clog("_changeOption: conf data max exceeds local buffer size.");
break;
}
if (init)
{
prm.preinit = TRUE;
strncpy(cbuf, ((char *)cdata->ConfValue), CBUFLEN);
cbuf[CBUFLEN - 1] = EOS;
prm.buf = cbuf;
prm.buflen = cdata->max - 1;
prm.pbuf = "Value: ";
prm.terms = TERMS;
prm.index = MSG_LIN1;
prompting = TRUE;
}
else
{
strncpy((char *)cdata->ConfValue, prm.buf, cdata->max);
((char *)cdata->ConfValue)[cdata->max - 1] = EOS;
}
break;
case CTYPE_NUMERIC:
if (init)
{
prm.preinit = TRUE;
sprintf(cbuf, "%d", *(int *)(cdata->ConfValue));
prm.buf = cbuf;
prm.buflen = 20;
prm.pbuf = "Enter a number: ";
prm.terms = TERMS;
prm.index = MSG_LIN1;
prompting = TRUE;
}
else
{
if (alldig(prm.buf))
{
int j = atoi(prm.buf);
if (j >= cdata->min && j <= cdata->max)
*(int *)(cdata->ConfValue) = j;
}
}
break;
}
return;
}
static void _dispUserOptsMenu(void)
{
static char *header = "User Options Menu";
static char *mopts[] = {
"View/Edit Options",
"View/Edit Macros",
"Change Password"
};
static char *prompt = "Enter a number to select an item, any other key to quit.";
int lin = 0, col = 0;
int i;
if (macroptr == NULL)
{ /* if this happens, something is
seriously confused */
clog("_dispUserOptsMenu(): ERROR: macroptr == NULL, no CTYPE_MACRO found in ConfData");
}
/* First clear the display. */
lin = 1;
cprintf(lin, 0, ALIGN_CENTER, "#%d#%s", NoColor, header);
lin += 3;
col = 5;
for (i = 0; i < umenuopts; i++)
{
cprintf(lin, col, ALIGN_NONE, "#%d#%d.#%d# %s#%d#", InfoColor,
i + 1, LabelColor, mopts[i], NoColor);
lin++;
}
lin = 19;
cprintf(lin, col, ALIGN_NONE, "#%d#UDP: #%d# %s#%d#", LabelColor,
InfoColor, (cInfo.doUDP) ? "On" : "Off",
NoColor);
lin++;
cprintf(lin, col, ALIGN_NONE, "#%d#Flags:#%d# %s#%d#", LabelColor,
InfoColor, clntServerFlagsStr(sStat.flags),
NoColor);
if (!prompting)
{
clrPrompt(MSG_LIN1);
clrPrompt(MSG_LIN2);
cprintf(MSG_LIN2, 0, ALIGN_NONE, prompt);
}
return;
}
static void _initOptsScreen(void)
{
curpage = 0;
flin = 4; /* first option line */
llin = 0; /* last option line */
clin = 0; /* current option line (also idx into
cvec/macrovec) */
/* set the right header */
switch (state)
{
case S_UOPTS:
oheader = uheader;
if (maxuopts >= items_per_page)
{
pages = maxuopts / items_per_page;
if ((maxuopts % items_per_page) != 0)
pages++; /* for runoff */
}
else
pages = 1;
break;
case S_SOPTS:
/* not implemented */
oheader = sheader;
break;
case S_MACROS:
oheader = mheader;
if (MAX_MACROS >= items_per_page)
{
pages = MAX_MACROS / items_per_page;
if ((MAX_MACROS % items_per_page) != 0)
pages++; /* for runoff */
}
else
pages = 1;
break;
}
return;
}
/* DisplayHelpScreen() - display a help (actually the conf item comment)
* screen for a Configuration item.
*/
static void _dispHelpScreen(void)
{
int i, col, lin;
struct Conf *confitem;
if (oldstate == S_UOPTS)
confitem = &ConfigData[cvec[clin]];
else
confitem = macroptr;
lin = 1;
col = 0;
cprintf(lin, col, ALIGN_CENTER, "#%d#%s#%d#",
NoColor, confitem->OneLineDesc, NoColor);
lin += 2;
i = 0;
while (confitem->ConfComment[i] != NULL)
{
if (confitem->ConfComment[i][0] != EOS)
{
cprintf(lin, col, ALIGN_NONE, "#%d#%s",
InfoColor,
&(confitem->ConfComment[i][1]));
lin++;
}
i++;
}
cprintf(MSG_LIN2, 0, ALIGN_CENTER, MTXT_DONE);
return;
}
static void _showOptScreen(void)
{
int i, j, k;
static char *header2fmt = "(Page %d of %d)";
static char headerbuf[BUFFER_SIZE];
static char header2buf[BUFFER_SIZE];
static char *header;
static char *prompt;
static char *prompt2;
int vattrib;
char *dispmac;
int lin = 0, col = 0;
switch (state)
{
case S_UOPTS:
header = uheader;
prompt = eprompt;
prompt2 = eprompt2;
if (curpage == (pages - 1)) /* last page - might be less than full */
{
if (maxuopts == items_per_page)
llin = items_per_page;
else
llin = (maxuopts % items_per_page); /* ..or more than empty? ;-) */
}
else
llin = items_per_page;
break;
case S_SOPTS:
header = sheader;
prompt = eprompt;
prompt2 = eprompt2;
if (curpage == (pages - 1)) /* last page - might be less than full */
llin = (maxsopts % items_per_page); /* ..or more than empty? ;-) */
else
llin = items_per_page;
break;
case S_MACROS:
header = mheader;
prompt = mprompt;
prompt2 = mprompt2;
if (curpage == (pages - 1)) /* last page - might be less than full */
llin = (MAX_MACROS % items_per_page); /* ..or more than empty? ;-) */
else
llin = items_per_page;
break;
default: /* shouldn't get here */
header = "";
break;
}
sprintf(header2buf, header2fmt, curpage + 1, pages);
sprintf(headerbuf, "%s %s", header, header2buf);
lin = 1;
cprintf(lin, 0, ALIGN_CENTER, "#%d#%s", NoColor, headerbuf);
lin = flin;
col = 1;
i = 0; /* start at index 0 */
while (i < llin)
{ /* display this page */
if (state == S_MACROS)
{
/* get the macro number for this line */
k = (curpage * items_per_page) + i;
if (macrovec[k][0] == EOS)
{ /* not defined */
dispmac = nodef;
vattrib = RedLevelColor;
}
else
{
dispmac = Macro2Str(macrovec[k]);
vattrib = GreenLevelColor;
}
#ifdef DEBUG_OPTIONS
clog("_showOptScreen(): k = %d, dispmac = '%s'",
k,
dispmac);
#endif
cprintf(lin, col, ALIGN_NONE, "#%d#f%2d = #%d#%s#%d#",
(k == ((curpage * items_per_page) + clin)) ? RedColor : InfoColor,
k + 1, vattrib,
dispmac,
NoColor);
lin++;
i++;
}
if (state == S_UOPTS)
{
k = (curpage * items_per_page) + i;
cprintf(lin, col, ALIGN_NONE, "#%d#%s#%d#",
(k == ((curpage * items_per_page) + clin)) ? RedColor : InfoColor,
ConfigData[cvec[k]].OneLineDesc,
NoColor);
switch(ConfigData[cvec[k]].ConfType)
{
case CTYPE_BOOL:
j = *(int *)ConfigData[cvec[k]].ConfValue;
if (j == TRUE)
vattrib = GreenLevelColor;
else
vattrib = RedLevelColor;
cprintf(lin, settingcol, ALIGN_NONE, "#%d#%s#%d#",
vattrib, (j == TRUE) ? "True" : "False",
NoColor);
break;
case CTYPE_STRING:
cprintf(lin, settingcol, ALIGN_NONE, "#%d#%13s#%d#",
InfoColor, (char *) ConfigData[cvec[k]].ConfValue,
NoColor);
break;
case CTYPE_NUMERIC:
j = *(int *)ConfigData[cvec[k]].ConfValue;
cprintf(lin, settingcol, ALIGN_NONE, "#%d#%d#%d#",
NoColor, j,
NoColor);
break;
} /* switch */
lin++;
i++;
}
}
/* now the editing phase */
if (!prompting)
{
cprintf(MSG_LIN1, 1, ALIGN_NONE, prompt);
cprintf(MSG_LIN2, 1, ALIGN_NONE, prompt2);
}
return;
}
scrNode_t *nOptionsInit(int what, int setnode, int rnode)
{
int i, k;
struct Conf *ConfigData;
uopts = (what == NOPT_USER) ? TRUE : FALSE;
prompting = FALSE;
if (uopts)
{
state = S_USRMENU;
ConfigData = ConfData;
}
else
{
state = S_SYSMENU;
ConfigData = SysConfData;
}
retnode = rnode;
for (i=0; i < MAXOPTCOLS; i++) /* init cvec */
cvec[i] = -1;
k = 0;
for (i=0; i < CfEnd; i++)
{
if (ConfigData[i].ConfType != CTYPE_STRING &&
ConfigData[i].ConfType != CTYPE_BOOL &&
ConfigData[i].ConfType != CTYPE_NUMERIC)
{ /* skip special elements */
continue;
}
cvec[k++] = i;
}
maxuopts = k;
if (state == S_USRMENU)
{
/* init the macrovec array */
for (i=0; i < CfEnd; i++)
{
if (ConfData[i].ConfType == CTYPE_MACRO)
{
macroptr = &ConfData[i];
break;
}
}
if (macroptr)
for (i=0; i < MAX_MACROS; i++)
{
macrovec[i] = (char *)(((char *)macroptr->ConfValue)
+ (i * MAX_MACRO_LEN));
}
}
if (setnode)
setNode(&nOptionsNode);
return(&nOptionsNode);
}
static int nOptionsDisplay(dspConfig_t *dsp)
{
if (state == S_USRMENU || state == S_GETPW || state == S_GETRPW)
_dispUserOptsMenu();
if (state == S_GETPW || state == S_GETRPW)
{
cprintf(MSG_LIN1, 1, ALIGN_NONE, "#%d#%s%c",
CyanColor,
prm.pbuf,
cursor);
cprintf(MSG_LIN2, 0, ALIGN_NONE, "#%d#%s",
NoColor, phelper);
}
if ((state == S_UOPTS) || (state == S_MACROS))
{
_showOptScreen();
if (prompting)
{
cprintf(prm.index, 0, ALIGN_NONE, "#%d#%s #%d#%s%c",
InfoColor, prm.pbuf, MagentaColor, prm.buf, cursor);
if (state == S_MACROS)
cprintf(MSG_LIN2, 0, ALIGN_NONE, "#%d#%s",
NoColor, meprompt);
}
}
if (state == S_HELP)
_dispHelpScreen();
return NODE_OK;
}
static int nOptionsIdle(void)
{
int gtime = glutGet(GLUT_ELAPSED_TIME);
static int old = 0;
int pkttype;
Unsgn8 buf[PKT_MAXSIZE];
int sockl[2] = {cInfo.sock, cInfo.usock};
/* 'blink' the cursor */
if ((gtime - old) > 250)
{
if (cursor == ' ')
cursor = '_';
else
cursor = ' ';
old = gtime;
}
if ((state == S_SYSMENU) || (state == S_SOPTS))
return NODE_OK; /* don't process packets is sys modes */
while ((pkttype = waitForPacket(PKT_FROMSERVER, sockl, PKT_ANYPKT,
buf, PKT_MAXSIZE, 0, NULL)) > 0)
processPacket(buf);
if (pkttype < 0) /* some error */
{
clog("nOptionsIdle: waiForPacket returned %d", pkttype);
Ships[Context.snum].status = SS_OFF;
return NODE_EXIT;
}
if ((retnode == DSP_NODE_CP) && (clientFlags & SPCLNTSTAT_FLAG_KILLED))
{
/* if we were flying, time to die properly. */
setONode(NULL);
nDeadInit();
return NODE_OK;
}
return NODE_OK;
}
static int nOptionsInput(int ch)
{
int irv;
ch = CQ_CHAR(ch) | CQ_FKEY(ch);
if (prompting)
{
irv = prmProcInput(&prm, ch);
switch (state)
{
case S_MACROS:
if (irv > 0)
{
if (irv != TERM_ABORT)
_changeMacro((curpage * items_per_page) + clin + 1, FALSE);
prompting = FALSE;
}
break;
case S_UOPTS:
if (irv > 0)
{
if (irv != TERM_ABORT)
_changeOption(&ConfigData[cvec[clin]], FALSE);
prompting = FALSE;
}
break;
case S_GETRPW:
case S_GETPW:
if (irv > 0)
{
if (irv != TERM_ABORT)
{
_changePasswd(FALSE);
}
else
{
prompting = FALSE;
state = S_USRMENU;
}
}
break;
}
return NODE_OK;
}
if (state == S_USRMENU)
{ /* decide what to do. */
switch (ch)
{
case '1': /* user options */
state = S_UOPTS;
ConfigData = ConfData;
_initOptsScreen();
break;
case '2':
state = S_MACROS;
_initOptsScreen();
break;
case '3':
state = S_GETPW;
_changePasswd(TRUE);
break;
default:
quitNode();
break;
}
return NODE_OK;
}
if (state == S_UOPTS || state == S_MACROS)
{
int maxitms = (state == S_UOPTS) ? maxuopts : MAX_MACROS;
switch(ch)
{
case CQ_KEY_UP: /* up */
case CQ_KEY_LEFT:
case 'w':
case 'k':
clin--;
if (clin < 0)
{
if (pages != 1)
{
curpage--;
if (curpage < 0)
{
curpage = pages - 1;
}
}
/* setup llin for current page */
if (curpage == (pages - 1))
{
if (maxitms == items_per_page)
llin = items_per_page;
else
llin = (maxitms % items_per_page);
}
else
llin = items_per_page;
clin = llin - 1;
}
break;
case CQ_KEY_DOWN: /* down */
case CQ_KEY_RIGHT:
case 'x':
case 'j':
clin++;
if (clin >= llin)
{
if (pages != 1)
{
curpage++;
if (curpage >= pages)
{
curpage = 0;
}
}
clin = 0;
}
break;
case CQ_KEY_PAGE_UP: /* prev page */
if (pages != 1)
{
curpage--;
if (curpage < 0)
{
curpage = pages - 1;
}
/* setup llin for current page */
if (curpage == (pages - 1))
llin = (maxitms % items_per_page);
else
llin = items_per_page;
if (clin >= llin)
clin = llin - 1;
}
break;
case CQ_KEY_PAGE_DOWN: /* next page */
if (pages != 1)
{
curpage++;
if (curpage >= pages)
{
curpage = 0;
}
/* setup llin for current page */
if (curpage == (pages - 1))
llin = (maxitms % items_per_page);
else
llin = items_per_page;
if (clin >= llin)
clin = llin - 1;
}
break;
case ' ': /* change something */
if (state == S_MACROS)
_changeMacro((curpage * items_per_page) + clin + 1, TRUE);
else if (state == S_UOPTS)
_changeOption(&ConfigData[cvec[clin]], TRUE);
break;
case '?':
oldstate = state;
state = S_HELP;
break;
default: /* everything else */
state = S_USRMENU; /* return to the user menu. */
break;
}
return NODE_OK;
}
if (state == S_HELP)
{
state = oldstate;
return NODE_OK;
}
quitNode();
return NODE_OK;
}
|