home *** CD-ROM | disk | FTP | other *** search
- Path: uunet!zaphod.mps.ohio-state.edu!usc!news.service.uci.edu!unogate!mvb.saic.com!dayton.saic.com!dayvd.dayton.saic.com!ake
- From: ake@dayvd.dayton.saic.com (Earle Ake)
- Newsgroups: vmsnet.sources.games
- Subject: ldb - Long Distance Backgammon [08/16]
- Date: 8 Apr 93 10:57:33 EST
- Organization: Science Applications Intl Corp - Dayton, OH
- Lines: 1279
- Message-ID: <1993Apr8.105733.1@dayvd.dayton.saic.com>
- NNTP-Posting-Host: dayvd.dayton.saic.com
- Xref: uunet vmsnet.sources.games:669
-
- -+-+-+-+-+-+-+-+ START OF PART 8 -+-+-+-+-+-+-+-+
- Xdelwin(statwin);`09`09/*`20delete`20the`20window`20*/
- X`7D
- $ call unpack DOSTATS.C;1 404862844 ""
- $!
- $ create 'f'
- X/*`09fe_curses.c`09`099/5/91
- X`20*
- X`20*`20Copyright`201991`20`20Perry`20R.`20Ross
- X`20*
- X`20*`20Permission`20to`20use,`20copy,`20modify,`20and`20distribute`20this`20so
- Vftware`20and`20its
- X`20*`20documentation`20without`20fee`20is`20hereby`20granted,`20subject`20to
- V`20the`20restrictions
- X`20*`20detailed`20in`20the`20README`20file,`20which`20is`20included`20here`20b
- Vy`20reference.
- X`20*`20Any`20other`20use`20requires`20written`20permission`20from`20the`20auth
- Vor.`20`20This`20software
- X`20*`20is`20distributed`20"as`20is"`20without`20any`20warranty,`20including
- V`20any`20implied
- X`20*`20warranties`20of`20merchantability`20or`20fitness`20for`20a`20particular
- V`20purpose.
- X`20*`20The`20author`20shall`20not`20be`20liable`20for`20any`20damages`20result
- Ving`20from`20the
- X`20*`20use`20of`20this`20software.`20`20By`20using`20this`20software,`20the
- V`20user`20agrees
- X`20*`20to`20these`20terms.
- X`20*/
- X
- X#include`20"ldb.h"
- X
- X/*======================================================================
- X`20*`20This`20file`20is`20the`20"curses"`20front-end`20for`20ldb.`20`20It`20pe
- Vrforms`20all
- X`20*`20display`20output`20and`20keyboard`20input`20in`20a`20way`20that`20will
- V`20(hopefully)
- X`20*`20allow`20other`20front-ends`20to`20be`20added`20later.`20`20These`20coul
- Vd`20include
- X`20*`20MAC's`20(blech),`20IBM`20PC's`20(double`20blech),`20and`20X,`20although
- V`20it`20must
- X`20*`20be`20stated`20that,`20as`20of`20this`20writing,`20ldb`20is`20not`20orga
- Vnized`20in`20an
- X`20*`20event-driven`20manner,`20so`20it`20will`20take`20more`20work`20to`20por
- Vt`20to`20X`20than
- X`20*`20just`20writing`20fe_motif.c`20or`20what`20have`20you.`20`20But`20I'm
- V`20working`20on`20it.
- X`20*
- X`20*`20All`20publicly-accessible`20functions`20in`20the`20front-end`20begin
- V`20with`20Fe.
- X`20*`20These`20are`20the`20functions`20that`20must`20be`20written`20to`20imple
- Vment`20a`20new
- X`20*`20front-end.`20`20There`20are`20a`20few`20private`20functions`20in`20this
- V`20file,`20which
- X`20*`20begin`20with`20P.`20`20These`20are`20used`20internally`20by`20fe_curses
- V.c`20and`20need`20not
- X`20*`20be`20implemented`20in`20other`20front-ends.
- X`20*
- X`20*`20The`20front-end`20is`20activated`20by`20calling`20FeInitialize.`20`20In
- V`20addition`20to
- X`20*`20performing`20any`20required`20initialization,`20it`20is`20mandatory`20f
- Vor`20FeInitialize
- X`20*`20to`20set`20FeIsActive`20to`20non-zero.`20`20The`20front-end`20is`20clos
- Ved`20down`20by
- X`20*`20calling`20FeFinishSession,`20which`20must`20set`20FeIsActive`20to`200.
- V`20`20No`20calls
- X`20*`20to`20any`20Fe`20functions`20may`20be`20made`20while`20FeIsActive`20is
- V`200.
- X`20*======================================================================
- X`20*/
- X
- XPRIVATE`20char`20PGetChr();
- XPRIVATE`20PGetString();
- XPRIVATE`20PDrawComment();
- XPRIVATE`20PReverseText();
- XPRIVATE`20PEndReverse();
- X
- XPRIVATE`20struct`20game`20*Current_Game`20=`20NULL;
- X
- X
- X/*`20VAX`20C`20doesn't`20have`20tgetstr,`20but`20if`20you're`20using`20vax-c,
- V`09*/
- X/*`20you're`20probably`20using`20a`20DEC`20terminal`20anyway.`09`09`09*/
- X#ifdef`20vaxc
- X#define`20PClearScreen()`20fputs("`5C33`5BH`5C33`5B2J",stdout);fflush(stdout)
- X#else
- XPRIVATE`20PClearScreen();
- X#endif
- X
- X
- X/*----------------------------------------------------------------------
- X`20*`09FeInitialize`20--`20initialize`20the`20front`20end
- X`20*
- X`20*`20This`20function`20initializes`20the`20curses`20package,`20turns`20off
- V`20echo,
- X`20*`20turns`20on`20cbreak`20mode`20(to`20allow`20reading`20one`20character
- V`20at`20a`20time),
- X`20*`20turns`20off`20mapping`20return`20to`20newline,`20and`20sets`20the`20FeI
- VsActive`20flag.
- X`20*`20If`20FeWaitInit`20is`20set,`20the`20user`20is`20prompted`20to`20press
- V`20<return>`20before
- X`20*`20the`20screen`20is`20cleared.`20`20FeWaitInit`20is`20set`20by`20message(
- V)`20to`20indicate
- X`20*`20that`20there`20are`20messages`20on`20the`20screen`20that`20the`20user
- V`20will`20want`20to
- X`20*`20read`20before`20the`20screen`20is`20cleared.
- X`20*----------------------------------------------------------------------
- X`20*/
- X
- XFeInitialize()
- X`7B
- Xchar`20buf`5B80`5D;
- X
- Xif`20(FeIsActive)
- X`09return;
- Xif`20(FeWaitInit)`20`7B
- X`09fprintf(stderr,"Press`20<return>`20to`20continue...");
- X`09fflush(stdout);
- X`09fflush(stderr);
- X`09fgets(buf,sizeof(buf),stdin);
- X`09FeWaitInit`20=`200;
- X`09`7D
- Xinitscr();
- Xnoecho();
- Xcbreak();
- Xnonl();
- XFeIsActive`20=`201;
- XCurrent_Game`20=`20NULL;
- X`7D
- X
- X
- X/*----------------------------------------------------------------------
- X`20*`09FeFinishSession`20--`20shut`20down`20the`20front`20end
- X`20*
- X`20*`20This`20function`20clears`20the`20screen,`20closes`20down`20the`20curses
- V`20package,
- X`20*`20and`20clears`20the`20FeIsActive`20flag.
- X`20*----------------------------------------------------------------------
- X`20*/
- X
- XFeFinishSession()
- X`7B
- X
- Xif`20(FeIsActive)`20`7B
- X`09clear();
- X`09refresh();
- X`09endwin();
- X`09FeIsActive`20=`200;
- X`09Current_Game`20=`20NULL;
- X`09`7D
- X`7D
- X
- X
- X/*----------------------------------------------------------------------
- X`20*`09FeDrawScreen`20--`20draw`20the`20constant`20parts`20of`20the`20screen
- X`20*
- X`20*`20This`20function`20draws`20the`20parts`20of`20the`20screen`20that`20don'
- Vt`20change`20for
- X`20*`20each`20game.`20`20This`20includes`20the`20board`20outline`20and`20a`20f
- Vew`20other
- X`20*`20miscellaneous`20things.
- X`20*----------------------------------------------------------------------
- X`20*/
- X
- XFeDrawScreen()
- X`7B
- Xstatic`20char`20horz`5B`5D`20=`20"____________________________________________
- V_________";
- Xint`20i;
- X
- Xclear();
- Xmvaddstr(2,5,horz);
- Xmvaddstr(17,5,horz);
- Xfor`20(i`20=`203;`20i`20<`2018;`20i++)`20`7B
- X`09mvaddch(i,5,'`7C');
- X`09mvaddch(i,29,'`7C');
- X`09mvaddch(i,33,'`7C');
- X`09mvaddch(i,57,'`7C');
- X`09`7D
- Xmvaddstr(3,61,"----------------");
- Xmvaddstr(4,63,"Roll`20`20Move");
- Xmvaddstr(12,61,"----------------");
- Xmvaddstr(13,63,"Roll`20`20Move");
- Xmvaddstr(18,62,"------`5B`20`5D------");
- Xfor`20(i`20=`2019;`20i`20<`2024;`20i++)
- X`09mvaddch(i,62,'`7C');
- Xmvaddstr(18,0,"Messages:");
- Xmvaddstr(19,0,"Sent:");
- Xmvaddstr(21,0,"Rcvd:");
- Xrefresh();
- X`7D
- X
- X
- X
- X/*----------------------------------------------------------------------
- X`20*`09FeDrawGame`20--`20draw`20all`20items`20associated`20with`20a`20game
- X`20*
- X`20*`20This`20function`20displays`20all`20information`20related`20to`20a`20spe
- Vcific`20game.
- X`20*`20This`20includes`20the`20point`20labels,`20move`20blocks,`20cube;`20shoo
- Vt,`20just
- X`20*`20about`20everything`20you`20can`20think`20of.
- X`20*----------------------------------------------------------------------
- X`20*/
- X
- XFeDrawGame(g)
- Xstruct`20game`20*g;
- X`7B
- Xint`20i,`20p,`20r1,`20r2;
- Xchar`20blots`5B12`5D,`20tmp`5B60`5D,`20*n;
- Xchar`20addr`5B68`5D;`09`09/*`20all`20of`20e-mail`20address`20that`20will`20fit
- V`20on`20top`20line`20*/
- Xint`20bgflag;`09`09/*`201`20=`20gammon,`202`20=`20backgammon,`200`20=`20neithe
- Vr`20*/
- Xint`20gval;`09`09/*`20game`20value`20(when`20game`20is`20over)`20*/
- Xstatic`20char`20pts1`5B`5D`20=`20"`201`20`20`202`20`20`203`20`20`204`20`20`205
- V`20`20`206`20`7C`20`20`20`7C`207`20`20`208`20`20`209`20`2010`20`2011`20`2012";
- V
- Xstatic`20char`20pts2`5B`5D`20=`20"24`20`2023`20`2022`20`2021`20`2020`20`2019
- V`20`7C`20`20`20`7C18`20`2017`20`2016`20`2015`20`2014`20`2013";
- Xstatic`20char`20*events`5B`5D`20=`20`7B`20"",`20"Gammon!`20`20",`20"Backgammon
- V!`20`20"`20`7D;
- X
- XCurrent_Game`20=`20g;
- Xmove(0,0);
- Xclrtoeol();
- Xmove(0,0);
- Xn`20=`20(g->opname`20!=`20NULL)`20?`20g->opname`20:`20"UNKNOWN";
- Xi`20=`20sizeof(addr)`20-`20strlen(n)`20-`201;`20`20/*`20longest`20e-mail`20add
- Vr`20we`20can`20display`20*/
- Xif`20(strlen(g->opaddr)`20>`20i)`20`7B`09/*`20too`20long,`20truncate`20*/
- X`09strncpy(addr,g->opaddr,i-3);`09/*`20leave`20space`20for`20...`20*/
- X`09strcpy(`26addr`5Bi-3`5D,"...");`09/*`20add`20ellipsis`20`26`20null`20termin
- Vate`20*/
- X`09`7D
- Xelse
- X`09strcpy(addr,g->opaddr);
- Xprintw("Playing:`20%s`20(%s)",n,addr);`09`09/*`20who`20am`20I`20playing?`20*/
- Xif`20(g->flags`20`26`20F_INVERT)`20`7B`09`09/*`20board`20is`20inverted?`20`20*
- V/
- X`09mvaddstr(16,6,pts2);`09`09/*`20draw`20inverted`20point`20labels`20*/
- X`09mvaddstr(4,6,pts1);
- X`09r1`20=`2011;`09`09`09/*`20remember`20which`20move`20block`20to`20use`20*/
- X`09r2`20=`202;
- X`09p`20=`201;
- X`09`7D
- Xelse`20`7B
- X`09mvaddstr(4,6,pts2);`09`09/*`20draw`20normal`20point`20labels`20*/
- X`09mvaddstr(16,6,pts1);
- X`09r1`20=`202;`09`09`09`09/*`20remember`20which`20move`20block`20to`20use`20*/
- V
- X`09r2`20=`2011;
- X`09p`20=`200;
- X`09`7D
- Xif`20(g->mydir`20>`200)`20`7B`09`09/*`20I'm`20playing`20up,`20switch`20move
- V`20blocks`20*/
- X`09i`20=`20r1;
- X`09r1`20=`20r2;
- X`09r2`20=`20i;
- X`09p`20=`201`20-`20p;
- X`09`7D
- Xmove(r1,63);
- Xprintw("Opponent`20`20(%c)",g->opcolor);
- Xmove(r2,63);
- Xprintw("You`20`20`20`20`20`20`20(%c)",g->mycolor);
- X
- Xswitch`20(g->curbd)`20`7B`09`09`09/*`20which`20board`20should`20I`20draw?`20*/
- V
- Xcase`20BD_BEFOP:
- X`09FeDrawBoard(g->opbd,g->opmvs,g->opdir,0,g->flags`20`26`20F_INVERT);
- X`09FeDrawPip(g->opbd,g);
- X`09break;
- Xcase`20BD_AFTOP:
- X`09FeDrawBoard(g->mybd,g->opmvs,g->opdir,1,g->flags`20`26`20F_INVERT);
- X`09FeDrawPip(g->mybd,g);
- X`09break;
- Xcase`20BD_CUR:
- X`09FeDrawBoard(g->board,NULL,g->mydir,0,g->flags`20`26`20F_INVERT);
- X`09FeDrawPip(g->board,g);
- X`09break;
- X`09`7D
- XFeLabelBoard(g);
- Xmvaddch(5,59,'`7C');`09`09`09/*`20draw`20those`20little`20arrows`20*/
- Xmvaddch(4,59,'-');
- Xmvaddch(14,59,'`7C');`09`09`09/*`20that`20tell`20us`20which`20direction`20*/
- Xmvaddch(15,59,'`7C');`09`09`09/*`20we`20are`20going`20*/
- Xmvaddch(16,59,'-');
- Xif`20(p`20==`200)`20`7B
- X`09mvaddstr(4,1,"-->");
- X`09mvaddch(4,58,'-');
- X`09mvaddch(6,59,'V');
- X`09mvaddch(16,58,'<');
- X`09mvaddstr(16,1,"<--");
- X`09mvaddstr(13,58,"`20`20`20");
- X`09mvaddch(12,59,'`20');
- X`09mvaddstr(4,30,"-->");
- X`09mvaddstr(16,30,"<--");
- X`09`7D
- Xelse`20`7B
- X`09mvaddstr(4,1,"<--");
- X`09mvaddch(4,58,'<');
- X`09mvaddch(6,59,'`7C');
- X`09mvaddch(16,58,'-');
- X`09mvaddstr(16,1,"-->");
- X`09mvaddstr(13,58,"/`7C`5C`5C");
- X`09mvaddch(12,59,'.');
- X`09mvaddstr(16,30,"-->");
- X`09mvaddstr(4,30,"<--");
- X`09`7D
- X*blots`20=`20'`5C0';`09`09`09`09/*`20did`20any`20of`20our`20blots`20get`20hit?
- V`20*/
- Xfor`20(i`20=`200,`20p`20=`200;`20i`20<`204;`20i++)`20`7B
- X`09FeDrawMove(g,WHO_ME,i);`09`09/*`20draw`20my`20moves`20*/
- X`09FeDrawMove(g,WHO_OPP,i);`09/*`20draw`20opponent's`20moves`20*/
- X`09if`20(g->blot`5Bi`5D`20>`200)`20`7B
- X`09`09strcat(blots,"`20");`09/*`20add`20a`20blot`20to`20the`20list`20*/
- X`09`09sprintf(tmp,"%d",g->blot`5Bi`5D);
- X`09`09strcat(blots,tmp);
- X`09`09p++;
- X`09`09`7D
- X`09`7D
- XFeDrawCube(g);`09`09/*`20draw`20the`20current`20game`20value`20*/
- XPDrawComment(WHO_ME,`20g);`09/*`20draw`20my`20old`20comment`20*/
- XPDrawComment(WHO_OPP,`20g);`09/*`20draw`20opponent's`20comment`20*/
- Xif`20(g->state`20==`20ST_MYACCEPT)
- X`09strcpy(tmp,"Opponent`20has`20doubled.");
- Xelse`20if`20(g->state`20==`20ST_GAMEOVER)`20`7B`09/*`20game`20is`20over,`20fin
- Vd`20out`20why`20*/
- X`09bgflag`20=`20gvalue(g,`26gval);`09`09/*`20calculate`20game`20value`20*/
- X`09switch`20(g->term)`20`7B
- X`09case`20T_IWIN:`09`09/*`20I`20won,`20check`20for`20gammon/backgammon`20*/
- X`09`09sprintf(tmp,"%sYou`20win`20%d`20point%s.",events`5Bbgflag`5D,
- X`09`09`09gval,(gval`20==`201)`20?`20""`20:`20"s");
- X`09`09break;
- X`09case`20T_ILOSE:`09`09/*`20I`20lost,`20check`20for`20gammon/backgammon`20*/
- X`09`09sprintf(tmp,"%sYou`20lose`20%d`20point%s.",events`5Bbgflag`5D,
- X`09`09`09gval,(gval`20==`201)`20?`20""`20:`20"s");
- X`09`09break;
- X`09case`20T_ICONCEDE:`09`09`09/*`20I`20wimped`20out`20*/
- X`09`09sprintf(tmp,"You`20conceded.`20`20You`20lose`20%d`20point%s.",
- X`09`09`09gval,(gval`20==`201)`20?`20""`20:`20"s");
- X`09`09break;
- X`09case`20T_OPCONCEDE:`09`09`09/*`20Opponent`20wimped`20out`20*/
- X`09`09sprintf(tmp,"Opponent`20conceded.`20`20You`20win`20%d`20point%s.",
- X`09`09`09gval,(gval`20==`201)`20?`20""`20:`20"s");
- X`09`09break;
- X`09case`20T_IDECLINE:`09`09`09/*`20I`20declined`20the`20double`20*/
- X`09`09sprintf(tmp,"Double`20declined.`20`20You`20lose`20%d`20point%s.",
- X`09`09`09gval,(gval`20==`201)`20?`20""`20:`20"s");
- X`09`09break;
- X`09case`20T_OPDECLINE:`09`09/*`20Opponent`20declined`20my`20double`20*/
- X`09`09sprintf(tmp,"Double`20declined.`20`20You`20win`20%d`20point%s.",
- X`09`09`09gval,(gval`20==`201)`20?`20""`20:`20"s");
- X`09`09break;
- X`09`09`7D
- X`09`7D
- Xelse`20if`20(*blots)
- X`09sprintf(tmp,"Blot%s`20hit:%s",(p`20==`201)`20?`20""`20:`20"s",blots);
- Xelse
- X`09*tmp`20=`20'`5C0';
- XFeStatusLine(tmp);
- XFeMessage(g->dispmsg);`09`09/*`20put`20message`20(if`20any)`20on`20message`20l
- Vine`20*/
- Xif`20(g->dispmsg`20!=`20NULL)`20`7B`09/*`20if`20there`20was`20a`20message,`20i
- Vt`20has`20been`20*/
- X`09free(g->dispmsg);`09/*`20displayed,`20so`20it`20can`20thrown`20away`20*/
- X`09g->dispmsg`20=`20NULL;
- X`09`7D
- Xrefresh();
- X`7D
- X
- X
- X/*----------------------------------------------------------------------
- X`20*`09FeDrawPip`20--`20display`20the`20PIP`20count
- X`20*
- X`20*`20This`20function`20displays`20the`20current`20pip`20count.
- X`20*----------------------------------------------------------------------
- X`20*/
- X
- XFeDrawPip(b,g)
- Xboard`20b;`09`09`09/*`20the`20current`20board`20array`20*/
- Xstruct`20game`20*g;`09`09`09/*`20the`20current`20game`20structure`20*/
- X`7B
- Xint`20mypip,`20oppip;
- X
- Xpipcount(b,g,`26mypip,`26oppip);
- Xmove(1,29);
- Xclrtoeol();
- Xmove(1,29);
- Xprintw("You:`20%3d`20`20Op:`20%3d`20`20",`20mypip,`20oppip);
- Xif`20(mypip`20>`20oppip)
- X`09printw("(%d`20behind)",`20mypip`20-`20oppip);
- Xelse`20if`20(oppip`20>`20mypip)
- X`09printw("(%d`20ahead)",`20oppip`20-`20mypip);
- Xelse
- X`09printw("(even)");
- X`7D
- X
- X
- X/*----------------------------------------------------------------------
- X`20*`09FeDrawPoint`20--`20draw`20all`20pieces`20on`20a`20point
- X`20*
- X`20*`20This`20function`20redraws`20all`2015`20slots`20on`20a`20point.`20`20It
- V`20is`20passed`20a
- X`20*`20board`20image`20and`20the`20index`20of`20the`20point`20to`20draw,`20fro
- Vm`20which`20it
- X`20*`20extracts`20the`20number`20of`20pieces`20on`20that`20point`20and`20the
- V`20character`20used
- X`20*`20to`20represent`20pieces.`20`20It`20will`20draw`20as`20many`20of`20these
- V`20pieces`20as
- X`20*`20exist`20on`20the`20point,`20and`20will`20draw`20blanks`20over`20the`20r
- Vemaining`20slots
- X`20*`20to`20erase`20any`20pieces`20that`20may`20have`20existed`20before.
- X`20*`20If`20the`20nh`20argument`20is`20greater`20than`200,`20it`20specifies
- V`20how`20many`20of
- X`20*`20the`20pieces`20drawn`20should`20be`20highlighted.`20`20This`20is`20used
- V`20to`20highlight
- X`20*`20pieces`20moved`20by`20the`20opponent.
- X`20*----------------------------------------------------------------------
- X`20*/
- X
- XFeDrawPoint(b,pt,nh,inv)
- Xboard`20b;`09`09/*`20the`20board`20array`20*/
- Xint`20pt;`09`09`09/*`20which`20point`20are`20we`20to`20draw`20*/
- Xint`20nh;`09`09`09/*`20how`20many`20pieces`20should`20be`20highlighted`20*/
- Xint`20inv;`09`09/*`20is`20the`20board`20inverted?`20*/
- X`7B
- Xstatic`20int`20cols`5BBOARDSIZE`5D`20=`20`7B`20`2031,7,11,15,19,23,27,35,39,43
- V,47,51,55,
- X`09`09`09`0955,51,47,43,39,35,27,23,19,15,11,7,31,2,2`7D;
- Xint`20sr,`20r;`09`09/*`20the`20row`20we`20are`20at`20*/
- Xint`20c;`09`09/*`20the`20column`20we`20are`20at`20*/
- Xint`20d;`09`09/*`20which`20direction`20does`20the`20column`20grow`201/-1`20*/
- Xint`20i;`09`09/*`20counter`20*/
- Xchar`20x;`09`09/*`20char`20to`20draw`20piece`20with`20*/
- Xint`20nn;`09`09/*`20number`20of`20normal`20pieces`20*/
- X
- Xif`20(`20(pt`20>`2012)`20`26`26`20(pt`20!=`20DOWNOFF))`20`7B
- X`09sr`20=`20inv`20?`2015`20:`205;`09/*`20starting`20row`20is`205`20(unless`20i
- Vnverted)`20*/
- X`09d`20=`20inv`20?`20-1`20:`201;`09/*`20direction`20is`20down`20(unless`20inve
- Vrted)`20*/
- X`09`7D
- Xelse`20`7B
- X`09sr`20=`20inv`20?`205`20:`2015;`09/*`20starting`20row`20is`2015`20(unless
- V`20inverted)`20*/
- X`09d`20=`20inv`20?`201`20:`20-1;`09/*`20direction`20is`20up`20(unless`20invert
- Ved)`20*/
- X`09`7D
- Xc`20=`20cols`5Bpt`5D;
- Xx`20=`20b`5Bpt`5D.color;`09`09/*`20char`20to`20draw`20piece`20with`20*/
- Xif`20(nh`20<`200)
- X`09nh`20=`200;
- Xelse`20if`20(nh`20>`20b`5Bpt`5D.qty)
- X`09nh`20=`20b`5Bpt`5D.qty;
- Xnn`20=`20b`5Bpt`5D.qty`20-`20nh;`09`09/*`20how`20many`20normal`20pcs`20*/
- Xr`20=`20sr;
- Xfor`20(i`20=`200;`20i`20<`2015;`20i++)`20`7B`09`09/*`20draw`20all`2015`20slots
- V`20on`20this`20point`20*/
- X`09if`20(nn`20<=`200)`20`7B`09`09/*`20no`20more`20normal`20pieces`20*/
- X`09`09if`20(nh`20<=`200)`09/*`20and`20no`20highlighted`20pieces`20*/
- X`09`09`09x`20=`20'`20';`09/*`20so`20draw`20blanks`20*/
- X`09`09else`20`7B
- X`09`09`09PReverseText();
- X`09`09`09nh--;
- X`09`09`09`7D
- X`09`09`7D
- X`09else
- X`09`09nn--;
- X`09mvaddch(r,c,x);`09`09`09/*`20draw`20this`20piece`20*/
- X`09PEndReverse();
- X`09if`20(i`20==`204)`20`7B
- X`09`09r`20=`20sr;`09`09`09/*`20reset`20row`20*/
- X`09`09c--;`09`09`09/*`20use`20col`20to`20left`20of`20first`20row`20*/
- X`09`09`7D
- X`09else`20if`20(i`20==`209)`20`7B
- X`09`09r`20=`20sr;`09`09`09/*`20reset`20row`20*/
- X`09`09c`20+=`202;`09`09`09/*`20use`20col`20to`20right`20of`20first`20row`20*/
- X`09`09`7D
- X`09else
- X`09`09r`20+=`20d;`09`09`09/*`20bump`20row`20number`20*/
- X`09`7D
- X`7D
- X
- X
- X/*----------------------------------------------------------------------
- X`20*`09FeDrawMove`20--`20draw`20a`20line`20in`20a`20move`20block
- X`20*
- X`20*`20This`20function`20draws`20one`20line`20in`20a`20move`20block.`20`20This
- V`20consists`20of`20the
- X`20*`20value`20of`20the`20roll,`20the`20starting`20and`20ending`20position`20o
- Vf`20the`20piece
- X`20*`20moved,`20and`20an`20asterisk`20if`20the`20move`20was`20from`20the`20opp
- Vonent`20and`20hit
- X`20*`20one`20of`20our`20blots.
- X`20*----------------------------------------------------------------------
- X`20*/
- X
- XFeDrawMove(g,who,mn)
- Xstruct`20game`20*g;`09`09`09/*`20the`20game`20structure`20*/
- Xint`20who;`09`09`09/*`20WHO_ME`20or`20WHO_OPP`20*/
- Xint`20mn;`09`09`09`09/*`20which`20move`20to`20draw`20*/
- X`7B
- Xint`20p,`20r,`20d;
- Xstruct`20mv`20*m;
- X
- Xd`20=`20(who`20==`20WHO_ME)`20?`20g->mydir`20:`20g->opdir;/*`20this`20move`20u
- Vpbound`20or`20downbound?`20*/
- Xp`20=`20(d`20>`200);`09`09`09`09/*`20upper`20or`20lower`20block?`20*/
- Xif`20(g->flags`20`26`20F_INVERT)`09`09/*`20inverted`20board`20*/
- X`09p`20=`20!p;`09`09`09`09/*`20switch`20move`20blocks`20*/
- Xr`20=`20mn`20+`20(p`20?`205`20:`2014);`09`09`09/*`20figure`20out`20the`20row
- V`20number`20*/
- Xm`20=`20(who`20==`20WHO_ME)`20?`20`26g->mvs`5Bmn`5D`20:`20`26g->opmvs`5Bmn`5D;
- V/*`20find`20the`20move`20structure`20*/
- Xmove(r,64);
- Xclrtoeol();`09`09`09`09/*`20clear`20the`20old`20move`20*/
- Xif`20(m->roll`20>`200)`20`7B
- X`09move(r,64);
- X`09printw("%d",m->roll);`09`09/*`20draw`20the`20roll`20*/
- X`09move(r,69);
- X`09if`20(m->pt`20<`200)`20`7B`09`09/*`20if`20it`20is`20unused,`20say`20so`20*/
- V
- X`09`09addstr("UNUSED");
- X`09`09return;
- X`09`09`7D
- X`09if`20(`20(`20(p`20=`20m->pt)`20==`20UPBAR)`20`7C`7C`20(m->pt`20==`20DOWNBAR
- V)`20)`20`7B
- X`09`09p`20=`20BARPT(d);`09`09/*`20if`20coming`20off`20bar,`20say`20so`20*/
- X`09`09printw("BAR-");
- X`09`09`7D
- X`09else
- X`09`09printw("%d-",m->pt);`09/*`20draw`20starting`20point`20*/
- X`09if`20(`20(`20(p`20+=`20d*m->roll)`20<=`200)`20`7C`7C`20(p`20>=`2025)`20)
- X`09`09printw("OFF");`09`09/*`20if`20bearing`20off,`20say`20so`20*/
- X`09else
- X`09`09printw("%d",p);`09`09/*`20draw`20ending`20point`20*/
- X`09if`20(`20(who`20==`20WHO_OPP)`20`26`26`20g->blot`5Bmn`5D)`09/*`20if`20op
- V`20move`20hit`20a`20blot`20*/
- X`09`09mvaddch(r,76,'*');`09/*`20mark`20it`20*/
- X`09`7D
- X`7D
- X
- X
- X/*----------------------------------------------------------------------
- X`20*`09FeDrawBoard`20--`20draw`20all`20points`20on`20a`20board
- X`20*
- X`20*`20This`20is`20a`20convenience`20function`20that`20calls`20FeDrawPoint`20f
- Vor`20all
- X`20*`20points`20on`20a`20board.`20`20It`20takes`20as`20an`20argument`20an`20ar
- Vray`20of`20moves,
- X`20*`20as`20well`20as`20an`20argument`20that`20determines`20whether`20DrawPoin
- Vt`20should`20be
- X`20*`20instructed`20to`20highlight`20the`20source`20of`20those`20moves,`20the
- V`20destination,
- X`20*`20or`20nothing.
- X`20*----------------------------------------------------------------------
- X`20*/
- X
- XFeDrawBoard(b,mvs,dir,sd,inv)
- Xboard`20b;`09`09`09/*`20board`20image`20*/
- Xstruct`20mv`20mvs`5B4`5D;`09`09/*`20moves`20to`20highlight`20(NULL`20=`20none)
- V`20*/
- Xint`20dir;`09`09`09/*`20direction`20*/
- Xint`20sd;`09`09`09`09/*`200=highlight`20source,`201=dest`20*/
- Xint`20inv;`09`09`09/*`20is`20the`20board`20inverted?`20*/
- X`7B
- Xint`20i,`20s,`20e;
- Xstatic`20char`20hcnt`5BBOARDSIZE`5D;`09/*`20number`20of`20pieces`20to`20highli
- Vght`20*/
- X
- Xfor`20(i`20=`200;`20i`20<`20BOARDSIZE;`20i++)
- X`09hcnt`5Bi`5D`20=`200;`09`09/*`20init`20to`20no`20highlight`20*/
- Xif`20(mvs`20!=`20NULL)`20`7B`09/*`20find`20all`20points`20that`20should`20be
- V`20highlighted`20*/
- X`09for`20(i`20=`200;`20i`20<`204;`20i++)`20`7B
- X`09`09if`20(`20(mvs`5Bi`5D.roll`20<=`200)`20`7C`7C`20(`20(s`20=`20mvs`5Bi`5D.p
- Vt)`20<`200)`20)
- X`09`09`09continue;`09/*`20this`20move`20is`20unused`20*/
- X`09`09if`20(`20(s`20<`201)`20`7C`7C`20(s`20>`2024)`20)`09/*`20if`20coming`20of
- Vf`20bar`20*/
- X`09`09`09s`20=`20BARPT(dir);`09`09/*`20use`20correct`20bar`20point`20*/
- X`09`09e`20=`20s`20+`20dir*mvs`5Bi`5D.roll;`09/*`20add`20in`20the`20roll`20used
- V`20*/
- X`09`09if`20(`20(e`20<`201)`20`7C`7C`20(e`20>`2024)`20)`09/*`20off`20the`20boar
- Vd`20*/
- X`09`09`09e`20=`20OFFPT(dir);`09/*`20use`20correct`20off`20point`20*/
- X`09`09if`20(sd`20>`200)`20`7B`09`09`09/*`20we`20are`20showing`20dest`20*/
- X`09`09`09hcnt`5Be`5D++;`09`09/*`20inc`20destination`20count`20*/
- X`09`09`09hcnt`5Bs`5D--;`09`09/*`20handle`20continued`20moves`20*/
- X`09`09`09`7D
- X`09`09else`20`7B`09`09`09`09/*`20we`20are`20showing`20start`20*/
- X`09`09`09hcnt`5Bs`5D++;`09`09/*`20inc`20start`20count`20*/
- X`09`09`09hcnt`5Be`5D--;`09`09/*`20handle`20continued`20moves`20*/
- X`09`09`09`7D
- X`09`09`7D
- X`09`7D
- Xfor`20(i`20=`200;`20i`20<`20BOARDSIZE;`20i++)`09`09/*`20draw`20each`20point
- V`20*/
- X`09FeDrawPoint(b,i,hcnt`5Bi`5D,inv);
- X`7D
- X
- X
- X/*----------------------------------------------------------------------
- X`20*`09FeLabelBoard`20--`20draw`20board`20info
- X`20*
- X`20*`20This`20function`20displays`20information`20about`20the`20board`20curren
- Vtly
- X`20*`20being`20displayed.`20`20This`20includes`20its`20label,`20any`20special
- V`20rule`20flags,
- X`20*`20and`20the`20current`20match`20score.
- X`20*----------------------------------------------------------------------
- X`20*/
- X
- XFeLabelBoard(g)
- Xstruct`20game`20*g;
- X`7B
- Xint`20i;
- Xstatic`20char`20*bdlbl`5B`5D`20=`20`7B"Bef",`20"Aft",`20"Cur"`7D;
- X
- Xmvaddstr(1,5,BLANKS(24));`09`09/*`20clear`20old`20stuff`20*/
- Xmvaddstr(1,5,bdlbl`5Bg->curbd`5D);`09`09/*`20draw`20the`20board`20label`20*/
- Xif`20(g->flags`20`26`20F_JACOBY)`09`09/*`20label`20special`20rules`20flags`20*
- V/
- X`09mvaddch(1,10,'J');
- Xif`20(g->flags`20`26`20F_CRAWFORD)`20`7B
- X`09if`20(g->flags`20`26`20F_CRGAME)`09/*`20if`20this`20is`20crawford`20rule
- V`20game`20*/
- X`09`09PReverseText();`09`09/*`20highlight`20the`20C`20indicator`20*/
- X`09mvaddch(1,11,'C');
- X`09if`20(g->flags`20`26`20F_CRGAME)
- X`09`09PEndReverse();
- X`09`7D
- Xif`20(g->flags`20`26`20F_EUROPE)
- X`09mvaddch(1,12,'E');
- Xif`20(g->flags`20`26`20F_PERM)
- X`09mvaddch(1,13,'P');
- Xif`20(g->mtotal`20>`200)`20`7B`09`09`09/*`20if`20this`20is`20a`20match`20*/
- X`09move(1,16);`09`09`09/*`20draw`20the`20match`20score`20*/
- X`09printw("%02d:%02d`20to`20%2d",
- X`09`09g->mcurrent`5BWHO_ME`5D,`20g->mcurrent`5BWHO_OPP`5D,`20g->mtotal);
- X`09`7D
- XFeCheckContact(g);
- X`7D
- X
- X
- X
- X
- X/*----------------------------------------------------------------------
- X`20*`09FeCheckContact`20--`20check`20for`20contact`20after`20a`20move`20is`20m
- Vade.
- X`20*
- X`20*`20This`20routine`20keeps`20the`20BAR`20indicator`20up`20to`20date`20as
- V`20moves`20are`20made.
- X`20*`20The`20BAR`20indicator`20changes`20to`20"---"`20when`20no`20further`20co
- Vntact`20is
- X`20*`20possible`20for`20a`20game.`20`20Note`20that`20the`20BAR`20indicator`20o
- Vnly`20reflects
- X`20*`20the`20value`20of`20the`20current`20board,`20and`20is`20not`20affected
- V`20by`20which
- X`20*`20board`20is`20being`20displayed.
- X`20*----------------------------------------------------------------------
- X`20*/
- X
- XFeCheckContact(g)
- Xstruct`20game`20*g;
- X`7B
- X
- Xif`20(iscontact(g))`09`09`09/*`20if`20contact`20is`20possible`20*/
- X`09mvaddstr(10,30,"BAR");`09`09/*`20draw`20BAR`20label`20*/
- Xelse`09`09`09`09`09/*`20change`20BAR`20indicator`20to`20*/
- X`09mvaddstr(10,30,"---");`09`09/*`20no`20contact`20indicator`20*/
- X`7D
- X
- X
- X/*----------------------------------------------------------------------
- X`20*`09FeGetPoint`20--`20read`20a`20point`20number`20from`20the`20user
- X`20*
- X`20*`20This`20function`20prompts`20the`20user`20for`20a`20point`20number.`20
- V`20The`20user`20types
- X`20*`20the`20input`20on`20the`20line`20of`20the`20move`20block`20corresponding
- V`20to`20the
- X`20*`20roll`20being`20used.`20`20Normally,`20the`20input`20is`20a`20number`20b
- Vetween`201`20and`2024.`20`20
- X`20*`20Point`20numbers`20are`20two`20digits`20unless:
- X`20*`09-`20The`20first`20digit`20is`203`20..`209.
- X`20*`20OR`09-`20The`20first`20digit`20is`201`20and`20there`20is`20no`20point
- V`20in`2010`20..`2019
- X`20*`09`20`20that`20could`20use`20the`20selected`20roll.
- X`20*`20OR`09-`20The`20first`20digit`20is`202`20and`20there`20is`20no`20point
- V`20in`2020`20..`2024
- X`20*`09`20`20that`20could`20use`20the`20selected`20roll.
- X`20*`20Otherwise,`20there`20must`20be`20a`20non-digit`20entered`20to`20finish
- V`20a`201-digit
- X`20*`20point`20number.`20`20Alternatively,`20the`20user`20may`20enter`20them
- X`20*`20with`20a`20leading`200.`20`20There`20are`20a`20number`20of`20special
- V`20characters`20that
- X`20*`20are`20also`20recognized:
- X`20*`09char`09`09`09return`20value
- X`20*`09---------------------------------------------------------------
- X`20*`09space`09`09`09the`20"spdflt"`20argument.
- X`20*`09return/linefeed`09`09the`20"crdflt"`20argument.
- X`20*`09DEL/ESC/BS`09`09cancel`20move.
- X`20*`09p/P`09`09`09the`20point`20from`20which`20a`20piece`20would`20have
- X`20*`09`09`09`09to`20be`20moved`20to`20land`20on`20spdflt.
- X`20*`09o/O`09`09`09The`20point`20from`20which`20the`20selected`20roll
- X`20*`09`09`09`09could`20be`20used`20to`20bear`20off.`20`20If`20that`20point
- X`20*`09`09`09`09is`20unoccupied,`20the`20next`20lower`20occupied
- X`20*`09`09`09`09point`20is`20returned.
- X`20*`20If`20there`20are`20pieces`20on`20the`20bar,`20the`20bar`20point`20is
- V`20returned`20immediately,
- X`20*`20since`20there`20could`20be`20no`20other`20possible`20choice`20the`20use
- Vr`20would`20make.
- X`20*----------------------------------------------------------------------
- X`20*/
- X
- XFeGetPoint(g,r,crdflt,spdflt)
- Xstruct`20game`20*g;`09`09`09`09/*`20game`20structure`20*/
- Xint`20r;`09`09`09`09`09/*`20which`20row`20in`20move`20block`20*/
- Xint`20crdflt;`09`09`09`09/*`20what`20to`20return`20for`20cr/nl`20*/
- Xint`20spdflt;`09`09`09`09/*`20what`20to`20return`20for`20space`20*/
- X`7B
- Xint`20n,`20row;
- Xchar`20buf`5B4`5D;
- X
- X
- Xif`20(g->board`5BBARPT(g->mydir)`5D.qty`20>`200)`09/*`20pieces`20on`20the`20ba
- Vr`20*/
- X`09return(BARPT(g->mydir));`09/*`20no`20need`20to`20even`20ask`20*/
- Xrow`20=`20r;
- Xif`20(g->flags`20`26`20F_INVERT)`09`09/*`20which`20move`20block`20do`20I`20use
- V?`20*/
- X`09row`20+=`20(g->mydir`20<`200)`20?`205`20:`2014;`09/*`20inverted`20board`20*
- V/
- Xelse
- X`09row`20+=`20(g->mydir`20>`200)`20?`205`20:`2014;`09/*`20normal`20board`20*/
- Xmove(row,69);
- Xclrtoeol();
- Xmove(row,69);
- Xrefresh();
- X*buf`20=`20PGetChr(0,1);
- Xif`20(`20(*buf`20==`20'`5Cn')`20`7C`7C`20(*buf`20==`20'`5Cr')`20)`09/*`20retur
- Vn`20means`20repeat`20move`20*/
- X`09return(crdflt);
- Xif`20(*buf`20==`20'`20')`09`09`09/*`20space`20means`20continue`20move`20*/
- X`09return(spdflt);
- Xif`20(`20(*buf`20==`20'`5C177')`20`7C`7C`20(*buf`20==`20'`5C033')`20`7C`7C`20(
- V*buf`20==`20'`5Cb')`20)
- X`09return(-1);`09`09`09/*`20DEL/ESC/BS`20means`20cancel`20move`20*/
- Xif`20(`20(*buf`20==`20'b')`20`7C`7C`20(*buf`20==`20'B')`20)`09/*`20bar`20*/
- X`09return(BARPT(g->mydir));
- Xif`20(`20(*buf`20==`20'p')`20`7C`7C`20(*buf`20==`20'P')`20)`20`7B`09/*`20P`20m
- Veans`20spdflt`20-`20roll*dir`20*/
- X`09n`20=`20spdflt`20-`20g->mvs`5Br`5D.roll*g->mydir;`09/*`20make`20point`20*/
- X`09if`20(`20(n`20<`201)`20`7C`7C`20(n`20>`2024)`20)`09`09/*`20not`20on`20board
- V`20*/
- X`09`09n`20=`2099;`09`09`09`09/*`20force`20invalid`20point`20*/
- X`09return(n);
- X`09`7D
- Xif`20(`20(*buf`20==`20'o')`20`7C`7C`20(*buf`20==`20'O')`20)`20`7B`09/*`20O`20m
- Veans`20bear`20a`20piece`20off`20*/
- X`09n`20=`20(`20(g->mydir`20>`200)`20?`2025`20:`200`20)`20-`20g->mydir*g->mvs
- V`5Br`5D.roll;
- X`09while`20(`20(n`20>`200)`20`26`26`20(n`20<=`2024)`20`26`26
- X`09`20`20`20(`20(g->board`5Bn`5D.qty`20<=`200)`20`7C`7C`20(g->board`5Bn`5D.col
- Vor`20!=`20g->mycolor))`20)
- X`09`09n`20+=`20g->mydir;
- X`09if`20(`20(n`20<`201)`20`7C`7C`20(n`20>`2024)`20)`09/*`20no`20piece`20found
- V`20*/
- X`09`09n`20=`2099;`09`09`09/*`20force`20invalid`20point`20*/
- X`09return(n);
- X`09`7D
- Xif`20(`20!`20isdigit(*buf))
- X`09return(99);`09`09`09/*`20force`20invalid`20point`20message`20*/
- Xif`20(`20(*buf`20>=`20'3')`20`26`26`20(*buf`20<=`20'9')`20)`09/*`203`20..`209
- V`20*/
- X`09return(*buf`20-`20'0');`09`09/*`20don't`20bother`20with`202nd`20digit`20*/
- Xif`20(*buf`20==`20'1')`20`7B`09`09`09/*`20look`20for`20valid`20move`20in`2010
- V`20..`2019`20*/
- X`09if`20(canmove(g,r,10,19)`20==`200)`09/*`20no`20valid`20move`20*/
- X`09`09return(1);`09`09/*`20don't`20bother`20with`20second`20digit`20*/
- X`09`7D
- Xelse`20if`20(*buf`20==`20'2')`20`7B`09`09`09/*`20look`20for`20valid`20move`20i
- Vn`2020`20..`2024`20*/
- X`09if`20(canmove(g,r,20,24)`20==`200)`09/*`20no`20valid`20move`20*/
- X`09`09return(2);`09`09/*`20don't`20bother`20with`20second`20digit`20*/
- X`09`7D
- Xaddch(*buf);`09`09`09`09/*`20echo`20the`20char`20*/
- Xrefresh();
- Xbuf`5B1`5D`20=`20PGetChr(0,1);
- Xbuf`5B2`5D`20=`20'`5C0';`09`09`09`09/*`20null`20terminate`20*/
- Xif`20(`20((n`20=`20atoi(buf))`20==`20UPBAR)`20`7C`7C`20(n`20==`20DOWNBAR)`20)
- X`09return(BARPT(g->mydir));
- Xreturn(n);
- X`7D
- X
- X
- X/*----------------------------------------------------------------------
- X`20*`09PGetChr`20--`20get`20a`20single`20character
- X`20*
- X`20*`20This`20function`20gets`20one`20character`20from`20the`20user`20and`20re
- Vturns`20it.
- X`20*`20If`20the`20"e"`20argument`20is`20non-zero,`20the`20character`20is`20ech
- Voed`20at`20the
- X`20*`20current`20cursor`20position.`20`20If`20the`20"h"`20argument`20is`20non-
- Vzero,`20the
- X`20*`20online`20help`20is`20displayed`20by`20pressing`20"H",`20"h",`20or`20"?"
- V.`20`20The`20`5EL`20and`20`5ER
- X`20*`20characters`20are`20intercepted`20and`20cause`20the`20screen`20to`20be
- V`20redrawn`20without
- X`20*`20returning`20from`20PGetChr.`20`20Null`20characters`20are`20discarded.
- X`20*----------------------------------------------------------------------
- X`20*/
- X
- XPRIVATE`20char`20PGetChr(e,h)
- Xint`20e,`20h;
- X`7B
- Xchar`20c;
- Xint`20y,`20x;
- X
- X#ifdef`20VMS
- Xchar`20Prompt`5B4`5D`20=`20"_$`20";
- Xstruct`20dsc$descriptor_s`20*cmd`20=`200,`20*prmpt=0;
- X$DESCRIPTOR(cm_dsc,rc.supercmd);
- X$DESCRIPTOR(prmpt_dsc,Prompt);
- X#endif
- X
- Xloop:
- Xif`20(`20(c`20=`20getch()`20`26`200x7f)`20==`20'`5C0')
- X`09goto`20loop;
- Xif`20(`20(c`20==`200x0c)`20`7C`7C`20(c`20==`200x12)`20)`20`7B`09/*`20`5EL`20or
- V`20`5ER?`20*/
- X`09clearok(curscr,`20TRUE);
- X`09wrefresh(curscr);`09/*`20repaint`20current`20screen`20*/
- X`09goto`20loop;`09`09/*`20and`20get`20another`20char`20*/
- X`09`7D
- Xif`20(c`20==`20rc.superkey)`20`7B`09`09`09/*`20uh`20oh,`20we're`20busted`20*/
- X`09getyx(stdscr,y,x);`09`09/*`20save`20old`20cursor`20postition`20*/
- X`09PClearScreen();`09`09`09/*`20get`20the`20screen`20cleared`20fast`20*/
- X`09nl();`09`09`09`09/*`20set`20tty`20back`20to`20normal`20*/
- X`09nocbreak();
- X`09echo();
- X#ifdef`20VMS
- X`09cm_dsc.dsc$w_length`20=`20strlen(rc.supercmd);`09/*`20length`20of`20cmd`20*
- V/
- X`09cmd`20=`20`26cm_dsc;`09`09`09/*`20set`20up`20the`20command`20argument`20*/
- X`09prmpt_dsc.dsc$w_length`20=`20strlen(Prompt);
- X`09prmpt`20=`20`26prmpt_dsc;`09`09`09/*`20set`20up`20the`20command`20argument
- V`20*/
- X`09lib$spawn(cmd,0,0,0,0,0,0,0,0,0,prmpt,0);`09/*`20spawn`20a`20subprocess`20*
- V/
- X#else
- X`09system(rc.supercmd);`09`09/*`20run`20the`20supervisor`20command`20*/
- X#endif
- X`09noecho();
- X`09cbreak();
- X`09nonl();`09`09`09`09/*`20ok,`20we're`20safe`20again`20*/
- X`09PClearScreen();`09`09`09/*`20clear`20old`20junk`20*/
- X`09clearok(curscr,`20TRUE);
- X`09wrefresh(curscr);`09`09/*`20repaint`20current`20screen`20*/
- X`09move(y,x);`09`09`09/*`20put`20cursor`20back`20where`20it`20was`20*/
- X`09refresh();
- X`09goto`20loop;`09`09`09/*`20and`20get`20another`20character`20*/
- X`09`7D
- Xif`20(h`20`26`26`20(c`20==`20'?'`20`7C`7C`20c`20==`20'h'`20`7C`7C`20c`20==`20'
- VH'))`20`7B`09/*`20user`20needs`20help`20*/
- X`09dohelp();`09`09`09/*`20give`20it`20to`20'em`20*/
- X`09touchwin(stdscr);`09`09/*`20Make`20sure`20the`20screen`20gets`20updated`20*
- V/
- X`09wrefresh(stdscr);`09`09/*`20Now`20refresh`20it`20*/
- X`09goto`20loop;`09`09`09/*`20and`20get`20another`20character`20*/
- X`09`7D
- Xif`20(h`20`26`26`20(c`20==`20'%'`20`7C`7C`20c`20==`20'#'))`20`7B`09/*`20user
- V`20wants`20stats`20*/
- X`09dostats(Current_Game);`09`09/*`20give`20it`20to`20'em`20*/
- X`09touchwin(stdscr);`09`09/*`20Make`20sure`20the`20screen`20gets`20updated`20*
- V/
- X`09wrefresh(stdscr);`09`09/*`20Now`20refresh`20it`20*/
- X`09goto`20loop;`09`09`09/*`20and`20get`20another`20character`20*/
- X`09`7D
- Xif`20(e`20`26`26`20isprint(c))`20`7B`09`09/*`20echo`20char?`20*/
- X`09addch(c);`09`09/*`20yup`20*/
- X`09refresh();
- X`09`7D
- Xreturn(c);
- X`7D
- X
- X
- X/*----------------------------------------------------------------------
- X`20*`09PClearScreen`20--`20clear`20the`20screen`20somehow
- X`20*
- X`20*`20This`20function`20clears`20the`20physical`20display`20without`20affecti
- Vng`20what
- X`20*`20the`20curses`20package`20thinks`20is`20there.`20`20If`20the`20"cl"`20(c
- Vlear`20screen)
- X`20*`20capability`20is`20defined,`20it`20uses`20that.`20`20If`20that`20fails,
- V`20it`20tries
- X`20*`20to`20move`20to`200,0`20and`20use`20the`20"cd"`20(clear`20to`20end`20of
- V`20display).
- X`20*`20Failing`20that,`20it`20goes`20to`20the`20bottom`20of`20the`20screen`20a
- Vnd`20scrolls
- X`20*`20it`2024`20times.
- X`20*----------------------------------------------------------------------
- X`20*/
- X
- X#ifndef`20vaxc
- XPRIVATE`20PClearScreen()
- X`7B
- Xchar`20*s,`20*x,`20buf`5B80`5D;
- X
- Xx`20=`20buf;
- Xif`20(`20(s`20=`20tgetstr("cl",`26x))`20==`20NULL)`20`7B`09`09/*`20no`20clear
- V`20screen`20*/
- X`09if`20(`20(s`20=`20tgetstr("cd",`26x))`20!=`20NULL)`20`7B`09/*`20do`20we`20h
- Vave`20clr`20to`20end?`20*/
- X`09`09move(0,0);`09`09/*`20yup,`20use`20it`20*/
- X`09`09refresh();
- X`09`09fputs(s,stdout);
- X`09`09`7D
- X`09else`20`7B`09`09`09/*`20well,`20do`20it`20the`20hard`20way`20*/
- X`09`09move(23,0);
- X`09`09refresh();
- X`09`09printf("`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn
- V`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn`5Cn");
- X`09`09`7D
- X`09`7D
- Xelse
- X`09fputs(s,stdout);`09/*`20send`20clear`20screen`20*/
- Xfflush(stdout);`09`09`09/*`20git`20along,`20li'l`20characters`20*/
- X`7D
- X#endif
- X
- X
- X/*----------------------------------------------------------------------
- X`20*`09FeGetComment`20--`20prompt`20for`20a`20comment`20to`20send`20along`20wi
- Vth`20a`20move
- X`20*
- X`20*`20This`20function`20allows`20the`20user`20to`20enter`20a`202-line`20comme
- Vnt.`20`20If`20the
- X`20*`20user`20types`20a`20non-empty`20string,`20it`20is`20stored`20in`20the
- V`20mycmt/mycmt2
- X`20*`20fields`20of`20the`20game`20structure`20passed`20as`20an`20argument.`20
- V`20The`20previous`20comment,
- X`20*`20if`20any,`20is`20discarded.`20`20The`20number`20of`20lines`20read`20is
- V`20returned,
- X`20*`20or`20-1`20if`20PGetString`20was`20terminated`20by`20ESC.`20`20This`20ha
- Vs`20the`20effect`20of
- X`20*`20aborting`20the`20Send`20command.
- X`20*----------------------------------------------------------------------
- X`20*/
- X
- XFeGetComment(g)
- Xstruct`20game`20*g;
- X`7B
- Xchar`20buf`5B120`5D;
- Xchar`20*lptrs`5B2`5D;
- Xint`20n;
- X
- Xn`20=`20PGetString(buf,56,lptrs,2,19,6);`09/*`20get`20new`20comment`20*/
- Xif`20(n`20<`200)`20`7B`09`09`09/*`20user`20hit`20escape,`20back`20out`20of`20s
- Vend`20*/
- X`09PDrawComment(WHO_ME,`20g);`09`09/*`20put`20my`20old`20comment`20back`20*/
- X`09return(-1);`09`09`09/*`20return`20"escape"`20code`20*/
- X`09`7D
- Xif`20(g->mycmt`20!=`20NULL)`09`09/*`20throw`20away`20old`20comment`20*/
- X`09free(g->mycmt);
- Xif`20(g->mycmt2`20!=`20NULL)
- X`09free(g->mycmt2);
- Xif`20(n`20>`200)
- X`09g->mycmt`20=`20save(lptrs`5B0`5D);`09/*`20save`20first`20line`20*/
- Xelse
- X`09g->mycmt`20=`20NULL;`09/*`20mark`20comment`20as`20empty`20*/
- Xif`20(n`20>`201)
- X`09g->mycmt2`20=`20save(lptrs`5B1`5D);`09/*`20save`20second`20line`20*/
- Xelse
- X`09g->mycmt2`20=`20NULL;
- Xreturn(n);
- X`7D
- X
- X
- X
- X/*----------------------------------------------------------------------
- X`20*`09PGetString`20--`20read`20a`20multi-line`20string`20from`20the`20user
- X`20*
- X`20*`20This`20function`20allows`20the`20user`20to`20enter`20multiple`20lines
- V`20of`20a`20fixed`20maximum
- X`20*`20length.`20`20The`20normal`20line`20editing`20characters`20are`20recogni
- Vzed`20and
- X`20*`20processed.`20`20These`20include:
- X`20*`09DEL/BS`09`09The`20character`20before`20the`20cursor`20is`20deleted.
- X`20*`09`5EX/`5EU`09`09The`20entire`20line`20is`20erased.
- X`20*`09`5EL/`5ER`09`09The`20screen`20is`20redrawn.
- X`20*`09`5EW/`5EB`09`09The`20word`20before`20the`20cursor`20is`20erased.
- X`20*`20Typing`20past`20the`20end`20of`20a`20line`20automatically`20causes`20a
- V`20word-
- X`20*`20wrap`20to`20the`20next`20line.`20`20Words`20are`20delimited`20by`20spac
- Ves.`20`20Typing
- X`20*`20a`20carriage`20return`20or`20line`20feed`20on`20the`20last`20line,`20or
- V`20on`20an`20empty
- X`20*`20line,`20terminates`20PGetString;`20otherwise,`20it`20moves`20to`20the
- V`20next`20line.
- X`20*`20ESC`20terminates`20PGetString`20regardless`20of`20the`20cursor`20positi
- Von.
- X`20*`20Backspacing`20from`20the`20beginning`20of`20one`20line`20to`20the`20end
- V`20of`20the`20previous
- X`20*`20is`20allowed.`20`20PGetString`20returns`20the`20number`20of`20lines`20e
- Vntered,
- X`20*`20or`20-1`20if`20it`20was`20terminated`20by`20an`20ESC.
- X`20*----------------------------------------------------------------------
- X`20*/
- X
- XPRIVATE`20PGetString(buf,len,lines,nls,y,x)
- Xchar`20*buf,`20*lines`5B`5D;
- Xint`20len,`20nls,`20y,`20x;
- X`7B
- Xchar`20c,`20*bp,`20*p;
- Xint`20cl,`20l;
- X
- Xfor`20(cl`20=`200;`20cl`20<`20nls;`20cl++)`20`7B
- X`09lines`5Bcl`5D`20=`20NULL;`09`09/*`20clear`20line`20pointers`20*/
- X`09mvaddstr(y+cl,x,BLANKS(len));`09/*`20clear`20line`20*/
- X`09`7D
- Xcl`20=`200;`09`09`09`09`09/*`20current`20line`20=`200`20*/
- Xl`20=`200;`09`09`09`09/*`20length`20of`20current`20line`20*/
- Xmove(y,x);`09`09`09/*`20go`20to`20first`20location`20in`20field`20*/
- Xbp`20=`20buf;`09`09`09/*`20ptr`20to`20next`20storage`20location`20*/
- Xlines`5B0`5D`20=`20buf;`09`09`09/*`20init`20first`20line`20pointer`20*/
- Xrefresh();
- Xwhile`20(1)`20`7B
- X`09switch`20(c`20=`20PGetChr(0,0))`20`7B
- X`09case`20'`5C177':`09`09/*`20DEL`20*/
- X`09case`20'`5Cb':`09`09/*`20BS`20*/
- X`09`09if`20(l`20<=`200)`20`7B`09/*`20at`20beginning`20of`20line`20*/
- X`09`09`09if`20(cl`20<=`200)`09/*`20on`20first`20line`20*/
- X`09`09`09`09break;`09`09/*`20nothing`20to`20delete`20*/
- X`09`09`09cl--;`09`09/*`20back`20up`20one`20line`20*/
- X`09`09`09*--bp`20=`20'`5C0';`09/*`20back`20up`20buffer`20pointer`20*/
- X`09`09`09l`20=`20strlen(lines`5Bcl`5D);`09/*`20load`20line`20length`20*/
- X`09`09`09move(y+cl,x+l);`09/*`20move`20cursor`20to`20end`20of`20prev`20line
- V`20*/
- X`09`09`09`7D
- X`09`09else`20`7B
- X`09`09`09bp--;`09`09/*`20back`20up`20buffer`20pointer`20*/
- X`09`09`09l--;`09`09/*`20decrement`20length`20*/
- X`09`09`09move(y+cl,x+l);
- X`09`09`09addch('`20');`09/*`20erase`20the`20char`20from`20the`20screen`20*/
- X`09`09`09move(y+cl,x+l);
- X`09`09`09`7D
- X`09`09refresh();
- X`09`09break;
- X`09case`20'`5C2':`09`09/*`20`5EB`20--`20erase`20previous`20character`20*/
- X`09case`20'`5C27':`09`09/*`20`5EW`20*/
- X`09`09if`20(l`20<=`200)`20`7B`09`09/*`20beginning`20of`20line`20*/
- X`09`09`09if`20(cl`20<=`200)`09/*`20on`20first`20line`20*/
- X`09`09`09`09break;`09`09/*`20nothing`20to`20delete`20*/
- X`09`09`09cl--;`09`09/*`20back`20up`20one`20line`20*/
- X`09`09`09*--bp`20=`20'`5C0';`09/*`20back`20up`20buffer`20pointer`20*/
- X`09`09`09l`20=`20strlen(lines`5Bcl`5D);`09/*`20load`20line`20length`20*/
- X`09`09`09`7D
- X`09`09while`20(l`20>`200)`20`7B`09`09/*`20skip`20leading`20spaces,`20if`20any
- V`20*/
- X`09`09`09if`20(*--bp`20!=`20'`20')`20`7B
- X`09`09`09`09bp++;
- X`09`09`09`09break;
- X`09`09`09`09`7D
- X`09`09`09l--;
- X`09`09`09*bp`20=`20'`5C0';
- X`09`09`09`7D
- X`09`09while`20(l`20>`200)`20`7B`09`09/*`20delete`20to`20last`20space`20*/
- X`09`09`09if`20(*--bp`20==`20'`20')`20`7B
- X`09`09`09`09bp++;
- X`09`09`09`09break;
- X`09`09`09`09`7D
- X`09`09`09*bp`20=`20'`5C0';
- X`09`09`09l--;
- X`09`09`09mvaddch(y+cl,x+l,'`20');
- X`09`09`09`7D
- X`09`09move(y+cl,x+l);
- X`09`09refresh();
- X`09`09break;
- X`09case`20'`5C33':`09`09/*`20ESC`20*/
- X`09`09*bp++`20=`20'`5C0';`09`09/*`20terminate`20the`20string`20*/
- X`09`09return(-1);`09`09/*`20return`20abort`20code`20*/
- X`09case`20'`5Cr':`09`09/*`20CR`20*/
- X`09case`20'`5Cn':`09`09/*`20NL`20*/
- X`09`09*bp++`20=`20'`5C0';`09/*`20terminate`20the`20string`20*/
- X`09`09if`20(l`20<=`200)`09`09/*`20empty`20line`20*/
- X`09`09`09return(cl);`09/*`20don't`20include`20it`20in`20#lines`20*/
- X`09`09if`20(cl`20>=`20nls-1)`09`09/*`20last`20line`20*/
- X`09`09`09return(cl+1);`09/*`20return`20number`20of`20lines`20*/
- X`09`09lines`5B++cl`5D`20=`20bp;`09/*`20go`20to`20next`20line`20*/
- X`09`09l`20=`200;
- X`09`09move(y+cl,x);
- X`09`09refresh();
- X`09`09break;
- X`09case`20'`5C30':`09`09/*`20`5EX`20--`20erase`20entire`20line`20`26`20goto
- V`20prev`20line`20*/
- X`09case`20'`5C25':`09`09/*`20`5EU`20*/
- X`09`09mvaddstr(y+cl,x,BLANKS(len));
- X`09`09if`20(cl`20>`200)`20`7B`09/*`20back`20up`20one`20line`20*/
- X`09`09`09bp`20=`20lines`5Bcl--`5D`20-`201;
- X`09`09`09l`20=`20strlen(lines`5Bcl`5D);
- X`09`09`09`7D
- X`09`09else`20`7B`09`09/*`20already`20on`20top`20line,`20go`20to`20beginning
- V`20*/
- X`09`09`09bp`20=`20buf;
- X`09`09`09l`20=`200;
- X`09`09`09`7D
- X`09`09move(y+cl,x+l);
- X`09`09refresh();
- X`09`09break;
- X`09case`20'`5Ct':`09`09`09/*`20convert`20tab`20to`20a`20space`20*/
- X`09`09c`20=`20'`20';
- X`09`09/*`20fall`20through`20*/
- X`09default:
- X`09`09if`20(iscntrl(c))`7B`09`09/*`20bad`20char`20*/
- X`09`09`09fputc('`5C7',stderr);`09/*`20beep`20*/
- X`09`09`09fflush(stderr);
- X`09`09`09break;`09`09`09/*`20`26`20ignore`20character`20*/
- X`09`09`09`7D
- X`09`09if`20(l`20>=`20len)`20`7B`09`09/*`20typed`20up`20to`20end`20of`20line
- V`20*/
- X`09`09`09if`20(cl`20>=`20nls-1)`20`7B`09/*`20last`20line,`20can't`20go`20on
- V`20*/
- X`09`09`09`09fputc('`5C7',stderr);`09/*`20beep`20*/
- X`09`09`09`09fflush(stderr);
- X`09`09`09`09break;`09`09/*`20`26`20ignore`20character`20*/
- X`09`09`09`09`7D
- X`09`09`09*bp++`20=`20c;`09`09/*`20store`20rcvd`20char`20*/
- X`09`09`09for`20(p`20=`20bp-1;`20(l`20>`200)`20`26`26`20(!`20isspace(*p));`20p-
- V-,`20l--);
- X`09`09`09if`20(`20(p`20<=`20buf)`20`7C`7C`20(*p`20==`20'`5C0')`20)`20`7B
- X`09`09`09`09*bp++`20=`20'`5C0';
- X`09`09`09`09lines`5B++cl`5D`20=`20bp;`09/*`20didn't`20find`20word`20*/
- X`09`09`09`09l`20=`200;
- X`09`09`09`09`7D
- X`09`09`09else`20`7B
- X`09`09`09`09*p++`20=`20'`5C0';`09/*`20terminate`20previous`20line`20*/
- X`09`09`09`09mvaddstr(y+cl,x,BLANKS(len));`09/*`20redraw`20*/
- X`09`09`09`09mvaddstr(y+cl,x,lines`5Bcl`5D);`09/*`20w/o`20word`20*/
- X`09`09`09`09lines`5B++cl`5D`20=`20p;`09/*`20start`20new`20line`20*/
- X`09`09`09`09*bp`20=`20'`5C0';`09`09/*`20terminate`20word`20*/
- X`09`09`09`09l`20=`20strlen(p);`09`09/*`20set`20line`20len`20*/
- X`09`09`09`09mvaddstr(y+cl,x,p);`09/*`20draw`20word`20*/
- X`09`09`09`09`7D
- X`09`09`09move(y+cl,x+l);
- X`09`09`09`7D
- X`09`09else`20`7B
- X`09`09`09*bp++`20=`20c;`09`09/*`20put`20char`20in`20string`20*/
- X`09`09`09l++;`09`09`09/*`20bump`20length`20*/
- X`09`09`09addch(c);`09`09/*`20echo`20char`20to`20screen`20*/
- X`09`09`09`7D
- X`09`09refresh();
- X`09`09break;
- X`09`09`7D
- X`09`7D
- X`7D
- X
- X
- X/*----------------------------------------------------------------------
- X`20*`09FeDrawMenu`20--`20draw`20menu`20choices`20in`20menu`20box
- X`20*
- X`20*`20This`20function`20takes`20an`20array`20of`20strings,`20terminated`20by
- V`20a`20NULL
- X`20*`20pointer,`20and`20writes`20each`20string`20into`20successive`20lines`20o
- Vf`20the
- X`20*`20menu`20box`20in`20the`20bottom`20right`20corner`20of`20the`20screen.
- V`20`20If`20there`20are
- X`20*`20more`20strings`20than`20will`20fit`20in`20the`20box,`20the`20extra`20st
- Vrings`20are
- X`20*`20ignored.`20`20If`20NULL`20is`20passed`20as`20the`20menu`20array,`20the
- V`20menu`20box
- X`20*`20is`20cleared.
- X`20*----------------------------------------------------------------------
- X`20*/
- X
- XFeDrawMenu(m)
- Xchar`20*m`5B`5D;
- X`7B
- Xint`20i;
- X
- Xfor`20(i`20=`200;`20i`20<`205;`20i++)`20`7B`09`09/*`20clear`20all`20lines`20in
- V`20menu`20box`20*/
- X`09move(19+i,63);
- X`09clrtoeol();
- X`09`7D
- Xif`20(m`20==`20NULL)`09`09`09`09/*`20no`20menu`20to`20display`20*/
- X`09return;
- Xfor`20(i`20=`200;`20(m`5Bi`5D`20!=`20NULL)`20`26`26`20(i`20<`205);`20i++)`20
- V`7B
- X`09if`20(strlen(m`5Bi`5D)`20>`2015)`09`09/*`20menu`20string`20is`20too`20long
- V`20*/
- X`09`09m`5B15`5D`20=`20'`5C0';`09`09/*`20so`20shorten`20it`20*/
- X`09mvaddstr(19+i,64,m`5Bi`5D);`09`09/*`20put`20string`20in`20menu`20area`20*/
- X`09`7D
- Xrefresh();
- X`7D
- X
- X
- X/*----------------------------------------------------------------------
- X`20*`09FeMenu`20--`20get`20menu`20choice`20from`20user
- X`20*
- X`20*`20This`20function`20accepts`20a`20menu`20choice`20from`20the`20user.`20
- V`20The`20menu`20choices
- X`20*`20are`20passed`20as`20an`20array`20of`20strings,`20terminated`20by`20a
- V`20NULL`20pointer.
- X`20*`20Users`20select`20one`20of`20these`20strings`20by`20typing`20the`20first
- V`20letter`20of`20the
- X`20*`20string,`20thus`20the`20first`20letter`20of`20the`20strings`20must`20be
- V`20unique.
- X`20*
- X`20*`20FeMenu`20also`20handles`20two`20special`20cases:
- X`20*`091.`20The`20user`20types`20a`20number`20between`201`20and`206`20(a`20rol
- Vl)
- X`20*`092.`20The`20user`20types`20some`20character`20that`20the`20caller`20wish
- Ves
- X`20*`09`20`20`20to`20handle`20directly.
- X`20*`20If`20a`20roll`20entry`20is`20valid,`20the`20caller`20may`20pass`20up
- V`20to`20two`20different
- X`20*`20rolls`20that`20are`20valid`20in`20the`20r1`20and`20r2`20arguments.`20
- V`20Any`20characters
- X`20*`20the`20caller`20wishes`20to`20handle`20are`20passed`20as`20a`20string
- V`20in`20the
- X`20*`20"extra"`20argument.`20`20These`20typically`20include`20space`20and`20ne
- Vwline.
- X`20*
- X`20*`20When`20a`20menu`20item`20is`20selected,`20it`20is`20highlighted`20befor
- Ve`20FeMenu
- X`20*`20returns.`20`20If`20the`20caller`20calls`20FeMenu`20again`20without`20po
- Vsting`20a
- X`20*`20new`20menu`20(via`20FeDrawMenu),`20the`20character`20returned`20by`20Fe
- VMenu
- X`20*`20on`20the`20first`20call`20should`20be`20passed`20in`20the`20"prev"`20ar
- Vgument`20so
- X`20*`20that`20choice`20can`20be`20un-highlighted.`20`20If`20there`20is`20no
- V`20previous
- X`20*`20choice`20to`20unhighlight,`20prev`20can`20be`20'`5C0'.
- X`20*----------------------------------------------------------------------
- X`20*/
- X
- Xchar`20FeMenu(m,r1,r2,extra,prev)
- Xchar`20*m`5B`5D;`09`09`09/*`20array`20of`20menu`20choices`20*/
- Xint`20r1,`20r2;`09`09`09/*`20rolls`20(pass`200`20if`20no`20roll`20valid)`20*/
- Xchar`20*extra;`09`09`09/*`20chars`20that`20caller`20wants`20to`20handle`20*/
- Xchar`20prev;`09`09`09/*`20previous`20choice`20we`20should`20un-highlight`20*/
- X`7B
- Xint`20i;
- Xchar`20c,`20x;
- X
- XFeOffMenuItem(m,prev);
- Xwhile`20(1)`20`7B
- X`09mvaddch(18,69,'`20');
- X`09move(18,69);`09`09`09/*`20put`20cursor`20in`20its`20little`20box`20*/
- X`09refresh();
- X`09c`20=`20PGetChr(1,1);`09`09/*`20get`20a`20character`20*/
- X`09FeMessage(NULL);`09`09/*`20clear`20message`20line`20*/
- X`09if`20(`20(extra`20!=`20NULL)`20`26`26`20(strchr(extra,c)`20!=`20NULL)`20)
- X`09`09return(c);`09`09/*`20these`20chars`20are`20handled`20by`20caller`20*/
- X`09if`20(`20(c`20>=`20'1')`20`26`26`20(c`20<=`20'6')`20)`20`7B`09/*`20handle
- V`20digits`20differently`20*/
- X`09`09if`20(r1`20<=`200)`20`7B
- X`09`09`09FeMessage("Roll`20not`20valid`20here.");
- X`09`09`09continue;
- X`09`09`09`7D
- X`09`09x`20=`20c`20-`20'0';`09`09/*`20convert`20to`20number`20*/
- X`09`09if`20(`20(x`20==`20r1)`20`7C`7C`20(x`20==`20r2)`20)`09/*`20is`20it`20a
- V`20valid`20roll?`20*/
- X`09`09`09return(c);`09`09/*`20yup,`20return`20it`20*/
- X`09`09FeMessage("No`20such`20roll.");
- X`09`09continue;
- X`09`09`7D
- X`09if`20(islower(c))`09`09`09/*`20ignore`20case`20*/
- X`09`09c`20=`20toupper(c);
- X`09for`20(i`20=`200;`20m`5Bi`5D`20!=`20NULL;`20i++)`20`7B`09/*`20search`20menu
- V`20strings`20*/
- X`09`09x`20=`20*m`5Bi`5D;
- X`09`09if`20(islower(x))`09`09`09/*`20ignore`20case`20*/
- X`09`09`09x`20=`20toupper(x);
- X`09`09if`20(c`20!=`20x)`09`09`09/*`20this`20isn't`20it`20*/
- +-+-+-+-+-+-+-+- END OF PART 8 +-+-+-+-+-+-+-+-
-