[comp.sources.games] v09i049: othello2 - othello game for SunView/XView/X11/curses, Patch4

billr@saab.CNA.TEK.COM (Bill Randle) (05/10/90)

Submitted-by: Rich Burridge <rburridge@sun.COM>
Posting-number: Volume 9, Issue 49
Archive-name: othello2/Patch4
Patch-To: othello2: Volume 9, Issue 37-40


[[This is official patch #4 for othello v1.3; please apply it.

It makes the following changes.

       * From Alfred Nathaniel <nath%cernvax.cern.ch@munnari.oz>
         Linting the different versions has been separated out. Lint should
         receive the cc macro definitions as well.
 
       * From Alfred Nathaniel <nath%cernvax.cern.ch@munnari.oz>
         The x11 functions do_menu() and process_expose() do not (always)
         return a valid function value. There is also no window name specified.
 
       * From Alfred Nathaniel <nath%cernvax.cern.ch@munnari.oz>
         There is a name clash with the lock routine on a DECstation running
         Ultrix 3.1. It clashes with an external definition in Xlib
         which gives a linker warning. Othellos' lock routine has been
         renamed to lock_screen.

       * From Arnold Gill <ziffle@radopt.Phy.QueensU.CA>
              Martin Chudley <cs.qmw.ac.uk!martinc@munnari.oz>
              John Eras <jeras@hqsun2.oracle.com> [fix]
         With the tty version, the score gets displayed incorrectly.

       * From W Mat Waites <tekred!mailrus!gatech!emcard!mat@uunet.uu.net>
         The System V sprintf does not return the address of the buffer.

       * Images were being incorrectly stenciled/drawn on color screens
         for the X11 and XView versions.]]

#! /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:  patches04
# Wrapped by billr@saab on Wed May  9 12:20:27 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'patches04' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'patches04'\"
else
echo shar: Extracting \"'patches04'\" \(14108 characters\)
sed "s/^X//" >'patches04' <<'END_OF_FILE'
X------- othello.c -------
X*** /tmp/da18676	Tue May  8 19:12:03 1990
X--- othello.c	Tue May  8 18:46:31 1990
X***************
X*** 340,347 ****
X          draw_piece(board.square[i], x, CY+y, RSRC) ;
X        }
X    batch(IS_OFF) ;
X!   message(SCORE_MES, sprintf(line, "White: %2d, Black: %2d",
X!                           count(&board, WHITE), count(&board, BLACK))) ;
X  }
X  
X  
X--- 340,348 ----
X          draw_piece(board.square[i], x, CY+y, RSRC) ;
X        }
X    batch(IS_OFF) ;
X!   SPRINTF(line, "White: %2d, Black: %2d",
X!  There a                 count(&board, WHITE), count(&board, BLACK)) ;
X!   message(SCORE_MES, line) ;
X  }
X  
X  
X
X------- sunview.c -------
X*** /tmp/da18679	Tue May  8 19:12:04 1990
X--- sunview.c	Tue May  8 18:16:41 1990
X***************
X*** 264,270 ****
X  }
X  
X  
X! lock(state)   /* Turn graphics locking on or off. */
X  enum bltype state ;
X  {
X    static struct rect r = { 0, 0, TOTAL_WIDTH+1, TOTAL_WIDTH+1 } ;
X--- 264,270 ----
X  }
X  
X  
X! lock_screen(state)   /* Turn graphics locking on or off. */
X  enum bltype state ;
X  {
X    static struct rect r = { 0, 0, TOTAL_WIDTH+1, TOTAL_WIDTH+1 } ;
X
X------- othello.h -------
X*** /tmp/da18682	Tue May  8 19:12:05 1990
X--- othello.h	Tue May  8 18:34:34 1990
X***************
X*** 37,43 ****
X  #define  SELECT        (void) select
X  #define  SIGNAL        (void) signal
X  #define  SPRINTF       (void) sprintf
X- #define  SSCANF        (void) sscanf
X  #define  STRCAT        (void) strcat
X  #define  STRCPY        (void) strcpy
X  #define  WRITE         (void) write
X--- 37,42 ----
X
X------- patchlevel.h -------
X*** /tmp/da18685	Tue May  8 19:12:05 1990
X--- patchlevel.h	Tue May  8 17:56:54 1990
X***************
X*** 19,22 ****
X   *  to me, then an attempt will be made to fix them.
X   */
X  
X! #define  PATCHLEVEL  3
X--- 19,22 ----
X   *  to me, then an attempt will be made to fix them.
X   */
X  
X! #define  PATCHLEVEL  4
X
X------- README -------
X*** /tmp/da18688	Tue May  8 19:12:06 1990
X--- README	Tue May  8 18:32:16 1990
X***************
X*** 29,35 ****
X  Thanks go also to Valerie Haecky, Daniel Yang, Eric R. Jorgensen,
X  John Rosauer, Steve Misrack, Hugues Leroy, Linton Miller, Mike Stump,
X  D. Hugh Redelmeier, Scott W. Danielson, Gary D. Kline, Kjetil Torgrim
X! Homme and Peter Johansson for bug reports and/or bug fixes plus suggested
X  enhancements.
X  
X  
X--- 29,36 ----
X  Thanks go also to Valerie Haecky, Daniel Yang, Eric R. Jorgensen,
X  John Rosauer, Steve Misrack, Hugues Leroy, Linton Miller, Mike Stump,
X  D. Hugh Redelmeier, Scott W. Danielson, Gary D. Kline, Kjetil Torgrim
X! Homme, Peter Johansson, Alfred Nathaniel, Arnold Gill, Martin Chudley
X! and W Mat Waites for bug reports and/or bug fixes plus suggested
X  enhancements.
X  
X  
X
X------- Makefile -------
X*** /tmp/da18691	Tue May  8 19:12:07 1990
X--- Makefile	Tue May  8 19:10:35 1990
X***************
X*** 69,76 ****
X  #
X  #  Compilation flags and standard macro definitions.
X  #
X! CFLAGS          = -g $(NO_USLEEP) $(REMNAME) $(SIGRET) \
X! 		     $(X11INCDIR) $(XVIEWINCDIR)
X  #
X  #==========================================================================
X  
X--- 69,77 ----
X  #
X  #  Compilation flags and standard macro definitions.
X  #
X! CDEFS		= $(NO_USLEEP) $(REMNAME) $(SIGRET) \
X! 		  $(X11INCDIR) $(XVIEWINCDIR)
X! CFLAGS		= -g $(CDEFS)
X  #
X  #==========================================================================
X  
X***************
X*** 143,152 ****
X  
X  clean:;         rm -f *.o Part* *~ $(BINARIES) core
X  
X! lint:;          lint $(STDSRCS) sunview.c $(SVIEWLIBS)
X! 		lint $(STDSRCS) tty.c $(TTYLIBS)
X! 		lint $(STDSRCS) xview.c $(XVIEWLIBS) 
X! 		lint $(STDSRCS) x11.c $(X11LIBS) 
X  
X  shar:;          shar.script $(SFILES1) > Part1
X  		shar.script $(SFILES2) > Part2
X--- 144,154 ----
X  
X  clean:;         rm -f *.o Part* *~ $(BINARIES) core
X  
X! lint:		lint-sunview lint-tty lint-xview lint-x11
X! lint-sunview:;	lint $(CDEFS) $(STDSRCS) sunview.c $(SVIEWLIBS)
X! lint-tty:;	lint $(CDEFS) $(STDSRCS) tty.c $(TTYLIBS)
X! lint-xview:;	lint $(CDEFS) $(STDSRCS) xview.c $(XVIEWLIBS) 
X! lint-x11:;	lint $(CDEFS) $(STDSRCS) x11.c $(X11LIBS) 
X  
X  shar:;          shar.script $(SFILES1) > Part1
X  		shar.script $(SFILES2) > Part2
X
X------- CHANGES -------
X*** /tmp/da18694	Tue May  8 19:12:07 1990
X--- CHANGES	Tue May  8 19:11:25 1990
X***************
X*** 91,93 ****
X--- 91,120 ----
X  
X         * Release of the current version of makemove.c, because the changes
X           to this file at patch level #1 never made it out.
X+ 
X+ v1.3 - patchlevel 4. 8th May 1990.
X+ 
X+        * From Alfred Nathaniel <nath%cernvax.cern.ch@munnari.oz>
X+          Linting the different versions has been separated out. Lint should
X+          receive the cc macro definitions as well.
X+ 
X+        * From Alfred Nathaniel <nath%cernvax.cern.ch@munnari.oz>
X+          The x11 functions do_menu() and process_expose() do not (always)
X+          return a valid function value. There is also no window name specified.
X+ 
X+        * From Alfred Nathaniel <nath%cernvax.cern.ch@munnari.oz>
X+          There is a name clash with the lock routine on a DECstation running
X+          Ultrix 3.1. It clashes with an external definition in Xlib
X+          which gives a linker warning. Othellos' lock routine has been
X+          renamed to lock_screen.
X+ 
X+        * From Arnold Gill <ziffle@radopt.Phy.QueensU.CA>
X+               Martin Chudley <cs.qmw.ac.uk!martinc@munnari.oz>
X+               John Eras <jeras@hqsun2.oracle.com> [fix]
X+          With the tty version, the score gets displayed incorrectly.
X+ 
X+        * From W Mat Waites <tekred!mailrus!gatech!emcard!mat@uunet.uu.net>
X+          The System V sprintf does not return the address of the buffer.
X+ 
X+        * Images were being incorrectly stenciled/drawn on color screens
X+          for the X11 and XView versions.
X
X------- boardstuff.c -------
X*** /tmp/da18697	Tue May  8 19:12:08 1990
X--- boardstuff.c	Tue May  8 18:45:45 1990
X***************
X*** 30,36 ****
X  {
X    int x0, y0, x1, y1, x, y, dx, dy, ctr ;
X  
X!   lock(IS_ON) ;
X    get_xy(move, &x1, &y1) ;
X    dx = x1 ;
X    dy = y1 ;
X--- 30,36 ----
X  {
X    int x0, y0, x1, y1, x, y, dx, dy, ctr ;
X  
X!   lock_screen(IS_ON) ;
X    get_xy(move, &x1, &y1) ;
X    dx = x1 ;
X    dy = y1 ;
X***************
X*** 80,86 ****
X          }
X        draw_piece(WHITE, x, CY+y, RINV) ;
X      }
X!   lock(IS_OFF) ;
X  }
X  
X  
X--- 80,86 ----
X          }
X        draw_piece(WHITE, x, CY+y, RINV) ;
X      }
X!   lock_screen(IS_OFF) ;
X  }
X  
X  
X***************
X*** 103,110 ****
X      }
X    if ((move = makemove(&board, player, 0)) == NOMOVE)
X      {
X!       message(PANEL_MES, sprintf(line,"%s %s forced to pass",
X!                         who[(int) play_mode], be[(int) play_mode])) ;
X        if ((move = makemove(&board, OPPONENT(player), 0)) == NOMOVE)
X          {
X            who_wins() ;
X--- 103,111 ----
X      }
X    if ((move = makemove(&board, player, 0)) == NOMOVE)
X      {
X!       SPRINTF(line, "%s %s forced to pass",
X!                      who[(int) play_mode], be[(int) play_mode]) ;
X!       message(PANEL_MES, line) ;
X        if ((move = makemove(&board, OPPONENT(player), 0)) == NOMOVE)
X          {
X            who_wins() ;
X***************
X*** 139,148 ****
X    taken = formfliplist(move, player) ;
X    update_board_image() ;
X    if (taken == 1)
X!     message(PANEL_MES, sprintf(line, "%s took 1 piece", who[(int) play_mode])) ;
X    else
X!     message(PANEL_MES, sprintf(line, "%s took %d pieces",
X!                                       who[(int) play_mode],taken)) ;
X  }
X  
X  
X--- 140,154 ----
X    taken = formfliplist(move, player) ;
X    update_board_image() ;
X    if (taken == 1)
X!     {
X!       SPRINTF(line, "%s took 1 piece", who[(int) play_mode]) ;
X!       message(PANEL_MES, line) ;
X!     }
X    else
X!     {
X!       SPRINTF(line, "%s took %d pieces", who[(int) play_mode],taken) ;
X!       message(PANEL_MES, line) ;
X!     }
X  }
X  
X  
X***************
X*** 267,274 ****
X        batch(IS_OFF) ;
X        PAUSE ;
X      }
X!   message(SCORE_MES, sprintf(line, "White: %2d, Black: %2d",
X!                           count(&board, WHITE), count(&board, BLACK))) ;
X  }
X  
X  
X--- 273,281 ----
X        batch(IS_OFF) ;
X        PAUSE ;
X      }
X!   SPRINTF(line, "White: %2d, Black: %2d",
X!                  count(&board, WHITE), count(&board, BLACK)) ;
X!   message(SCORE_MES, line) ;
X  }
X  
X  
X***************
X*** 278,286 ****
X  
X    ps = count(&board, WHITE) ;
X    cs = count(&board, BLACK) ;
X!   if (ps > cs) message(SCORE_MES, sprintf(line, "White wins %d-%d", ps, cs)) ;
X!   else if (ps == cs) message(SCORE_MES, sprintf(line,"A tie %d-%d", ps, cs)) ;
X!   else message(SCORE_MES, sprintf(line,"Black wins %d-%d", cs, ps)) ;
X    if (cretin_flag) message(REMARK_MES, "*** CRETIN! ***") ;
X    else message(REMARK_MES, "") ;
X  }
X--- 285,305 ----
X  
X    ps = count(&board, WHITE) ;
X    cs = count(&board, BLACK) ;
X!   if (ps > cs)
X!     {
X!       SPRINTF(line, "White wins %d-%d", ps, cs) ;
X!       message(SCORE_MES, line) ;
X!     }
X!   else if (ps == cs)
X!     {
X!       SPRINTF(line,"A tie %d-%d", ps, cs) ;
X!       message(SCORE_MES, line) ;
X!     }
X!   else
X!     {
X!       SPRINTF(line, "Black wins %d-%d", cs, ps) ;
X!       message(SCORE_MES, line) ;
X!     }
X    if (cretin_flag) message(REMARK_MES, "*** CRETIN! ***") ;
X    else message(REMARK_MES, "") ;
X  }
X
X------- x11.c -------
X*** /tmp/da18700	Tue May  8 19:12:09 1990
X--- x11.c	Tue May  8 19:05:59 1990
X***************
X*** 154,160 ****
X  
X  do_menu(mtype)          /* Display popup menu for cyclic item. */
X  enum item_type mtype ;
X! {}
X  
X  
X  draw_image(x, y, width, height, image)
X--- 154,162 ----
X  
X  do_menu(mtype)          /* Display popup menu for cyclic item. */
X  enum item_type mtype ;
X! {
X!   return(0) ;
X! }
X  
X  
X  draw_image(x, y, width, height, image)
X***************
X*** 360,366 ****
X  
X  
X  /*ARGSUSED*/
X! lock(state)        /* Turn graphics locking on or off - null routine. */
X  enum bltype state ;
X  {}
X  
X--- 362,368 ----
X  
X  
X  /*ARGSUSED*/
X! lock_screen(state)     /* Turn graphics locking on or off - null routine. */
X  enum bltype state ;
X  {}
X  
X***************
X*** 416,422 ****
X    protocol_atom = XInternAtom(dpy, "WM_PROTOCOLS", False) ;
X    kill_atom = XInternAtom(dpy, "WM_DELETE_WINDOW", False) ;
X           
X!   XSetStandardProperties(dpy, frame, "", NULL, othello_icon,
X                           argv, argc, &size) ;
X  
X    wm_hints.icon_x = ix ;
X--- 418,424 ----
X    protocol_atom = XInternAtom(dpy, "WM_PROTOCOLS", False) ;
X    kill_atom = XInternAtom(dpy, "WM_DELETE_WINDOW", False) ;
X           
X!   XSetStandardProperties(dpy, frame, "othello", NULL, othello_icon,
X                           argv, argc, &size) ;
X  
X    wm_hints.icon_x = ix ;
X***************
X*** 438,446 ****
X    gc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
X  
X    ropgc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
X!   gc_val.function = GXor ;
X!   gc_val.fill_style = FillOpaqueStippled ;
X!   XChangeGC(dpy, ropgc, GCFunction | GCFillStyle, &gc_val) ;
X  
X    stencilgc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
X    XSetFillStyle(dpy, stencilgc, FillOpaqueStippled) ;
X--- 440,446 ----
X    gc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
X  
X    ropgc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
X!   XSetFillStyle(dpy, ropgc, FillStippled) ;
X  
X    stencilgc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
X    XSetFillStyle(dpy, stencilgc, FillOpaqueStippled) ;
X***************
X*** 531,537 ****
X      if (event->count == 0 && event->window == frame) doframe++ ;
X    while (XCheckMaskEvent(dpy, ExposureMask, event)) ;
X  
X!   if (doframe) return(FRAME_REPAINT) ;
X  }
X  
X  
X--- 531,537 ----
X      if (event->count == 0 && event->window == frame) doframe++ ;
X    while (XCheckMaskEvent(dpy, ExposureMask, event)) ;
X  
X!   return(doframe ? FRAME_REPAINT : IGNORE_EVENT) ;
X  }
X  
X  
X
X------- xview.c -------
X*** /tmp/da18703	Tue May  8 19:12:11 1990
X--- xview.c	Tue May  8 19:01:09 1990
X***************
X*** 289,295 ****
X  }
X  
X  
X! lock(state)        /* Turn graphics locking on or off - null routine. */
X  enum bltype state ;
X  {}
X  
X--- 289,295 ----
X  }
X  
X  
X! lock_screen(state)     /* Turn graphics locking on or off - null routine. */
X  enum bltype state ;
X  {}
X  
X***************
X*** 331,339 ****
X    gc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
X  
X    ropgc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
X!   gc_val.function = GXor ;
X!   gc_val.fill_style = FillOpaqueStippled ;
X!   XChangeGC(dpy, ropgc, GCFunction | GCFillStyle, &gc_val) ;
X  
X    stencilgc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
X    XSetFillStyle(dpy, stencilgc, FillOpaqueStippled) ;
X--- 331,337 ----
X    gc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
X  
X    ropgc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
X!   XSetFillStyle(dpy, ropgc, FillStippled) ;
X  
X    stencilgc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
X    XSetFillStyle(dpy, stencilgc, FillOpaqueStippled) ;
X
X------- tty.c -------
X*** /tmp/da18706	Tue May  8 19:12:12 1990
X--- tty.c	Tue May  8 18:27:59 1990
X***************
X*** 299,306 ****
X                  othervals[(int) REMARK_MES].row, str, TRUE) ;
X    else if (y == 237)                                    /* Score message. */
X      {
X!       SSCANF(str, "White: %1d, Black: %1d", &white, &black) ;
X!       SPRINTF(str, "White (O): %1d, Black (X): %1d", white, black) ;
X        draw_string(othervals[(int) SCORE_MES].column,
X                    othervals[(int) SCORE_MES].row,  str, TRUE) ;
X      }
X--- 299,306 ----
X                  othervals[(int) REMARK_MES].row, str, TRUE) ;
X    else if (y == 237)                                    /* Score message. */
X      {
X!       if (sscanf(str, "White: %d, Black: %d", &white, &black) == 2)
X!         SPRINTF(str, "White (O): %d, Black (X): %d", white, black) ;
X        draw_string(othervals[(int) SCORE_MES].column,
X                    othervals[(int) SCORE_MES].row,  str, TRUE) ;
X      }
X***************
X*** 385,391 ****
X  
X  
X  /*ARGSUSED*/
X! lock(state)       /* Graphics locking - null routine. */
X  enum bltype state ;
X  {}
X  
X--- 385,391 ----
X  
X  
X  /*ARGSUSED*/
X! lock_screen(state)     /* Graphics locking - null routine. */
X  enum bltype state ;
X  {}
X  
X
X
X----- End Included Message -----
X
X
END_OF_FILE
if test 14108 -ne `wc -c <'patches04'`; then
    echo shar: \"'patches04'\" unpacked with wrong size!
fi
# end of 'patches04'
fi
echo shar: End of shell archive.
exit 0