billr@saab.CNA.TEK.COM (Bill Randle) (12/22/90)
Submitted-by: Rich Burridge <rburridge@sun.COM>
Posting-number: Volume 12, Issue 9
Archive-name: reve/Patch3i
Patch-To: reve: Volume 11, Issue 52-58
Environment: SunView, XView, X11R4, termcap
#! /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 archive 9 (of 9)."
# Contents: patches03f
# Wrapped by billr@saab on Fri Dec 21 11:28:21 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'patches03f' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'patches03f'\"
else
echo shar: Extracting \"'patches03f'\" \(52444 characters\)
sed "s/^X//" >'patches03f' <<'END_OF_FILE'
X
X------- xview.c -------
X*** /tmp/da07695 Sun Dec 9 15:22:04 1990
X--- xview.c Fri Dec 7 16:49:50 1990
X***************
X*** 27,32 ****
X--- 27,37 ----
X #include "color.h"
X #include "extern.h"
X #include "images.h"
X+ #include <errno.h>
X+ #include <sys/ioctl.h>
X+ #include <sys/param.h>
X+ #include <sys/wait.h>
X+
X #include <xview/xview.h>
X #include <xview/canvas.h>
X #include <xview/panel.h>
X***************
X*** 35,47 ****
X #include <xview/svrimage.h>
X #include <xview/xv_xrect.h>
X #include <X11/Xlib.h>
X
X! enum gr_type gtype = GXVIEW ; /* Graphics type. */
X
X enum popup_pos {P_BELOW, P_RIGHT } ; /* Positions relative to main frame. */
X
X #define FRAME_BORDER_SIZE 7
X #define FRAME_LABEL_SIZE 30
X
X #define XV_CREATE (void) xv_create
X #define XV_SET (void) xv_set
X--- 40,58 ----
X #include <xview/svrimage.h>
X #include <xview/xv_xrect.h>
X #include <X11/Xlib.h>
X+ #include <X11/Xresource.h>
X
X! extern int errno ;
X
X+ enum gr_type gtype = GXVIEW ; /* Graphics type. */
X+
X enum popup_pos {P_BELOW, P_RIGHT } ; /* Positions relative to main frame. */
X
X+ #define CLIENT_NO 10
X+ #define DEPTH_MENU_ENTRY 9
X #define FRAME_BORDER_SIZE 7
X #define FRAME_LABEL_SIZE 30
X+ #define K_PROPS 3 /* Props key (L3). */
X
X #define XV_CREATE (void) xv_create
X #define XV_SET (void) xv_set
X***************
X*** 53,74 ****
X Canvas canvas ;
X Canvas_paint_window cpw ;
X Event *cur_event ;
X- Frame cframe ; /* Frame for Reve game board. */
X Frame frame ; /* Frame for control panel. */
X- Frame ls_frame ; /* Frame for load/save pop-up window. */
X Icon creve_icon ; /* Icon for game board. */
X Icon reve_icon ; /* Icon for control panel. */
X Panel panel ; /* Xview interface panel. */
X
X Frame ls_frame ; /* Frame for load/save pop-up window. */
X Panel ls_panel ; /* Panel for load/save operations. */
X Panel_item ls_button ; /* Button to start load/save operation. */
X Panel_item ls_text ; /* Load/Save text filename item. */
X! Panel_item mes_items[4] ; /* Four generic message items. */
X! Panel_setting start_load_save() ;
X! Menu game_menu ; /* Menu for 'New Game' button. */
X! Menu menus[MAXMENUS] ;
X! Notify_value quit_proc() ;
X Panel_item black_item ;
X Panel_item white_item ;
X Server_image hglass_pr, nocur_pr ;
X--- 64,95 ----
X Canvas canvas ;
X Canvas_paint_window cpw ;
X Event *cur_event ;
X Frame frame ; /* Frame for control panel. */
X Icon creve_icon ; /* Icon for game board. */
X Icon reve_icon ; /* Icon for control panel. */
X Panel panel ; /* Xview interface panel. */
X
X+ Notify_client client = (Notify_client) CLIENT_NO ;
X+
X Frame ls_frame ; /* Frame for load/save pop-up window. */
X Panel ls_panel ; /* Panel for load/save operations. */
X Panel_item ls_button ; /* Button to start load/save operation. */
X Panel_item ls_text ; /* Load/Save text filename item. */
X!
X! Frame d_frame ; /* Frame for depth pop-up window. */
X! Panel d_panel ; /* Panel for depth operations. */
X! Panel_item d_button ; /* Button to start depth operation. */
X! Panel_item d_text ; /* Depth numeric text item. */
X!
X! Frame props_frame ; /* Frame for property window */
X! Panel props_panel ; /* Panel for property operations. */
X! Panel_item props_computer ; /* Computer plays: choice. */
X! Panel_item props_button ; /* Button to start property operation */
X! Panel_item props_reset_button ; /* Button to reset properties */
X! Panel_item props_choices ; /* non-exclusive choices for properties */
X!
X! Panel_item mes_items[4] ; /* Four generic message items. */
X! Panel_setting start_load_save(), set_profmax(), set_props(), reset_props() ;
X Panel_item black_item ;
X Panel_item white_item ;
X Server_image hglass_pr, nocur_pr ;
X***************
X*** 84,89 ****
X--- 105,111 ----
X Window root ;
X XFontStruct *font[MAXFONTS] ; /* Xlib handles to the fonts. */
X XGCValues gc_val ; /* Used to setup graphics context values. */
X+ XrmDatabase reve_DB[MAXDPY] ; /* Combined resources database. */
X int gc_flags ; /* Used to set up graphics context flags. */
X int screen ; /* Default graphics display screen. */
X unsigned long backgnd ; /* Default background color. */
X***************
X*** 92,106 ****
X unsigned long palette[OTH_COLORSIZE] ; /* Xlib color palette. */
X
X int opvals[3] ; /* Pixrect rasterop values. */
X int started ; /* Set just before window is displayed. */
X
X void destroy_frame() ;
X! static void menu_proc(), new_game_proc(), pop_props(), set_depth() ;
X! static void set_player(), unimplemented(), xv_load_game(), xv_save_game() ;
X
X- extern int mnb ; /* Number of current move */
X
X-
X void
X batch(state) /* Turn graphics batching on or off. */
X enum bltype state ;
X--- 114,130 ----
X unsigned long palette[OTH_COLORSIZE] ; /* Xlib color palette. */
X
X int opvals[3] ; /* Pixrect rasterop values. */
X+ int pid ; /* Process id of the reve_proc process. */
X+ int pipe_io[2][2] ;
X+ int reve_player ; /* Player making the computer move (black/white). */
X int started ; /* Set just before window is displayed. */
X
X+ Notify_value read_from_reve(), sigchldcatcher() ;
X void destroy_frame() ;
X! static void menu_proc(), set_depth(), set_player() ;
X! static void xv_load_game(), xv_new_game(), xv_save_game(), xv_set_props() ;
X
X
X void
X batch(state) /* Turn graphics batching on or off. */
X enum bltype state ;
X***************
X*** 116,127 ****
X Event *event ;
X {
X if (!started) return ;
X! cur_event = event ;
X! process_event() ; /* Determine what kind of event it is. */
X handle_event() ; /* And do the appropriate action. */
X
X! if (nextc == LEFT_UP || nextc == MIDDLE_UP || nextc == RIGHT_UP)
X! XV_SET(frame, FRAME_BUSY, FALSE, 0) ;
X }
X
X
X--- 140,160 ----
X Event *event ;
X {
X if (!started) return ;
X! cur_event = event ; /* Determine what kind of event it is. */
X! XAllowEvents(dpy, AsyncBoth, CurrentTime) ;
X handle_event() ; /* And do the appropriate action. */
X+ }
X
X!
X! void
X! change_depth(depth)
X! int depth ;
X! {
X! struct reve_in in ;
X!
X! in.type = M_PROFMAX ;
X! in.level = depth ;
X! WRITE(pipe_io[0][1], (char *) &in, sizeof(struct reve_in)) ;
X }
X
X
X***************
X*** 132,139 ****
X }
X
X
X void
X! color_area(x, y, width, height, color)
X int x, y, width, height, color ;
X {
X int d ;
X--- 165,174 ----
X }
X
X
X+ /*ARGSUSED*/
X void
X! color_area(wtype, x, y, width, height, color)
X! enum win_type wtype ;
X int x, y, width, height, color ;
X {
X int d ;
X***************
X*** 154,179 ****
X
X
X void
X! create_menu(mtype, values) /* Create popup menus for cycle items. */
X! enum panel_type mtype ;
X! char *values[] ;
X {
X! int i = 0 ;
X! int menuno ; /* Current menu number. */
X! int more = 1 ; /* Cleared when current menu is complete.*/
X!
X! menuno = (int) mtype - (int) BLACK_PLAYS ;
X! menus[menuno] = xv_create(XV_NULL, MENU_COMMAND_MENU,
X! MENU_NOTIFY_PROC, menu_proc,
X! 0) ;
X! do
X! {
X! if (values[i] != NULL)
X! XV_SET(menus[menuno], MENU_STRING_ITEM, values[i], i+1, 0) ;
X! else more = 0 ;
X! i++ ;
X! }
X! while (more) ;
X }
X
X
X--- 189,199 ----
X
X
X void
X! connect_to_reve(pid)
X! int pid ;
X {
X! notify_set_input_func(client, read_from_reve, pipe_io[1][0]) ;
X! notify_set_wait3_func(client, sigchldcatcher, pid) ;
X }
X
X
X***************
X*** 181,208 ****
X destroy_frame() /* Destroy reve window. */
X {
X xv_destroy_safe(frame) ;
X! xv_destroy_safe(cframe) ;
X exit(0) ;
X }
X
X
X! do_menu(mtype) /* Popup appropriate cycle menu and get value. */
X! enum item_type mtype ;
X {
X- int menuno ;
X-
X- menuno = (int) mtype - (int) BLACK_PLAYS ;
X- menu_show(menus[menuno], canvas, cur_event, 0) ;
X- return(0) ;
X }
X
X
X /*ARGSUSED*/
X void
X! draw_button(item, color, image) /* **DUMMY ROUTINE** */
X enum panel_type item ;
X int color ;
X- enum image_type image ;
X {
X }
X
X--- 201,228 ----
X destroy_frame() /* Destroy reve window. */
X {
X xv_destroy_safe(frame) ;
X! KILL(pid, SIGKILL) ;
X exit(0) ;
X }
X
X
X! /*ARGSUSED*/
X! void
X! draw_button(wtype, item, color, image) /* **DUMMY ROUTINE** */
X! enum win_type wtype ;
X! enum panel_type item ;
X! int color ;
X! enum image_type image ;
X {
X }
X
X
X /*ARGSUSED*/
X void
X! draw_choice(wtype, item, color) /* **DUMMY ROUTINE** */
X! enum win_type wtype ;
X enum panel_type item ;
X int color ;
X {
X }
X
X***************
X*** 209,215 ****
X
X /*ARGSUSED*/
X void
X! draw_cycle(item, color, image) /* **DUMMY ROUTINE** */
X enum panel_type item ;
X int color ;
X enum image_type image ;
X--- 229,236 ----
X
X /*ARGSUSED*/
X void
X! draw_cycle(wtype, item, color, image) /* **DUMMY ROUTINE** */
X! enum win_type wtype ;
X enum panel_type item ;
X int color ;
X enum image_type image ;
X***************
X*** 217,224 ****
X }
X
X
X void
X! draw_image(x, y, width, height, image)
X int x, y, width, height ;
X enum image_type image ;
X {
X--- 238,247 ----
X }
X
X
X+ /*ARGSUSED*/
X void
X! draw_image(wtype, x, y, width, height, image)
X! enum win_type wtype ;
X int x, y, width, height ;
X enum image_type image ;
X {
X***************
X*** 231,238 ****
X }
X
X
X void
X! draw_line(x1, y1, x2, y2, op, color)
X int x1, y1, x2, y2, color ;
X enum optype op ;
X {
X--- 254,263 ----
X }
X
X
X+ /*ARGSUSED*/
X void
X! draw_line(wtype, x1, y1, x2, y2, op, color)
X! enum win_type wtype ;
X int x1, y1, x2, y2, color ;
X enum optype op ;
X {
X***************
X*** 251,258 ****
X }
X
X
X void
X! draw_stencil(x, y, width, height, op, color, stencil, image)
X int x, y, width, height, color ;
X enum optype op ;
X enum image_type stencil, image ;
X--- 276,285 ----
X }
X
X
X+ /*ARGSUSED*/
X void
X! draw_stencil(wtype, x, y, width, height, op, color, stencil, image)
X! enum win_type wtype ;
X int x, y, width, height, color ;
X enum optype op ;
X enum image_type stencil, image ;
X***************
X*** 277,284 ****
X }
X
X
X void
X! draw_text(x, y, ftype, color, str)
X enum font_type ftype ;
X int x, y, color ;
X char *str ;
X--- 304,313 ----
X }
X
X
X+ /*ARGSUSED*/
X void
X! draw_text(wtype, x, y, ftype, color, str)
X! enum win_type wtype ;
X enum font_type ftype ;
X int x, y, color ;
X char *str ;
X***************
X*** 305,327 ****
X }
X
X
X! static Notify_value
X! frame_event(frame, event, arg, type)
X! Frame frame ;
X! Event *event ;
X! Notify_arg arg ;
X! Notify_event_type type ;
X {
X! int action ;
X
X! action = event_action(event) ;
X! if (action == ACTION_CLOSE) XV_SET(cframe, XV_SHOW, FALSE, 0) ;
X! if (action == WIN_RESIZE)
X {
X! position_popup(frame, cframe, P_BELOW) ;
X! XV_SET(cframe, XV_SHOW, TRUE, 0) ;
X }
X! return(notify_next_event_func(frame, event, arg, type)) ;
X }
X
X
X--- 334,375 ----
X }
X
X
X! /*ARGSUSED*/
X! void
X! draw_toggle(wtype, item, color)
X! enum win_type wtype ;
X! enum panel_type item ;
X! int color ;
X {
X! }
X
X!
X! fork_child()
X! {
X! int i ;
X!
X! PIPE(pipe_io[0]) ; /* Setup input pipe. */
X! PIPE(pipe_io[1]) ; /* Setup output pipe. */
X! switch (pid = fork())
X {
X! case -1 : CLOSE(pipe_io[0][0]) ;
X! CLOSE(pipe_io[0][1]) ;
X! CLOSE(pipe_io[1][0]) ;
X! CLOSE(pipe_io[1][1]) ;
X! perror("reve fork failed") ;
X! exit(1) ;
X! case 0 : DUP2(pipe_io[0][0], 0) ; /* Child. */
X! DUP2(pipe_io[1][1], 1) ;
X! DUP2(pipe_io[1][1], 2) ;
X! for (i = getdtablesize(); i > 2; i--) CLOSE(i) ;
X! for (i = 0; i < NSIG; i++) SIGNAL(i, SIG_DFL) ;
X! execlp("reve_proc", "reve_proc", edgefile, (char *) NULL) ;
X! perror("reve child exec") ;
X! _exit(-1) ;
X! default : CLOSE(pipe_io[0][0]) ; /* Parent. */
X! CLOSE(pipe_io[1][1]) ;
X }
X! return(pid) ;
X }
X
X
X***************
X*** 347,352 ****
X--- 395,420 ----
X }
X
X
X+ char *
X+ get_resource(rtype) /* Get Reve resource from merged databases. */
X+ enum res_type rtype ;
X+ {
X+ char cstr[MAXLINE], nstr[MAXLINE], str[MAXLINE] ;
X+ char *str_type[20] ;
X+ int d ;
X+ XrmValue value ;
X+
X+ d = (int) cur_dpyno ;
X+ STRCPY(str, resources[(int) rtype]) ;
X+ SPRINTF(nstr, "reve.%s", str) ;
X+ if (islower(str[0])) str[0] = toupper(str[0]) ;
X+ SPRINTF(cstr, "Reve.%s", str) ;
X+ if (XrmGetResource(reve_DB[d], nstr, cstr, str_type, &value) == NULL)
X+ return((char *) NULL) ;
X+ else return(value.addr) ;
X+ }
X+
X+
X get_strwidth(ftype, str) /* Get width in pixels of string value. */
X enum font_type ftype ;
X char *str ;
X***************
X*** 367,378 ****
X }
X
X
X init_ws_type()
X {
X! show_notes = TRUE ; /* Override generic value for XView version. */
X move_delta = 10 ;
X cur_dpyno = DPY1 ;
X! started = 0 ; /* Kludge to correctly handle repaints. */
X return 0 ;
X }
X
X--- 435,457 ----
X }
X
X
X+ init_graphics(argc, argv)
X+ int *argc ;
X+ char *argv[] ;
X+ {
X+ xv_init(XV_INIT_ARGC_PTR_ARGV, argc, argv, 0) ;
X+ frame = (Frame) xv_create(XV_NULL, FRAME, 0) ;
X+ dpy = (Display *) xv_get(frame, XV_DISPLAY) ;
X+ reve_DB[(int) DPY1] = NULL ;
X+ }
X+
X+
X init_ws_type()
X {
X! SHOW_NOTES = TRUE ; /* Override generic value for XView version. */
X move_delta = 10 ;
X cur_dpyno = DPY1 ;
X! started = 0 ; /* Kludge to correctly handle repaints. */
X return 0 ;
X }
X
X***************
X*** 406,412 ****
X--- 485,550 ----
X }
X
X
X+ /* Get the resource databases. These are looked for in the following ways:
X+ *
X+ * Classname file in the app-defaults directory. In this case, Classname
X+ * is Reve.
X+ *
X+ * Classname file in the directory specified by the XUSERFILESEARCHPATH
X+ * or XAPPLRESDIR environment variable.
X+ *
X+ * Property set using xrdb, accessible through the XResourceManagerString
X+ * macro or, if that is empty, the ~/.Xdefaults file.
X+ *
X+ * XENVIRONMENT environment variable or, if not set, .Xdefaults-hostname
X+ * file.
X+ */
X+
X void
X+ load_resources()
X+ {
X+ XrmDatabase db ;
X+ char *home, name[MAXPATHLEN], *ptr ;
X+ int d, len ;
X+
X+ d = (int) cur_dpyno ;
X+ home = getenv("HOME") ;
X+ XrmInitialize() ;
X+ STRCPY(name, "/usr/lib/X11/app-defaults/Reve") ;
X+
X+ /* Get applications defaults file, if any. */
X+
X+ db = XrmGetFileDatabase(name) ;
X+ XrmMergeDatabases(db, &reve_DB[d]) ;
X+
X+ /* Merge server defaults, created by xrdb. If nor defined, use ~/.Xdefaults. */
X+
X+ if (XResourceManagerString(dpy) != NULL)
X+ db = XrmGetStringDatabase(XResourceManagerString(dpy)) ;
X+ else
X+ {
X+ SPRINTF(name, "%s/.Xdefaults", home) ;
X+ db = XrmGetFileDatabase(name) ;
X+ }
X+ XrmMergeDatabases(db, &reve_DB[d]) ;
X+
X+ /* Open XENVIRONMENT file or, if not defined, the .Xdefaults, and merge
X+ * into existing database.
X+ */
X+
X+ if ((ptr = getenv("XENVIRONMENT")) == NULL)
X+ {
X+ SPRINTF(name, "%s/.Xdefaults-", home) ;
X+ len = strlen(name) ;
X+ GETHOSTNAME(name+len, 1024-len) ;
X+ db = XrmGetFileDatabase(name) ;
X+ }
X+ else db = XrmGetFileDatabase(ptr) ;
X+ XrmMergeDatabases(db, &reve_DB[d]) ;
X+ }
X+
X+
X+ void
X lock_screen(state) /* Turn graphics locking on or off - null routine. */
X enum bltype state ;
X {}
X***************
X*** 415,429 ****
X void
X make_canvas() /* Create canvas for game board. */
X {
X! cframe = xv_create(XV_NULL, FRAME,
X! XV_SHOW, FALSE,
X! FRAME_ICON, creve_icon,
X! FRAME_NO_CONFIRM, TRUE,
X! WIN_ERROR_MSG, "Reve: Can't create window.",
X! FRAME_SHOW_RESIZE_CORNER, FALSE,
X! FRAME_SHOW_HEADER, FALSE,
X! 0) ;
X! canvas = xv_create(cframe, CANVAS,
X CANVAS_RETAINED, FALSE,
X OPENWIN_AUTO_CLEAR, FALSE,
X XV_HEIGHT, TOTAL_HEIGHT,
X--- 553,563 ----
X void
X make_canvas() /* Create canvas for game board. */
X {
X! int pid ;
X!
X! canvas = xv_create(frame, CANVAS,
X! WIN_BELOW, panel,
X! XV_X, 0,
X CANVAS_RETAINED, FALSE,
X OPENWIN_AUTO_CLEAR, FALSE,
X XV_HEIGHT, TOTAL_HEIGHT,
X***************
X*** 432,439 ****
X WIN_CONSUME_EVENTS,
X MS_LEFT, MS_MIDDLE, MS_RIGHT,
X WIN_ASCII_EVENTS, KBD_USE, KBD_DONE,
X! LOC_MOVE, LOC_DRAG,
X! LOC_WINENTER, LOC_WINEXIT,
X WIN_LEFT_KEYS, WIN_TOP_KEYS,
X WIN_RIGHT_KEYS, WIN_REPAINT,
X 0,
X--- 566,572 ----
X WIN_CONSUME_EVENTS,
X MS_LEFT, MS_MIDDLE, MS_RIGHT,
X WIN_ASCII_EVENTS, KBD_USE, KBD_DONE,
X! LOC_DRAG, LOC_WINENTER, LOC_WINEXIT,
X WIN_LEFT_KEYS, WIN_TOP_KEYS,
X WIN_RIGHT_KEYS, WIN_REPAINT,
X 0,
X***************
X*** 440,447 ****
X WIN_EVENT_PROC, canvas_proc,
X 0,
X 0) ;
X! window_fit(cframe) ;
X! notify_interpose_destroy_func(cframe, quit_proc) ;
X
X cpw = canvas_paint_window(canvas) ;
X cursor[(int) CANVASCUR] = xv_get(cpw, WIN_CURSOR, NULL) ;
X--- 573,579 ----
X WIN_EVENT_PROC, canvas_proc,
X 0,
X 0) ;
X! window_fit(frame) ;
X
X cpw = canvas_paint_window(canvas) ;
X cursor[(int) CANVASCUR] = xv_get(cpw, WIN_CURSOR, NULL) ;
X***************
X*** 486,499 ****
X--- 618,635 ----
X
X images[(int) P_WHITE] = make_server_image(white_image) ;
X images[(int) P_BLACK] = make_server_image(black_image) ;
X+ pid = fork_child() ;
X+ connect_to_reve(pid) ;
X }
X
X
X+ /*ARGSUSED*/
X void
X make_frame(argc, argv) /* Create frame and the panel, buttons, menus. */
X int argc ;
X char *argv[] ;
X {
X+ int val ;
X Menu_item item ;
X
X opvals[(int) RCLR] = GXclear ;
X***************
X*** 502,570 ****
X
X /* Create the frame and the control panel */
X
X! xv_init(XV_INIT_ARGS, argc, argv, 0) ;
X! frame = xv_create(XV_NULL, FRAME,
X! FRAME_ICON, reve_icon,
X! FRAME_LABEL, line,
X! FRAME_NO_CONFIRM, TRUE,
X! FRAME_SHOW_RESIZE_CORNER, FALSE,
X! WIN_ERROR_MSG, "Reve: Can't create window.",
X! NULL) ;
X
X panel = (Panel) xv_create(frame, PANEL, 0) ;
X
X- /* Menu for the 'new game' button */
X-
X- game_menu = (Menu) xv_create(XV_NULL, MENU,
X- MENU_NOTIFY_PROC, new_game_proc,
X- MENU_STRINGS,
X- "Human (black) vs. Computer (white)",
X- "Computer (black) vs. Human (white)",
X- "Human (black) vs. Human (white)",
X- 0,
X- 0) ;
X-
X /* Create the buttons and other controls. */
X
X XV_CREATE(panel, PANEL_BUTTON,
X PANEL_ITEM_X, xv_col(panel, 0),
X PANEL_ITEM_Y, xv_row(panel, 0),
X! PANEL_LABEL_STRING, "New Game",
X! PANEL_ITEM_MENU, game_menu,
X 0) ;
X
X XV_CREATE(panel, PANEL_BUTTON,
X PANEL_ITEM_X, xv_col(panel, 15),
X PANEL_ITEM_Y, xv_row(panel, 0),
X! PANEL_LABEL_STRING, "Load Game...",
X! PANEL_NOTIFY_PROC, xv_load_game,
X 0) ;
X
X XV_CREATE(panel, PANEL_BUTTON,
X PANEL_ITEM_X, xv_col(panel, 30),
X PANEL_ITEM_Y, xv_row(panel, 0),
X! PANEL_LABEL_STRING, "Save Game...",
X! PANEL_NOTIFY_PROC, xv_save_game,
X 0) ;
X
X XV_CREATE(panel, PANEL_BUTTON,
X PANEL_ITEM_X, xv_col(panel, 45),
X PANEL_ITEM_Y, xv_row(panel, 0),
X! PANEL_LABEL_STRING, " Help ",
X! PANEL_NOTIFY_PROC, unimplemented,
X 0) ;
X!
X XV_CREATE(panel, PANEL_BUTTON,
X PANEL_ITEM_X, xv_col(panel, 0),
X PANEL_ITEM_Y, xv_row(panel, 1),
X! PANEL_LABEL_STRING, " Moves? ",
X! PANEL_NOTIFY_PROC, show_all_moves,
X 0) ;
X
X XV_CREATE(panel, PANEL_BUTTON,
X PANEL_ITEM_X, xv_col(panel, 15),
X PANEL_ITEM_Y, xv_row(panel, 1),
X! PANEL_LABEL_STRING, " Suggest ",
X PANEL_NOTIFY_PROC, suggest,
X 0) ;
X
X--- 638,693 ----
X
X /* Create the frame and the control panel */
X
X! XV_SET(frame,
X! FRAME_ICON, reve_icon,
X! FRAME_LABEL, line,
X! FRAME_NO_CONFIRM, TRUE,
X! FRAME_SHOW_RESIZE_CORNER, FALSE,
X! 0) ;
X
X panel = (Panel) xv_create(frame, PANEL, 0) ;
X
X /* Create the buttons and other controls. */
X
X XV_CREATE(panel, PANEL_BUTTON,
X PANEL_ITEM_X, xv_col(panel, 0),
X PANEL_ITEM_Y, xv_row(panel, 0),
X! PANEL_LABEL_STRING, "Load Game...",
X! PANEL_NOTIFY_PROC, xv_load_game,
X 0) ;
X
X XV_CREATE(panel, PANEL_BUTTON,
X PANEL_ITEM_X, xv_col(panel, 15),
X PANEL_ITEM_Y, xv_row(panel, 0),
X! PANEL_LABEL_STRING, " Moves? ",
X! PANEL_NOTIFY_PROC, show_all_moves,
X 0) ;
X
X XV_CREATE(panel, PANEL_BUTTON,
X PANEL_ITEM_X, xv_col(panel, 30),
X PANEL_ITEM_Y, xv_row(panel, 0),
X! PANEL_NOTIFY_PROC, xv_new_game,
X! PANEL_LABEL_STRING, " New Game ",
X 0) ;
X
X XV_CREATE(panel, PANEL_BUTTON,
X PANEL_ITEM_X, xv_col(panel, 45),
X PANEL_ITEM_Y, xv_row(panel, 0),
X! PANEL_LABEL_STRING, " Props... ",
X! PANEL_NOTIFY_PROC, xv_set_props,
X 0) ;
X!
X XV_CREATE(panel, PANEL_BUTTON,
X PANEL_ITEM_X, xv_col(panel, 0),
X PANEL_ITEM_Y, xv_row(panel, 1),
X! PANEL_LABEL_STRING, "Save Game...",
X! PANEL_NOTIFY_PROC, xv_save_game,
X 0) ;
X
X XV_CREATE(panel, PANEL_BUTTON,
X PANEL_ITEM_X, xv_col(panel, 15),
X PANEL_ITEM_Y, xv_row(panel, 1),
X! PANEL_LABEL_STRING, " Suggest ",
X PANEL_NOTIFY_PROC, suggest,
X 0) ;
X
X***************
X*** 582,670 ****
X PANEL_NOTIFY_PROC, destroy_frame,
X 0) ;
X
X! XV_CREATE(panel, PANEL_CHECK_BOX,
X PANEL_ITEM_X, xv_col(panel, 0),
X! PANEL_ITEM_Y, xv_row(panel, 4),
X! PANEL_LABEL_STRING, "Show Info ",
X! PANEL_NOTIFY_PROC, pop_props,
X! PANEL_VALUE, 1,
X 0) ;
X!
X! black_item = xv_create(panel, PANEL_CHOICE_STACK,
X! PANEL_ITEM_X, xv_col(panel, 0),
X! PANEL_ITEM_Y, xv_row(panel, 2),
X! PANEL_LABEL_STRING, "Black:",
X! PANEL_CHOICE_STRINGS,
X! "human",
X! "computer",
X! 0,
X! PANEL_NOTIFY_PROC, set_player,
X! PANEL_VALUE, items[(int) BLACK_PLAYS].value,
X 0) ;
X
X! white_item = xv_create(panel, PANEL_CHOICE_STACK,
X! PANEL_ITEM_X, xv_col(panel, 0),
X! PANEL_ITEM_Y, xv_row(panel, 3),
X! PANEL_LABEL_STRING, "White:",
X! PANEL_CHOICE_STRINGS,
X! "human",
X! "computer",
X! 0,
X! PANEL_NOTIFY_PROC, set_player,
X! PANEL_VALUE, items[(int) WHITE_PLAYS].value,
X 0) ;
X
X! mes_items[(int) (TURN_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE,
X! PANEL_ITEM_X, xv_col(panel, 30),
X! PANEL_ITEM_Y, xv_row(panel, 2),
X! PANEL_LABEL_STRING, "Black to move",
X! 0) ;
X!
X! mes_items[(int) (SCORE_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE,
X! PANEL_ITEM_X, xv_col(panel, 30),
X PANEL_ITEM_Y, xv_row(panel, 3),
X PANEL_LABEL_STRING, "",
X 0) ;
X!
X mes_items[(int) (EVAL_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE,
X! PANEL_ITEM_X, xv_col(panel, 30),
X PANEL_ITEM_Y, xv_row(panel, 4),
X PANEL_LABEL_STRING, "",
X 0) ;
X!
X!
X! mes_items[(int) (PANEL_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE,
X! PANEL_ITEM_X, xv_col(panel, 30),
X PANEL_ITEM_Y, xv_row(panel, 5),
X PANEL_LABEL_STRING, "",
X 0) ;
X-
X- XV_CREATE(panel, PANEL_CHOICE_STACK,
X- PANEL_ITEM_X, xv_col(panel, 0),
X- PANEL_ITEM_Y, xv_row(panel, 5),
X- PANEL_LABEL_STRING, "Difficulty: ",
X- PANEL_CHOICE_STRINGS,
X- " Instant",
X- " 1 Minute",
X- " 3 Minutes",
X- " 5 Minutes",
X- "10 Minutes",
X- "15 Minutes",
X- "20 Minutes",
X- "Tournament (30)",
X- "60 MInutes",
X- 0,
X- PANEL_NOTIFY_PROC, set_depth,
X- PANEL_VALUE, 0,
X- 0) ;
X
X window_fit(panel) ;
X- window_fit(frame) ;
X- notify_interpose_event_func(frame, frame_event, NOTIFY_SAFE) ;
X- notify_interpose_destroy_func(frame, quit_proc) ;
X
X ls_frame = xv_create(frame, FRAME_CMD,
X- FRAME_LABEL, "Name your Game ...",
X FRAME_CMD_PUSHPIN_IN, TRUE,
X 0) ;
X
X--- 705,764 ----
X PANEL_NOTIFY_PROC, destroy_frame,
X 0) ;
X
X! XV_CREATE(panel, PANEL_MESSAGE,
X PANEL_ITEM_X, xv_col(panel, 0),
X! PANEL_ITEM_Y, xv_row(panel, 2),
X! PANEL_LABEL_BOLD, TRUE,
X! PANEL_LABEL_STRING, "Black:",
X 0) ;
X! val = items[(int) BLACK_PLAYS].value ;
X! black_item = xv_create(panel, PANEL_MESSAGE,
X! PANEL_ITEM_X, xv_col(panel, 7),
X! PANEL_ITEM_Y, xv_row(panel, 2),
X! PANEL_LABEL_BOLD, FALSE,
X! PANEL_LABEL_STRING, player_values[val],
X 0) ;
X
X! XV_CREATE(panel, PANEL_MESSAGE,
X! PANEL_ITEM_X, xv_col(panel, 30),
X! PANEL_ITEM_Y, xv_row(panel, 2),
X! PANEL_LABEL_BOLD, TRUE,
X! PANEL_LABEL_STRING, "White:",
X! 0) ;
X! val = items[(int) WHITE_PLAYS].value ;
X! white_item = xv_create(panel, PANEL_MESSAGE,
X! PANEL_ITEM_X, xv_col(panel, 37),
X! PANEL_ITEM_Y, xv_row(panel, 2),
X! PANEL_LABEL_BOLD, FALSE,
X! PANEL_LABEL_STRING, player_values[val],
X 0) ;
X
X! mes_items[(int) (PANEL_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE,
X! PANEL_ITEM_X, xv_col(panel, 0),
X PANEL_ITEM_Y, xv_row(panel, 3),
X PANEL_LABEL_STRING, "",
X 0) ;
X!
X mes_items[(int) (EVAL_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE,
X! PANEL_ITEM_X, xv_col(panel, 0),
X PANEL_ITEM_Y, xv_row(panel, 4),
X PANEL_LABEL_STRING, "",
X 0) ;
X!
X! mes_items[(int) (SCORE_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE,
X! PANEL_ITEM_X, xv_col(panel, 0),
X PANEL_ITEM_Y, xv_row(panel, 5),
X PANEL_LABEL_STRING, "",
X 0) ;
X
X+ mes_items[(int) (TURN_MES - PANEL_MES)] = xv_create(panel, PANEL_MESSAGE,
X+ PANEL_ITEM_X, xv_col(panel, 30),
X+ PANEL_ITEM_Y, xv_row(panel, 5),
X+ PANEL_LABEL_STRING, "Black to move",
X+ 0) ;
X window_fit(panel) ;
X
X ls_frame = xv_create(frame, FRAME_CMD,
X FRAME_CMD_PUSHPIN_IN, TRUE,
X 0) ;
X
X***************
X*** 673,679 ****
X ls_text = XV_CREATE(ls_panel, PANEL_TEXT,
X PANEL_ITEM_X, xv_col(ls_panel, 0),
X PANEL_ITEM_Y, xv_row(ls_panel, 0),
X! PANEL_LABEL_STRING, "Load File: ",
X PANEL_VALUE, gamefile,
X PANEL_VALUE_DISPLAY_LENGTH, 30,
X PANEL_VALUE_STORED_LENGTH, 255,
X--- 767,773 ----
X ls_text = XV_CREATE(ls_panel, PANEL_TEXT,
X PANEL_ITEM_X, xv_col(ls_panel, 0),
X PANEL_ITEM_Y, xv_row(ls_panel, 0),
X! PANEL_LABEL_STRING, "Load File:",
X PANEL_VALUE, gamefile,
X PANEL_VALUE_DISPLAY_LENGTH, 30,
X PANEL_VALUE_STORED_LENGTH, 255,
X***************
X*** 680,686 ****
X 0) ;
X
X ls_button = xv_create(ls_panel, PANEL_BUTTON,
X! PANEL_LABEL_STRING, "Load",
X PANEL_NOTIFY_PROC, start_load_save,
X XV_X, xv_col(ls_panel, 18),
X XV_Y, xv_row(ls_panel, 1),
X--- 774,780 ----
X 0) ;
X
X ls_button = xv_create(ls_panel, PANEL_BUTTON,
X! PANEL_LABEL_STRING, "Apply",
X PANEL_NOTIFY_PROC, start_load_save,
X XV_X, xv_col(ls_panel, 18),
X XV_Y, xv_row(ls_panel, 1),
X***************
X*** 688,693 ****
X--- 782,906 ----
X window_fit(ls_panel) ;
X window_fit(ls_frame) ;
X
X+ d_frame = xv_create(frame, FRAME_CMD,
X+ FRAME_LABEL, "Set Search Depth",
X+ FRAME_CMD_PUSHPIN_IN, TRUE,
X+ 0) ;
X+
X+ d_panel = (Panel) xv_get(d_frame, FRAME_CMD_PANEL) ;
X+
X+ d_text = XV_CREATE(d_panel, PANEL_NUMERIC_TEXT,
X+ PANEL_VALUE_X, xv_col(d_panel, 10),
X+ XV_Y, xv_row(d_panel, 0),
X+ PANEL_LABEL_STRING, "Depth: ",
X+ PANEL_VALUE, INIT_DEPTH,
X+ PANEL_VALUE_DISPLAY_LENGTH, 2,
X+ PANEL_VALUE_STORED_LENGTH, 2,
X+ PANEL_MIN_VALUE, 1,
X+ PANEL_MAX_VALUE, MAX_PROFMAX,
X+ 0) ;
X+
X+ d_button = xv_create(d_panel, PANEL_BUTTON,
X+ PANEL_LABEL_STRING, "Apply",
X+ PANEL_NOTIFY_PROC, set_profmax,
X+ XV_X, xv_col(d_panel, 7),
X+ XV_Y, xv_row(d_panel, 1),
X+ 0) ;
X+ window_fit(d_panel) ;
X+ window_fit(d_frame) ;
X+
X+
X+ props_frame = xv_create(frame, FRAME_CMD,
X+ FRAME_LABEL, "Reve Properties",
X+ FRAME_CMD_PUSHPIN_IN, TRUE,
X+ 0) ;
X+
X+ props_panel = (Panel) xv_get(props_frame, FRAME_CMD_PANEL) ;
X+
X+ if (dtype == XBLACK) val = CP_WHITE ;
X+ else if (dtype == XWHITE) val = CP_BLACK ;
X+ else if (dtype == XBOTH || dtype == XTWO) val = CP_NEITHER ;
X+
X+ props_computer = xv_create(props_panel, PANEL_CHOICE,
X+ PANEL_LABEL_STRING, "Computer plays:",
X+ PANEL_LABEL_BOLD, TRUE,
X+ PANEL_VALUE_X, xv_col(props_panel, 15),
X+ XV_Y, xv_row(props_panel, 0),
X+ PANEL_CHOICE_STRINGS,
X+ "White",
X+ "Black",
X+ "Neither",
X+ "Both",
X+ 0,
X+ PANEL_VALUE, val,
X+ 0) ;
X+
X+ XV_CREATE(props_panel, PANEL_CHOICE_STACK,
X+ PANEL_VALUE_X, xv_col(props_panel, 15),
X+ XV_Y, xv_row(props_panel, 1),
X+ PANEL_LABEL_STRING, "Difficulty: ",
X+ PANEL_CHOICE_STRINGS,
X+ " Instant",
X+ " 1 Minute",
X+ " 3 Minutes",
X+ " 5 Minutes",
X+ "10 Minutes",
X+ "15 Minutes",
X+ "20 Minutes",
X+ "Tournament (30)",
X+ "60 MInutes",
X+ "Depth...",
X+ 0,
X+ PANEL_NOTIFY_PROC, set_depth,
X+ PANEL_VALUE, items[(int) DIFF_CHOICE].value,
X+ 0) ;
X+
X+ XV_CREATE(props_panel, PANEL_MESSAGE,
X+ XV_X, xv_col(props_panel, 7),
X+ XV_Y, xv_row(props_panel, 2),
X+ PANEL_LABEL_BOLD, TRUE,
X+ PANEL_LABEL_STRING, "Options:",
X+ 0) ;
X+
X+ val = ((ANIMATION & 0x1) << 0) +
X+ ((DO_BESTMOVE & 0x1) << 1) +
X+ ((DO_LAST & 0x1) << 2) +
X+ ((SHOW_NOTES & 0x1) << 3) +
X+ ((DO_NUMBER & 0x1) << 4) +
X+ ((QUICKGAME & 0x1) << 5) ;
X+
X+ props_choices = xv_create(props_panel, PANEL_CHECK_BOX,
X+ PANEL_LAYOUT, PANEL_VERTICAL,
X+ PANEL_CHOOSE_ONE, FALSE,
X+ PANEL_CHOICE_STRINGS,
X+ "Animate Move",
X+ "Show Current Best Move",
X+ "Show Last Move",
X+ "Show Evaluation Info.",
X+ "Number Last Move",
X+ "Don't Show Flip",
X+ 0,
X+ PANEL_VALUE_X, xv_col(props_panel, 15),
X+ PANEL_VALUE_Y, xv_row(props_panel, 2),
X+ PANEL_VALUE, val,
X+ 0) ;
X+
X+ props_button = xv_create(props_panel, PANEL_BUTTON,
X+ PANEL_LABEL_STRING, "Apply",
X+ PANEL_NOTIFY_PROC, set_props,
X+ XV_X, xv_col(props_panel, 13),
X+ XV_Y, xv_row(props_panel, 8),
X+ 0) ;
X+
X+ props_reset_button = xv_create(props_panel, PANEL_BUTTON,
X+ PANEL_LABEL_STRING, "Reset",
X+ PANEL_NOTIFY_PROC, reset_props,
X+ XV_X, xv_col(props_panel, 23),
X+ XV_Y, xv_row(props_panel, 8),
X+ 0) ;
X+ window_fit(props_panel) ;
X+ window_fit(props_frame) ;
X+
X iscolor[(int) cur_dpyno] = ((int) xv_get(frame, WIN_DEPTH) > 1) ? 1 : 0 ;
X }
X
X***************
X*** 717,724 ****
X
X
X void
X! make_panel() /* **DUMMY ROUTINE** */
X {
X }
X
X
X--- 930,938 ----
X
X
X void
X! make_panel()
X {
X+ panel_paint(panel, PANEL_CLEAR) ;
X }
X
X
X***************
X*** 758,808 ****
X }
X
X
X! static void
X! new_game_proc(menu, menu_item)
X! Menu menu ;
X! Menu_item menu_item ;
X {
X- switch((int) xv_get(menu_item, MENU_VALUE))
X- {
X- case 1 : items[(int) BLACK_PLAYS].value = HUMAN ;
X- items[(int) WHITE_PLAYS].value = COMPUTER ;
X- cmode = WHITE_START ;
X- dtype = XBLACK ;
X- break ;
X-
X- case 2 : items[(int) BLACK_PLAYS].value = COMPUTER ;
X- items[(int) WHITE_PLAYS].value = HUMAN ;
X- cmode = BLACK_START ;
X- dtype = XWHITE ;
X- break ;
X-
X- case 3 : items[(int) BLACK_PLAYS].value = HUMAN ;
X- items[(int) WHITE_PLAYS].value = HUMAN ;
X- cmode = BLACK_START ;
X- dtype = XBOTH ;
X- }
X- XV_SET(black_item, PANEL_VALUE, items[(int) BLACK_PLAYS].value) ;
X- XV_SET(white_item, PANEL_VALUE, items[(int) WHITE_PLAYS].value) ;
X- new_game() ;
X }
X
X
X! /* Callback for the check box to show/hide evaluation and score. */
X!
X! static void
X! pop_props(item, value, event)
X {
X- show_notes = !show_notes ;
X- if (!show_notes)
X- {
X- XV_SET(mes_items[(int) (EVAL_MES - PANEL_MES)],
X- PANEL_LABEL_STRING, "",
X- 0) ;
X- XV_SET(mes_items[(int) (SCORE_MES - PANEL_MES)],
X- PANEL_LABEL_STRING, "",
X- 0) ;
X- }
X }
X
X
X--- 972,987 ----
X }
X
X
X! void
X! open_frame(wtype) /* **DUMMY ROUTINE** */
X! enum win_type wtype ;
X {
X }
X
X
X! void
X! paint_prop_sheet() /* **DUMMY ROUTINE** */
X {
X }
X
X
X***************
X*** 839,844 ****
X--- 1018,1024 ----
X {
X int id ;
X
X+ nextc = IGNORE_EVENT ;
X id = (event_id(cur_event)) ;
X curx = event_x(cur_event) ;
X cury = event_y(cur_event) ;
X***************
X*** 845,851 ****
X
X if (id == KBD_DONE || id == LOC_WINEXIT) nextc = EXIT_WINDOW ;
X else if (id == LOC_WINENTER) nextc = ENTER_WINDOW ;
X! else if (id == LOC_MOVE || id == LOC_DRAG) nextc = MOUSE_MOVING ;
X else if (id == WIN_REPAINT || id == WIN_RESIZE) nextc = FRAME_REPAINT ;
X else if (id == WIN_REPAINT || id == WIN_RESIZE) nextc = FRAME_REPAINT ;
X else if (event_is_button(cur_event) && event_is_down(cur_event))
X--- 1025,1031 ----
X
X if (id == KBD_DONE || id == LOC_WINEXIT) nextc = EXIT_WINDOW ;
X else if (id == LOC_WINENTER) nextc = ENTER_WINDOW ;
X! else if (id == LOC_DRAG) nextc = MOUSE_MOVING ;
X else if (id == WIN_REPAINT || id == WIN_RESIZE) nextc = FRAME_REPAINT ;
X else if (id == WIN_REPAINT || id == WIN_RESIZE) nextc = FRAME_REPAINT ;
X else if (event_is_button(cur_event) && event_is_down(cur_event))
X***************
X*** 859,865 ****
X if (id == MS_LEFT) nextc = LEFT_UP ;
X else if (id == MS_MIDDLE) nextc = MIDDLE_UP ;
X else if (id == MS_RIGHT) nextc = RIGHT_UP ;
X- XV_SET(frame, FRAME_BUSY, TRUE, 0) ;
X }
X else if (event_is_ascii(cur_event))
X {
X--- 1039,1044 ----
X***************
X*** 866,886 ****
X cur_ch = id ;
X nextc = KEYBOARD ;
X }
X }
X
X
X! static Notify_value
X! quit_proc(frame, status)
X! Frame frame ;
X Destroy_status status ;
X {
X! if (status == DESTROY_PROCESS_DEATH || status == DESTROY_CLEANUP)
X {
X! xv_destroy_safe(frame) ;
X! xv_destroy_safe(cframe) ;
X! exit(0) ;
X }
X! return(notify_next_destroy_func(frame, status)) ;
X }
X
X
X--- 1045,1109 ----
X cur_ch = id ;
X nextc = KEYBOARD ;
X }
X+ if (processing)
X+ {
X+ if (nextc == FRAME_REPAINT) return ;
X+ else
X+ {
X+ if (event_action(cur_event) == ACTION_SELECT)
X+ XUngrabPointer(dpy, 0) ;
X+ nextc = IGNORE_EVENT ;
X+ window_bell(frame) ;
X+ message(PANEL_MES, "It's not your turn.") ;
X+ }
X+ }
X }
X
X
X! Notify_value
X! quit_proc(client, status)
X! Notify_client client ;
X Destroy_status status ;
X {
X! if (status == DESTROY_CHECKING) KILL(pid, SIGKILL) ;
X! return(notify_next_destroy_func(client, status)) ;
X! }
X!
X!
X! Notify_value
X! read_from_reve(client, fd)
X! Notify_client client ;
X! register int fd ;
X! {
X! struct reve_out out ;
X! int bytes, sout ;
X!
X! if (!started) return(NOTIFY_DONE) ;
X! sout = sizeof(struct reve_out) ;
X! if (ioctl(fd, FIONREAD, &bytes) == 0)
X {
X! if (read(fd, (char *) &out, sout) > 0)
X! {
X! profmax = out.depth ;
X! if (out.type == M_BEST) show_best(out.move, out.note) ;
X! else if (out.type == M_MOVE)
X! {
X! set_cursor(CANVASCUR) ;
X! XV_SET(frame, FRAME_BUSY, TRUE, 0) ;
X! move = out.move ;
X! note = out.note ;
X! do_computer_move(reve_player) ;
X! XV_SET(frame, FRAME_BUSY, FALSE, 0) ;
X! processing = FALSE ;
X! }
X! else if (out.type == M_SUGGESTION)
X! {
X! do_suggest(reve_player, out.move, out.note, IS_ON) ;
X! processing = FALSE ;
X! }
X! }
X }
X! return(NOTIFY_DONE) ;
X }
X
X
X***************
X*** 890,896 ****
X--- 1113,1154 ----
X }
X
X
X+ Panel_setting
X+ reset_props(item, event)
X+ Panel_item item ;
X+ Event *event ;
X+ {
X+ int val ;
X+
X+ if (dtype == XBLACK) val = CP_WHITE ;
X+ else if (dtype == XWHITE) val = CP_BLACK ;
X+ else if (dtype == XBOTH || dtype == XTWO) val = CP_NEITHER ;
X+ XV_SET(props_computer, PANEL_VALUE, val, 0) ;
X+
X+ val = ((ANIMATION & 0x1) << 0) +
X+ ((DO_BESTMOVE & 0x1) << 1) +
X+ ((DO_LAST & 0x1) << 2) +
X+ ((SHOW_NOTES & 0x1) << 3) +
X+ ((DO_NUMBER & 0x1) << 4) +
X+ ((QUICKGAME & 0x1) << 5) ;
X+ XV_SET(props_choices, PANEL_VALUE, val, 0) ;
X+ return(PANEL_NONE) ;
X+ }
X+
X+
X void
X+ reset_time(timeleft)
X+ time_t timeleft ;
X+ {
X+ struct reve_in in ;
X+
X+ in.type = M_TIME ;
X+ in.timeleft = timeleft ;
X+ WRITE(pipe_io[0][1], (char *) &in, sizeof(struct reve_in)) ;
X+ }
X+
X+
X+ void
X set_cursor(ctype)
X enum curtype ctype ;
X {
X***************
X*** 902,908 ****
X
X /*ARGSUSED*/
X void
X! set_cycle(mtype, str) /* **DUMMY ROUTINE** */
X enum panel_type mtype ;
X char *str ;
X {
X--- 1160,1167 ----
X
X /*ARGSUSED*/
X void
X! set_cycle(wtype, mtype, str) /* **DUMMY ROUTINE** */
X! enum win_type wtype ;
X enum panel_type mtype ;
X char *str ;
X {
X***************
X*** 915,971 ****
X int value ;
X Event *event ;
X {
X! level = value + 1 ;
X! items[(int) DIFFICULTY].value = level - 1 ;
X }
X
X
X! static void
X! set_player(item, value, event) /* Callback to set black/white player. */
X Panel_item item ;
X- int value ;
X Event *event ;
X {
X! char *label ;
X! enum panel_type this, other ;
X! int curi, curo ;
X
X! label = (char *) xv_get(item, PANEL_LABEL_STRING) ;
X! if (EQUAL(label, "Black"))
X {
X! this = BLACK_PLAYS ;
X! other = WHITE_PLAYS ;
X }
X! else
X {
X! this = WHITE_PLAYS ;
X! other = BLACK_PLAYS ;
X! }
X
X! curi = items[(int) this].value = value ;
X! curo = items[(int) other].value ;
X!
X! if (curi == COMPUTER && curo == COMPUTER)
X {
X! curi = HUMAN ;
X! XV_SET(item, PANEL_VALUE, curi, 0) ;
X! items[(int) this].value = curi ;
X! message(PANEL_MES, "Computer can't play both players.") ;
X }
X! if (curi == HUMAN && curo == COMPUTER)
X! dtype = (this == BLACK_PLAYS) ? XBLACK : XWHITE ;
X! else if (curi == COMPUTER && curo == HUMAN)
X! dtype = (this == BLACK_PLAYS) ? XWHITE : XBLACK ;
X! else if (curi == HUMAN && curo == HUMAN)
X! dtype = (dtype == XTWO) ? XTWO : XBOTH ;
X!
X if (curi == COMPUTER)
X! if ((this == BLACK_PLAYS && cmode == BLACK_START) ||
X! (this == WHITE_PLAYS && cmode == WHITE_START))
X computer_move(next_player) ;
X }
X
X
X Panel_setting
X start_load_save(item, event)
X Panel_item item ;
X--- 1174,1287 ----
X int value ;
X Event *event ;
X {
X! if (value == DEPTH_MENU_ENTRY)
X! {
X! position_popup(frame, d_frame, P_RIGHT) ;
X! XV_SET(d_frame, XV_SHOW, TRUE, 0) ;
X! }
X! else
X! {
X! level = value + 1 ;
X! change_depth(1) ;
X! XV_SET(d_text, PANEL_VALUE, 1, 0) ;
X! items[(int) DIFF_CHOICE].value = level - 1 ;
X! }
X }
X
X
X! Panel_setting
X! set_profmax(item, event)
X Panel_item item ;
X Event *event ;
X {
X! XV_SET(d_frame, XV_SHOW, FALSE, 0) ;
X! change_depth((int) xv_get(d_text, PANEL_VALUE)) ;
X! level = 1 ;
X! return(PANEL_NONE) ;
X! }
X
X!
X! Panel_setting
X! set_props(item, event)
X! Panel_item item ;
X! Event *event ;
X! {
X! int curi, oldval, val ;
X!
X! if (dtype == XBLACK) oldval = CP_WHITE ;
X! else if (dtype == XWHITE) oldval = CP_BLACK ;
X! else if (dtype == XBOTH || dtype == XTWO) oldval = CP_NEITHER ;
X!
X! val = (int) xv_get(props_computer, PANEL_VALUE, 0) ;
X! if (val == CP_WHITE)
X {
X! dtype = XBLACK ;
X! play_computer = TRUE ;
X! items[(int) BLACK_PLAYS].value = HUMAN ;
X! items[(int) WHITE_PLAYS].value = COMPUTER ;
X }
X! else if (val == CP_BLACK)
X {
X! dtype = XWHITE ;
X! play_computer = TRUE ;
X! items[(int) BLACK_PLAYS].value = COMPUTER ;
X! items[(int) WHITE_PLAYS].value = HUMAN ;
X
X! }
X! else if (val == CP_NEITHER)
X {
X! dtype = XTWO ;
X! play_computer = FALSE ;
X! items[(int) BLACK_PLAYS].value = HUMAN ;
X! items[(int) WHITE_PLAYS].value = HUMAN ;
X }
X! else if (val == CP_BOTH)
X! {
X! XV_SET(props_computer, PANEL_VALUE, oldval, 0) ;
X! message(PANEL_MES, "Computer plays both is not implemented yet.") ;
X! }
X!
X! val = items[(int) BLACK_PLAYS].value ;
X! XV_SET(black_item, PANEL_VALUE, player_values[val], 0) ;
X! val = items[(int) WHITE_PLAYS].value ;
X! XV_SET(white_item, PANEL_VALUE, player_values[val], 0) ;
X!
X! if (next_player == BLACK) curi = items[(int) BLACK_PLAYS].value ;
X! else curi = items[(int) WHITE_PLAYS].value ;
X if (curi == COMPUTER)
X! if ((next_player == BLACK && cmode == BLACK_START) ||
X! (next_player == WHITE && cmode == WHITE_START))
X computer_move(next_player) ;
X+
X+ val = (int) xv_get(props_choices, PANEL_VALUE, 0) ;
X+ ANIMATION = (val >> 0) & 0x1 ;
X+ DO_BESTMOVE = (val >> 1) & 0x1 ;
X+ DO_LAST = (val >> 2) & 0x1 ;
X+ SHOW_NOTES = (val >> 3) & 0x1 ;
X+ DO_NUMBER = (val >> 4) & 0x1 ;
X+ QUICKGAME = (val >> 5) & 0x1 ;
X+
X+ XV_SET(props_frame, XV_SHOW, FALSE, 0) ;
X+ return(PANEL_NONE) ;
X }
X
X
X+ Notify_value
X+ sigchldcatcher(client, pid, status, rusage)
X+ Notify_client client ;
X+ int pid ;
X+ union wait *status ;
X+ struct rusage *rusage ;
X+ {
X+ if (WIFEXITED(*status))
X+ {
X+ notify_set_input_func(client, NOTIFY_FUNC_NULL, pipe_io[1][0]) ;
X+ return(NOTIFY_DONE) ;
X+ }
X+ return(NOTIFY_IGNORED) ;
X+ }
X+
X+
X Panel_setting
X start_load_save(item, event)
X Panel_item item ;
X***************
X*** 973,979 ****
X {
X char *label ;
X
X! XV_SET(ls_frame, XV_SHOW, FALSE, NULL) ;
X STRCPY(gamefile, (char *) xv_get(ls_text, PANEL_VALUE)) ;
X label = (char *) xv_get(ls_button, PANEL_LABEL_STRING) ;
X if (EQUAL(label, "Load")) load_game() ;
X--- 1289,1295 ----
X {
X char *label ;
X
X! XV_SET(ls_frame, XV_SHOW, FALSE, 0) ;
X STRCPY(gamefile, (char *) xv_get(ls_text, PANEL_VALUE)) ;
X label = (char *) xv_get(ls_button, PANEL_LABEL_STRING) ;
X if (EQUAL(label, "Load")) load_game() ;
X***************
X*** 988,1004 ****
X enum disp_type dtype ;
X {
X started = 1 ;
X xv_main_loop(frame) ;
X }
X
X
X! static void /* Dummy function for unimplemented callbacks */
X! unimplemented()
X {
X! message(PANEL_MES, "Not implemented yet.\n") ;
X }
X
X
X static void
X xv_load_game(item, value, event) /* Callback for loading a game button. */
X Panel_item item ;
X--- 1304,1335 ----
X enum disp_type dtype ;
X {
X started = 1 ;
X+ notify_interpose_destroy_func(frame, quit_proc) ;
X xv_main_loop(frame) ;
X }
X
X
X! /*ARGSUSED*/
X! void
X! write_to_reve(mtype, reve_board, player, level, reve_move, note)
X! enum move_type mtype ;
X! int *reve_board, player, level, *reve_move ;
X! long *note ;
X {
X! int i ;
X! struct reve_in in ;
X!
X! for (i = 0; i < 64; i++) in.board[i] = reve_board[i] ;
X! in.player = player ;
X! in.level = level ;
X! in.type = mtype ;
X! reve_player = player ;
X! processing = TRUE ;
X! WRITE(pipe_io[0][1], (char *) &in, sizeof(struct reve_in)) ;
X }
X
X
X+ /*ARGSUSED*/
X static void
X xv_load_game(item, value, event) /* Callback for loading a game button. */
X Panel_item item ;
X***************
X*** 1006,1017 ****
X Event *event ;
X {
X position_popup(frame, ls_frame, P_RIGHT) ;
X! XV_SET(ls_text, PANEL_LABEL_STRING, "Load File: ", 0) ;
X! XV_SET(ls_button, PANEL_LABEL_STRING, "Load", 0) ;
X! XV_SET(ls_frame, XV_SHOW, TRUE, NULL) ;
X }
X
X
X static void
X xv_save_game(item, value, event) /* Callback load saving a game button. */
X Panel_item item ;
X--- 1337,1360 ----
X Event *event ;
X {
X position_popup(frame, ls_frame, P_RIGHT) ;
X! XV_SET(ls_frame, FRAME_LABEL, "Load Game", 0) ;
X! XV_SET(ls_text, PANEL_LABEL_STRING, "Load File: ", 0) ;
X! XV_SET(ls_frame, XV_SHOW, TRUE, 0) ;
X }
X
X
X+ /*ARGSUSED*/
X+ static void
X+ xv_new_game(item, value, event) /* Callback for starting a new game. */
X+ Panel_item item ;
X+ int value ;
X+ Event *event ;
X+ {
X+ new_game() ;
X+ }
X+
X+
X+ /*ARGSUSED*/
X static void
X xv_save_game(item, value, event) /* Callback load saving a game button. */
X Panel_item item ;
X***************
X*** 1019,1025 ****
X Event *event ;
X {
X position_popup(frame, ls_frame, P_RIGHT) ;
X! XV_SET(ls_text, PANEL_LABEL_STRING, "Save File: ", 0) ;
X! XV_SET(ls_button, PANEL_LABEL_STRING, "Save", 0) ;
X! XV_SET(ls_frame, XV_SHOW, TRUE, NULL) ;
X }
X--- 1362,1380 ----
X Event *event ;
X {
X position_popup(frame, ls_frame, P_RIGHT) ;
X! XV_SET(ls_frame, FRAME_LABEL, "Save Game", 0) ;
X! XV_SET(ls_text, PANEL_LABEL_STRING, "Save File: ", 0) ;
X! XV_SET(ls_frame, XV_SHOW, TRUE, 0) ;
X! }
X!
X!
X! /*ARGSUSED*/
X! static void
X! xv_set_props(item, value, event) /* Callback props button. */
X! Panel_item item ;
X! int value ;
X! Event *event ;
X! {
X! position_popup(frame, props_frame, P_RIGHT) ;
X! XV_SET(props_frame, XV_SHOW, TRUE, 0) ;
X }
X
END_OF_FILE
if test 52444 -ne `wc -c <'patches03f'`; then
echo shar: \"'patches03f'\" unpacked with wrong size!
fi
# end of 'patches03f'
fi
echo shar: End of archive 9 \(of 9\).
cp /dev/null ark9isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 9 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 9 archives.
rm -f ark[1-9]isdone ark[1-9][0-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0