[comp.sources.games.bugs] Patch #1 for Greed, please apply

scott@dtscp1.UUCP (Scott Barman) (06/21/89)

In article <313@ohs.UUCP> mday@ohs.UUCP (Matthew T. Day) writes:
>Here's patch #1 to Greed v1.1a, making it Greed v1.1b.  Thanks to Kriton

Would someone PLEASE repost of mail me a copy.  The end of it seems
to have never found its way here!

Thanks.

-- 
scott barman
{gatech, emory}!dtscp1!scott

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

In article <790@dtscp1.UUCP> scott@dtscp1.UUCP (Scott Barman) writes:
>Would someone PLEASE repost of mail me a copy.  The end of it seems

I just posted it to comp.sources.games.

	-Bill Randle
	Moderator, comp.sources.games
	Tektronix, Inc.
	games@saab.CNA.TEK.COM

tpf@jdyx.UUCP (Tom Friedel) (06/24/89)

Greed would be a incredible game (in my opinion) if there was a time
limit associated with each move.  Perhaps ten seconds.   As it is now I
would imagine score is proportional to timne spent on each move, and
not a factor of pure greed skill.

Tom

no sig today

gordon@prls.UUCP (Gordon Vickers) (06/26/89)

In article <267@jdyx.UUCP> tpf@jdyx.UUCP (Tom Friedel) writes:
->Greed would be a incredible game (in my opinion) if there was a time
->limit associated with each move.  Perhaps ten seconds.   As it is now I
->would imagine score is proportional to timne spent on each move, and
->not a factor of pure greed skill.

     But then I couldn't hit my "print screen" key and use a pencil
  to map out a route !   :-)

no sig from me today either.

mday@ohs.UUCP (Matthew T. Day) (07/22/89)

Here's patch #1 to Greed v1.1a, making it Greed v1.1b.  Thanks to Kriton
Kyrimis (kyrimis@princeton.princeton.edu) for pointing out a couple of
problems and mailing me a patch to Greed that he wrote.  If other people
who find problems with Greed would like to point them out to me, please follow
Kriton's idea of simply mailing them to me, that way I can keep the source
standard through the version number.  I will always fix any problem mailed
to me and post it as soon as possible.

This patch fixes two problems:
  1)  The messages that appear on the bottom line never "disappear", now
	they are removed after you make your next move.
  2)  The help window creates problems with certain systems by not redrawing
	the grid screen properly after it goes away, now, of course, it does.

I also made some slight cosmetic changes to where messages go and how they
go there, plus I made slight changes to Kriton's original patch, so Kriton,
you will also want to apply this patch to your originals.

To apply the following patch, simply save it under a name, and type:
patch < name_you_saved_it_under

If you don't have Larry Wall's "patch" program, either get it, manually
apply this patch, or forget the whole thing.

*** dist/greed.c	Sat Jun 17 08:48:47 1989
--- greed.c	Sat Jun 17 09:06:23 1989
***************
*** 1,4 ****
! /* greed.c v1.1a - Written by Matthew T. Day (mday@ohs.uucp), 06/12/89 */
  
  #include <curses.h>
  #include <signal.h>
--- 1,4 ----
! /* greed.c v1.1b - Written by Matthew T. Day (mday@ohs.uucp), 06/17/89 */
  
  #include <curses.h>
  #include <signal.h>
***************
*** 77,90 ****
  
  	(void) wmove(gridwin, y, x);
  	waddstr(botwin, "Score: ");
! 	mvwaddstr(botwin, 0, 40, "Greed v1.1a - Hit '?' for help.");
  	showscore();
  
  	while ((val = tunnel(wgetch(gridwin))) > 0);
  
  	if (!val) {
! 		mvwaddstr(botwin, 0, 20, "Hit <Enter>");
! 		wrefresh(botwin);
  		while (wgetch(botwin) != '\n');
  	}
  	(void) wclear(botwin);
--- 77,89 ----
  
  	(void) wmove(gridwin, y, x);
  	waddstr(botwin, "Score: ");
! 	mvwaddstr(botwin, 0, 40, "Greed v1.1b - Hit '?' for help.");
  	showscore();
  
  	while ((val = tunnel(wgetch(gridwin))) > 0);
  
  	if (!val) {
! 		botmsg("Hit <Enter>");
  		while (wgetch(botwin) != '\n');
  	}
  	(void) wclear(botwin);
***************
*** 103,108 ****
--- 102,108 ----
  register cmd;
  {
  	register dy, dx, distance;
+ 	static int havebotmsg = 0;
  
  	switch (cmd) {
  	case 'h': case '4':
***************
*** 131,136 ****
--- 131,137 ----
  		break;
  	case 'q':
  		botmsg("Really quit? ");
+ 		havebotmsg = 1;
  		if (wgetch(botwin) == 'y') return(-1);
  		wrefresh(gridwin);
  		return(1);
***************
*** 167,177 ****
--- 168,185 ----
  			} else {
  				botmsg("Bad move.");
  				wrefresh(gridwin);
+ 				havebotmsg = 1;
  				return(1);
  			}
  		} while (--d);
  	}
  
+ 	if (havebotmsg) {
+ 		botmsg("");
+ 		wrefresh(gridwin);
+ 		havebotmsg = 0;
+ 	}
+ 
  	do {
  		y += dy;
  		x += dx;
***************
*** 188,195 ****
  register char *msg;
  {
  	(void) wmove(botwin, 0, 40);
- 	wclrtoeol(botwin);
  	waddstr(botwin, msg);
  	wrefresh(botwin);
  }
  
--- 196,203 ----
  register char *msg;
  {
  	(void) wmove(botwin, 0, 40);
  	waddstr(botwin, msg);
+ 	wclrtoeol(botwin);
  	wrefresh(botwin);
  }
  
***************
*** 283,295 ****
  help() {
  	WINDOW *helpwin = newwin(16, 65, 1, 7);
  
- 	overlay(helpwin, gridwin);
  	(void) wclear(helpwin);
  	box(helpwin, '|', '-');
  	(void) waddch(helpwin, '+'); mvwaddch(helpwin, 0, 64, '+');
  	mvwaddch(helpwin, 15, 0, '+'); mvwaddch(helpwin, 15, 64, '+');
  
! 	msg(1, "Welcome to Greed v1.1a, by Matthew T. Day (mday@ohs.uucp).");
  	msg(3, "The object of Greed is to erase as much of the screen as");
  	msg(4, "possible by moving around in a grid of numbers.  To move your");
  	msg(5, "cursor, simply use the standard hjklyubn keys or the number");
--- 291,302 ----
  help() {
  	WINDOW *helpwin = newwin(16, 65, 1, 7);
  
  	(void) wclear(helpwin);
  	box(helpwin, '|', '-');
  	(void) waddch(helpwin, '+'); mvwaddch(helpwin, 0, 64, '+');
  	mvwaddch(helpwin, 15, 0, '+'); mvwaddch(helpwin, 15, 64, '+');
  
! 	msg(1, "Welcome to Greed v1.1b, by Matthew T. Day (mday@ohs.uucp).");
  	msg(3, "The object of Greed is to erase as much of the screen as");
  	msg(4, "possible by moving around in a grid of numbers.  To move your");
  	msg(5, "cursor, simply use the standard hjklyubn keys or the number");
-- 
+----------------------------------------------------------+-----------------+
| Matthew T. Day, Orem High School, Orem, Utah             | "He who laughs, |
| Internet: mday@ohs.uucp  UUCP: ..!uunet!iconsys!ohs!mday |  lasts."        |
+----------------------------------------------------------+-----------------+