[comp.sources.games] v06i079: greed - a logic grid game using curses, Patch1

billr@saab.CNA.TEK.COM (Bill Randle) (06/21/89)

Submitted-by: uunet!iconsys!ohs!mday
Posting-number: Volume 6, Issue 79
Archive-name: greed.pch1
Patch-To: Volume 6, Issue 77

	[This article can be feed directly to patch(1).  This was
	 previously posted to comp.sources.games.bugs and is posted
	 here as an official patch so it will archived along with the
	 original source.  -br]

#! /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:  patches01
# Wrapped by billr@saab on Wed Jun 21 06:34:04 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'patches01' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'patches01'\"
else
echo shar: Extracting \"'patches01'\" \(4770 characters\)
sed "s/^X//" >'patches01' <<'END_OF_FILE'
XHere's patch #1 to Greed v1.1a, making it Greed v1.1b.  Thanks to Kriton
XKyrimis (kyrimis@princeton.princeton.edu) for pointing out a couple of
Xproblems and mailing me a patch to Greed that he wrote.  If other people
Xwho find problems with Greed would like to point them out to me, please follow
XKriton's idea of simply mailing them to me, that way I can keep the source
Xstandard through the version number.  I will always fix any problem mailed
Xto me and post it as soon as possible.
X
XThis patch fixes two problems:
X  1)  The messages that appear on the bottom line never "disappear", now
X	they are removed after you make your next move.
X  2)  The help window creates problems with certain systems by not redrawing
X	the grid screen properly after it goes away, now, of course, it does.
X
XI also made some slight cosmetic changes to where messages go and how they
Xgo there, plus I made slight changes to Kriton's original patch, so Kriton,
Xyou will also want to apply this patch to your originals.
X
XTo apply the following patch, simply save it under a name, and type:
Xpatch < name_you_saved_it_under
X
XIf you don't have Larry Wall's "patch" program, either get it, manually
Xapply this patch, or forget the whole thing.
X
X*** dist/greed.c	Sat Jun 17 08:48:47 1989
X--- greed.c	Sat Jun 17 09:06:23 1989
X***************
X*** 1,4 ****
X! /* greed.c v1.1a - Written by Matthew T. Day (mday@ohs.uucp), 06/12/89 */
X  
X  #include <curses.h>
X  #include <signal.h>
X--- 1,4 ----
X! /* greed.c v1.1b - Written by Matthew T. Day (mday@ohs.uucp), 06/17/89 */
X  
X  #include <curses.h>
X  #include <signal.h>
X***************
X*** 77,90 ****
X  
X  	(void) wmove(gridwin, y, x);
X  	waddstr(botwin, "Score: ");
X! 	mvwaddstr(botwin, 0, 40, "Greed v1.1a - Hit '?' for help.");
X  	showscore();
X  
X  	while ((val = tunnel(wgetch(gridwin))) > 0);
X  
X  	if (!val) {
X! 		mvwaddstr(botwin, 0, 20, "Hit <Enter>");
X! 		wrefresh(botwin);
X  		while (wgetch(botwin) != '\n');
X  	}
X  	(void) wclear(botwin);
X--- 77,89 ----
X  
X  	(void) wmove(gridwin, y, x);
X  	waddstr(botwin, "Score: ");
X! 	mvwaddstr(botwin, 0, 40, "Greed v1.1b - Hit '?' for help.");
X  	showscore();
X  
X  	while ((val = tunnel(wgetch(gridwin))) > 0);
X  
X  	if (!val) {
X! 		botmsg("Hit <Enter>");
X  		while (wgetch(botwin) != '\n');
X  	}
X  	(void) wclear(botwin);
X***************
X*** 103,108 ****
X--- 102,108 ----
X  register cmd;
X  {
X  	register dy, dx, distance;
X+ 	static int havebotmsg = 0;
X  
X  	switch (cmd) {
X  	case 'h': case '4':
X***************
X*** 131,136 ****
X--- 131,137 ----
X  		break;
X  	case 'q':
X  		botmsg("Really quit? ");
X+ 		havebotmsg = 1;
X  		if (wgetch(botwin) == 'y') return(-1);
X  		wrefresh(gridwin);
X  		return(1);
X***************
X*** 167,177 ****
X--- 168,185 ----
X  			} else {
X  				botmsg("Bad move.");
X  				wrefresh(gridwin);
X+ 				havebotmsg = 1;
X  				return(1);
X  			}
X  		} while (--d);
X  	}
X  
X+ 	if (havebotmsg) {
X+ 		botmsg("");
X+ 		wrefresh(gridwin);
X+ 		havebotmsg = 0;
X+ 	}
X+ 
X  	do {
X  		y += dy;
X  		x += dx;
X***************
X*** 188,195 ****
X  register char *msg;
X  {
X  	(void) wmove(botwin, 0, 40);
X- 	wclrtoeol(botwin);
X  	waddstr(botwin, msg);
X  	wrefresh(botwin);
X  }
X  
X--- 196,203 ----
X  register char *msg;
X  {
X  	(void) wmove(botwin, 0, 40);
X  	waddstr(botwin, msg);
X+ 	wclrtoeol(botwin);
X  	wrefresh(botwin);
X  }
X  
X***************
X*** 283,295 ****
X  help() {
X  	WINDOW *helpwin = newwin(16, 65, 1, 7);
X  
X- 	overlay(helpwin, gridwin);
X  	(void) wclear(helpwin);
X  	box(helpwin, '|', '-');
X  	(void) waddch(helpwin, '+'); mvwaddch(helpwin, 0, 64, '+');
X  	mvwaddch(helpwin, 15, 0, '+'); mvwaddch(helpwin, 15, 64, '+');
X  
X! 	msg(1, "Welcome to Greed v1.1a, by Matthew T. Day (mday@ohs.uucp).");
X  	msg(3, "The object of Greed is to erase as much of the screen as");
X  	msg(4, "possible by moving around in a grid of numbers.  To move your");
X  	msg(5, "cursor, simply use the standard hjklyubn keys or the number");
X--- 291,302 ----
X  help() {
X  	WINDOW *helpwin = newwin(16, 65, 1, 7);
X  
X  	(void) wclear(helpwin);
X  	box(helpwin, '|', '-');
X  	(void) waddch(helpwin, '+'); mvwaddch(helpwin, 0, 64, '+');
X  	mvwaddch(helpwin, 15, 0, '+'); mvwaddch(helpwin, 15, 64, '+');
X  
X! 	msg(1, "Welcome to Greed v1.1b, by Matthew T. Day (mday@ohs.uucp).");
X  	msg(3, "The object of Greed is to erase as much of the screen as");
X  	msg(4, "possible by moving around in a grid of numbers.  To move your");
X  	msg(5, "cursor, simply use the standard hjklyubn keys or the number");
X-- 
X+----------------------------------------------------------+-----------------+
X| Matthew T. Day, Orem High School, Orem, Utah             | "He who laughs, |
X| Internet: mday@ohs.uucp  UUCP: ..!uunet!iconsys!ohs!mday |  lasts."        |
X+----------------------------------------------------------+-----------------+
X
X
END_OF_FILE
if test 4770 -ne `wc -c <'patches01'`; then
    echo shar: \"'patches01'\" unpacked with wrong size!
fi
# end of 'patches01'
fi
echo shar: End of shell archive.
exit 0