billr@saab.CNA.TEK.COM (Bill Randle) (08/29/90)
Submitted-by: Robert Steven Glickstein <bobg+@andrew.cmu.edu>
Posting-number: Volume 11, Issue 37
Archive-name: vcraps/Patch2
Patch-To: vcraps: Volume 11, Issue 34-35
[[This patch adds the 'm' keystroke, which allows the user to review
previous messages.]]
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of shell archive."
# Contents: patches02
# Wrapped by billr@saab on Fri Aug 24 12:10:43 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'patches02' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'patches02'\"
else
echo shar: Extracting \"'patches02'\" \(4949 characters\)
sed "s/^X//" >'patches02' <<'END_OF_FILE'
X*** dist/vcraps.c Fri Aug 24 13:22:14 1990
X--- vcraps.c Fri Aug 24 13:13:39 1990
X***************
X*** 2,11 ****
X #include <curses.h>
X #include <setjmp.h>
X
X extern int CrapsErrorDatum;
X extern int optind;
X! extern char *optarg;
X
X jmp_buf LoopEnv;
X
X WINDOW *dontplace4win, *dontplace5win, *dontplace6win, *dontplace8win;
X--- 2,16 ----
X #include <curses.h>
X #include <setjmp.h>
X
X+ #define MSGQUEUELEN (20)
X+
X extern int CrapsErrorDatum;
X extern int optind;
X! extern char *optarg, *malloc();
X
X+ int MsgQueueLen, MsgQueueLatest;
X+ char *MsgQueue[MSGQUEUELEN];
X+
X jmp_buf LoopEnv;
X
X WINDOW *dontplace4win, *dontplace5win, *dontplace6win, *dontplace8win;
X***************
X*** 123,128 ****
X--- 128,135 ----
X {
X int c;
X
X+ MsgQueueLen = 0;
X+ MsgQueueLatest = -1;
X init();
X Craps_SetBankroll(&Table, 1000);
X while ((c = getopt(argc, argv, "b:sx")) != EOF) {
X***************
X*** 147,152 ****
X--- 154,160 ----
X Driver()
X {
X int c, amount, fullupdate = 1, jmpval, die1, die2, i;
X+ int msgptr, msgcount;
X char buf[20];
X CrapsError_t err;
X CrapsTable_t *t = &Table;
X***************
X*** 159,168 ****
X Update(fullupdate);
X bcopy(&Table, &OldTable, (sizeof(CrapsTable_t)));
X fullupdate = 0;
X! Prompt("Command [12345689abcdfhprt$X?]:");
X wclear(commandwin);
X wrefresh(commandwin);
X! c = Getch("12345689abcdfhprt$X?", 1);
X switch (c) {
X case '1':
X Prompt("[012]:");
X--- 167,176 ----
X Update(fullupdate);
X bcopy(&Table, &OldTable, (sizeof(CrapsTable_t)));
X fullupdate = 0;
X! Prompt("Command [12345689abcdfhmprt$X?]:");
X wclear(commandwin);
X wrefresh(commandwin);
X! c = Getch("12345689abcdfhmprt$X?", 1);
X switch (c) {
X case '1':
X Prompt("[012]:");
X***************
X*** 546,551 ****
X--- 554,575 ----
X break;
X }
X break;
X+ case 'm':
X+ msgptr = MsgQueueLatest;
X+ msgcount = 0;
X+ do {
X+ if (++msgcount > MsgQueueLen)
X+ c = ' ';
X+ else {
X+ wcenter(msgwin, MsgQueue[msgptr], 0, 0);
X+ wrefresh(msgwin);
X+ msgptr = (msgptr - 1 + MSGQUEUELEN) % MSGQUEUELEN;
X+ c = wgetch(msgwin);
X+ wclear(msgwin);
X+ }
X+ } while (c != ' ');
X+ wrefresh(msgwin);
X+ break;
X case 'p':
X if (Craps_Point(&Table)) {
X Prompt("Amount for odds on Pass Line:");
X***************
X*** 885,893 ****
X Message(str)
X char *str;
X {
X wcenter(msgwin, str, 0, 0);
X wrefresh(msgwin);
X! while (wgetch(msgwin) != ' ');
X wclear(msgwin);
X wrefresh(msgwin);
X }
X--- 909,942 ----
X Message(str)
X char *str;
X {
X+ char *copy = malloc(1 + strlen(str));
X+ int c, msgptr, msgcount;
X+
X+ if (copy) {
X+ strcpy(copy, str);
X+ MsgQueueLatest = (MsgQueueLatest + 1) % MSGQUEUELEN;
X+ if (MsgQueueLen == MSGQUEUELEN)
X+ free(MsgQueue[MsgQueueLatest]);
X+ else
X+ ++MsgQueueLen;
X+ MsgQueue[MsgQueueLatest] = copy;
X+ }
X+ msgptr = (MsgQueueLatest - 1 + MSGQUEUELEN) % MSGQUEUELEN;
X+ msgcount = 1;
X wcenter(msgwin, str, 0, 0);
X wrefresh(msgwin);
X! do {
X! c = wgetch(msgwin);
X! if (c == 'm') {
X! if (++msgcount > MsgQueueLen)
X! c = ' ';
X! else {
X! wcenter(msgwin, MsgQueue[msgptr], 0, 0);
X! wrefresh(msgwin);
X! msgptr = (msgptr - 1 + MSGQUEUELEN) % MSGQUEUELEN;
X! }
X! }
X! } while (c != ' ');
X wclear(msgwin);
X wrefresh(msgwin);
X }
X***************
X*** 1697,1704 ****
X addstr("4dc - don't-come odds on 4 4dp - don't place 4\n\n");
X addstr("Bets are taken down by typing t followed by one of the\n");
X addstr("bet commands above.\n\n");
X! addstr("$ - show total bets X - Exit program\n");
X! addstr(" continue...");
X refresh();
X getch();
X longjmp(LoopEnv, 2);
X--- 1746,1753 ----
X addstr("4dc - don't-come odds on 4 4dp - don't place 4\n\n");
X addstr("Bets are taken down by typing t followed by one of the\n");
X addstr("bet commands above.\n\n");
X! addstr("$ - show total bets m - review messages X - exit\n");
X! addstr(" continue...");
X refresh();
X getch();
X longjmp(LoopEnv, 2);
X***************
X*** 1706,1713 ****
X
X ShowTotal()
X {
X! int i, total = 0;
X! char buf[80];
X
X for (i = craps_PassLine; i < craps_Bets; ++i)
X total += Craps_GetBet(&Table, i);
X--- 1755,1762 ----
X
X ShowTotal()
X {
X! int i, total = 0;
X! char buf[80];
X
X for (i = craps_PassLine; i < craps_Bets; ++i)
X total += Craps_GetBet(&Table, i);
X
X*** patchlevel.h.orig Fri Aug 24 11:04:33 1990
X--- patchlevel.h Fri Aug 24 12:09:14 1990
X***************
X*** 1 ****
X! #define PATCHLEVEL 1
X--- 1 ----
X! #define PATCHLEVEL 2
END_OF_FILE
if test 4949 -ne `wc -c <'patches02'`; then
echo shar: \"'patches02'\" unpacked with wrong size!
fi
# end of 'patches02'
fi
echo shar: End of shell archive.
exit 0