[comp.sources.games.bugs] Official patch #4 for othello v1.3; please apply it.

richb@sunaus.oz (Rich Burridge) (05/08/90)

[A copy has been sent to the moderator of comp.sources.games for archiving].

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.


------- othello.c -------
*** /tmp/da18676	Tue May  8 19:12:03 1990
--- othello.c	Tue May  8 18:46:31 1990
***************
*** 340,347 ****
          draw_piece(board.square[i], x, CY+y, RSRC) ;
        }
    batch(IS_OFF) ;
!   message(SCORE_MES, sprintf(line, "White: %2d, Black: %2d",
!                           count(&board, WHITE), count(&board, BLACK))) ;
  }
  
  
--- 340,348 ----
          draw_piece(board.square[i], x, CY+y, RSRC) ;
        }
    batch(IS_OFF) ;
!   SPRINTF(line, "White: %2d, Black: %2d",
!                  count(&board, WHITE), count(&board, BLACK)) ;
!   message(SCORE_MES, line) ;
  }
  
  

------- sunview.c -------
*** /tmp/da18679	Tue May  8 19:12:04 1990
--- sunview.c	Tue May  8 18:16:41 1990
***************
*** 264,270 ****
  }
  
  
! lock(state)   /* Turn graphics locking on or off. */
  enum bltype state ;
  {
    static struct rect r = { 0, 0, TOTAL_WIDTH+1, TOTAL_WIDTH+1 } ;
--- 264,270 ----
  }
  
  
! lock_screen(state)   /* Turn graphics locking on or off. */
  enum bltype state ;
  {
    static struct rect r = { 0, 0, TOTAL_WIDTH+1, TOTAL_WIDTH+1 } ;

------- othello.h -------
*** /tmp/da18682	Tue May  8 19:12:05 1990
--- othello.h	Tue May  8 18:34:34 1990
***************
*** 37,43 ****
  #define  SELECT        (void) select
  #define  SIGNAL        (void) signal
  #define  SPRINTF       (void) sprintf
- #define  SSCANF        (void) sscanf
  #define  STRCAT        (void) strcat
  #define  STRCPY        (void) strcpy
  #define  WRITE         (void) write
--- 37,42 ----

------- patchlevel.h -------
*** /tmp/da18685	Tue May  8 19:12:05 1990
--- patchlevel.h	Tue May  8 17:56:54 1990
***************
*** 19,22 ****
   *  to me, then an attempt will be made to fix them.
   */
  
! #define  PATCHLEVEL  3
--- 19,22 ----
   *  to me, then an attempt will be made to fix them.
   */
  
! #define  PATCHLEVEL  4

------- README -------
*** /tmp/da18688	Tue May  8 19:12:06 1990
--- README	Tue May  8 18:32:16 1990
***************
*** 29,35 ****
  Thanks go also to Valerie Haecky, Daniel Yang, Eric R. Jorgensen,
  John Rosauer, Steve Misrack, Hugues Leroy, Linton Miller, Mike Stump,
  D. Hugh Redelmeier, Scott W. Danielson, Gary D. Kline, Kjetil Torgrim
! Homme and Peter Johansson for bug reports and/or bug fixes plus suggested
  enhancements.
  
  
--- 29,36 ----
  Thanks go also to Valerie Haecky, Daniel Yang, Eric R. Jorgensen,
  John Rosauer, Steve Misrack, Hugues Leroy, Linton Miller, Mike Stump,
  D. Hugh Redelmeier, Scott W. Danielson, Gary D. Kline, Kjetil Torgrim
! Homme, Peter Johansson, Alfred Nathaniel, Arnold Gill, Martin Chudley
! and W Mat Waites for bug reports and/or bug fixes plus suggested
  enhancements.
  
  

------- Makefile -------
*** /tmp/da18691	Tue May  8 19:12:07 1990
--- Makefile	Tue May  8 19:10:35 1990
***************
*** 69,76 ****
  #
  #  Compilation flags and standard macro definitions.
  #
! CFLAGS          = -g $(NO_USLEEP) $(REMNAME) $(SIGRET) \
! 		     $(X11INCDIR) $(XVIEWINCDIR)
  #
  #==========================================================================
  
--- 69,77 ----
  #
  #  Compilation flags and standard macro definitions.
  #
! CDEFS		= $(NO_USLEEP) $(REMNAME) $(SIGRET) \
! 		  $(X11INCDIR) $(XVIEWINCDIR)
! CFLAGS		= -g $(CDEFS)
  #
  #==========================================================================
  
***************
*** 143,152 ****
  
  clean:;         rm -f *.o Part* *~ $(BINARIES) core
  
! lint:;          lint $(STDSRCS) sunview.c $(SVIEWLIBS)
! 		lint $(STDSRCS) tty.c $(TTYLIBS)
! 		lint $(STDSRCS) xview.c $(XVIEWLIBS) 
! 		lint $(STDSRCS) x11.c $(X11LIBS) 
  
  shar:;          shar.script $(SFILES1) > Part1
  		shar.script $(SFILES2) > Part2
--- 144,154 ----
  
  clean:;         rm -f *.o Part* *~ $(BINARIES) core
  
! lint:		lint-sunview lint-tty lint-xview lint-x11
! lint-sunview:;	lint $(CDEFS) $(STDSRCS) sunview.c $(SVIEWLIBS)
! lint-tty:;	lint $(CDEFS) $(STDSRCS) tty.c $(TTYLIBS)
! lint-xview:;	lint $(CDEFS) $(STDSRCS) xview.c $(XVIEWLIBS) 
! lint-x11:;	lint $(CDEFS) $(STDSRCS) x11.c $(X11LIBS) 
  
  shar:;          shar.script $(SFILES1) > Part1
  		shar.script $(SFILES2) > Part2

------- CHANGES -------
*** /tmp/da18694	Tue May  8 19:12:07 1990
--- CHANGES	Tue May  8 19:11:25 1990
***************
*** 91,93 ****
--- 91,120 ----
  
         * Release of the current version of makemove.c, because the changes
           to this file at patch level #1 never made it out.
+ 
+ v1.3 - patchlevel 4. 8th May 1990.
+ 
+        * 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.

------- boardstuff.c -------
*** /tmp/da18697	Tue May  8 19:12:08 1990
--- boardstuff.c	Tue May  8 18:45:45 1990
***************
*** 30,36 ****
  {
    int x0, y0, x1, y1, x, y, dx, dy, ctr ;
  
!   lock(IS_ON) ;
    get_xy(move, &x1, &y1) ;
    dx = x1 ;
    dy = y1 ;
--- 30,36 ----
  {
    int x0, y0, x1, y1, x, y, dx, dy, ctr ;
  
!   lock_screen(IS_ON) ;
    get_xy(move, &x1, &y1) ;
    dx = x1 ;
    dy = y1 ;
***************
*** 80,86 ****
          }
        draw_piece(WHITE, x, CY+y, RINV) ;
      }
!   lock(IS_OFF) ;
  }
  
  
--- 80,86 ----
          }
        draw_piece(WHITE, x, CY+y, RINV) ;
      }
!   lock_screen(IS_OFF) ;
  }
  
  
***************
*** 103,110 ****
      }
    if ((move = makemove(&board, player, 0)) == NOMOVE)
      {
!       message(PANEL_MES, sprintf(line,"%s %s forced to pass",
!                         who[(int) play_mode], be[(int) play_mode])) ;
        if ((move = makemove(&board, OPPONENT(player), 0)) == NOMOVE)
          {
            who_wins() ;
--- 103,111 ----
      }
    if ((move = makemove(&board, player, 0)) == NOMOVE)
      {
!       SPRINTF(line, "%s %s forced to pass",
!                      who[(int) play_mode], be[(int) play_mode]) ;
!       message(PANEL_MES, line) ;
        if ((move = makemove(&board, OPPONENT(player), 0)) == NOMOVE)
          {
            who_wins() ;
***************
*** 139,148 ****
    taken = formfliplist(move, player) ;
    update_board_image() ;
    if (taken == 1)
!     message(PANEL_MES, sprintf(line, "%s took 1 piece", who[(int) play_mode])) ;
    else
!     message(PANEL_MES, sprintf(line, "%s took %d pieces",
!                                       who[(int) play_mode],taken)) ;
  }
  
  
--- 140,154 ----
    taken = formfliplist(move, player) ;
    update_board_image() ;
    if (taken == 1)
!     {
!       SPRINTF(line, "%s took 1 piece", who[(int) play_mode]) ;
!       message(PANEL_MES, line) ;
!     }
    else
!     {
!       SPRINTF(line, "%s took %d pieces", who[(int) play_mode],taken) ;
!       message(PANEL_MES, line) ;
!     }
  }
  
  
***************
*** 267,274 ****
        batch(IS_OFF) ;
        PAUSE ;
      }
!   message(SCORE_MES, sprintf(line, "White: %2d, Black: %2d",
!                           count(&board, WHITE), count(&board, BLACK))) ;
  }
  
  
--- 273,281 ----
        batch(IS_OFF) ;
        PAUSE ;
      }
!   SPRINTF(line, "White: %2d, Black: %2d",
!                  count(&board, WHITE), count(&board, BLACK)) ;
!   message(SCORE_MES, line) ;
  }
  
  
***************
*** 278,286 ****
  
    ps = count(&board, WHITE) ;
    cs = count(&board, BLACK) ;
!   if (ps > cs) message(SCORE_MES, sprintf(line, "White wins %d-%d", ps, cs)) ;
!   else if (ps == cs) message(SCORE_MES, sprintf(line,"A tie %d-%d", ps, cs)) ;
!   else message(SCORE_MES, sprintf(line,"Black wins %d-%d", cs, ps)) ;
    if (cretin_flag) message(REMARK_MES, "*** CRETIN! ***") ;
    else message(REMARK_MES, "") ;
  }
--- 285,305 ----
  
    ps = count(&board, WHITE) ;
    cs = count(&board, BLACK) ;
!   if (ps > cs)
!     {
!       SPRINTF(line, "White wins %d-%d", ps, cs) ;
!       message(SCORE_MES, line) ;
!     }
!   else if (ps == cs)
!     {
!       SPRINTF(line,"A tie %d-%d", ps, cs) ;
!       message(SCORE_MES, line) ;
!     }
!   else
!     {
!       SPRINTF(line, "Black wins %d-%d", cs, ps) ;
!       message(SCORE_MES, line) ;
!     }
    if (cretin_flag) message(REMARK_MES, "*** CRETIN! ***") ;
    else message(REMARK_MES, "") ;
  }

------- x11.c -------
*** /tmp/da18700	Tue May  8 19:12:09 1990
--- x11.c	Tue May  8 19:05:59 1990
***************
*** 154,160 ****
  
  do_menu(mtype)          /* Display popup menu for cyclic item. */
  enum item_type mtype ;
! {}
  
  
  draw_image(x, y, width, height, image)
--- 154,162 ----
  
  do_menu(mtype)          /* Display popup menu for cyclic item. */
  enum item_type mtype ;
! {
!   return(0) ;
! }
  
  
  draw_image(x, y, width, height, image)
***************
*** 360,366 ****
  
  
  /*ARGSUSED*/
! lock(state)        /* Turn graphics locking on or off - null routine. */
  enum bltype state ;
  {}
  
--- 362,368 ----
  
  
  /*ARGSUSED*/
! lock_screen(state)     /* Turn graphics locking on or off - null routine. */
  enum bltype state ;
  {}
  
***************
*** 416,422 ****
    protocol_atom = XInternAtom(dpy, "WM_PROTOCOLS", False) ;
    kill_atom = XInternAtom(dpy, "WM_DELETE_WINDOW", False) ;
           
!   XSetStandardProperties(dpy, frame, "", NULL, othello_icon,
                           argv, argc, &size) ;
  
    wm_hints.icon_x = ix ;
--- 418,424 ----
    protocol_atom = XInternAtom(dpy, "WM_PROTOCOLS", False) ;
    kill_atom = XInternAtom(dpy, "WM_DELETE_WINDOW", False) ;
           
!   XSetStandardProperties(dpy, frame, "othello", NULL, othello_icon,
                           argv, argc, &size) ;
  
    wm_hints.icon_x = ix ;
***************
*** 438,446 ****
    gc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
  
    ropgc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
!   gc_val.function = GXor ;
!   gc_val.fill_style = FillOpaqueStippled ;
!   XChangeGC(dpy, ropgc, GCFunction | GCFillStyle, &gc_val) ;
  
    stencilgc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
    XSetFillStyle(dpy, stencilgc, FillOpaqueStippled) ;
--- 440,446 ----
    gc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
  
    ropgc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
!   XSetFillStyle(dpy, ropgc, FillStippled) ;
  
    stencilgc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
    XSetFillStyle(dpy, stencilgc, FillOpaqueStippled) ;
***************
*** 531,537 ****
      if (event->count == 0 && event->window == frame) doframe++ ;
    while (XCheckMaskEvent(dpy, ExposureMask, event)) ;
  
!   if (doframe) return(FRAME_REPAINT) ;
  }
  
  
--- 531,537 ----
      if (event->count == 0 && event->window == frame) doframe++ ;
    while (XCheckMaskEvent(dpy, ExposureMask, event)) ;
  
!   return(doframe ? FRAME_REPAINT : IGNORE_EVENT) ;
  }
  
  

------- xview.c -------
*** /tmp/da18703	Tue May  8 19:12:11 1990
--- xview.c	Tue May  8 19:01:09 1990
***************
*** 289,295 ****
  }
  
  
! lock(state)        /* Turn graphics locking on or off - null routine. */
  enum bltype state ;
  {}
  
--- 289,295 ----
  }
  
  
! lock_screen(state)     /* Turn graphics locking on or off - null routine. */
  enum bltype state ;
  {}
  
***************
*** 331,339 ****
    gc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
  
    ropgc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
!   gc_val.function = GXor ;
!   gc_val.fill_style = FillOpaqueStippled ;
!   XChangeGC(dpy, ropgc, GCFunction | GCFillStyle, &gc_val) ;
  
    stencilgc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
    XSetFillStyle(dpy, stencilgc, FillOpaqueStippled) ;
--- 331,337 ----
    gc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
  
    ropgc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
!   XSetFillStyle(dpy, ropgc, FillStippled) ;
  
    stencilgc = XCreateGC(dpy, root, gc_mask, &gc_val) ;
    XSetFillStyle(dpy, stencilgc, FillOpaqueStippled) ;

------- tty.c -------
*** /tmp/da18706	Tue May  8 19:12:12 1990
--- tty.c	Tue May  8 18:27:59 1990
***************
*** 299,306 ****
                  othervals[(int) REMARK_MES].row, str, TRUE) ;
    else if (y == 237)                                    /* Score message. */
      {
!       SSCANF(str, "White: %1d, Black: %1d", &white, &black) ;
!       SPRINTF(str, "White (O): %1d, Black (X): %1d", white, black) ;
        draw_string(othervals[(int) SCORE_MES].column,
                    othervals[(int) SCORE_MES].row,  str, TRUE) ;
      }
--- 299,306 ----
                  othervals[(int) REMARK_MES].row, str, TRUE) ;
    else if (y == 237)                                    /* Score message. */
      {
!       if (sscanf(str, "White: %d, Black: %d", &white, &black) == 2)
!         SPRINTF(str, "White (O): %d, Black (X): %d", white, black) ;
        draw_string(othervals[(int) SCORE_MES].column,
                    othervals[(int) SCORE_MES].row,  str, TRUE) ;
      }
***************
*** 385,391 ****
  
  
  /*ARGSUSED*/
! lock(state)       /* Graphics locking - null routine. */
  enum bltype state ;
  {}
  
--- 385,391 ----
  
  
  /*ARGSUSED*/
! lock_screen(state)     /* Graphics locking - null routine. */
  enum bltype state ;
  {}