billr@saab.CNA.TEK.COM (Bill Randle) (12/22/90)
Submitted-by: Rich Burridge <rburridge@sun.COM>
Posting-number: Volume 12, Issue 13
Archive-name: reve/Patch4d
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 4 (of 4)."
# Contents: patches04d
# Wrapped by billr@saab on Fri Dec 21 11:36:12 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'patches04d' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'patches04d'\"
else
echo shar: Extracting \"'patches04d'\" \(46589 characters\)
sed "s/^X//" >'patches04d' <<'END_OF_FILE'
X
X------- items.c -------
X*** /tmp/da06882 Tue Dec 18 10:10:23 1990
X--- items.c Mon Dec 17 10:24:06 1990
X***************
X*** 40,45 ****
X--- 40,46 ----
X
X x = items[(int) item].x ;
X y = items[(int) item].y ;
X+ if (x == -1 && y == -1) return ;
X if (iscolor[(int) cur_dpyno])
X {
X draw_stencil(wtype, x, y, BWIDTH, BHEIGHT, RSRC, color,
X***************
X*** 50,56 ****
X BUT_STENCIL, image) ;
X label = items[(int) item].text ;
X if (image == BUT_INVERT) color = C_WHITE ;
X! else color = C_BLACK ;
X x += ((BWIDTH - get_strwidth(NFONT, label)) / 2) ;
X y += (nfont_height + (BHEIGHT - nfont_height) / 2) - 5 ;
X draw_text(wtype, x, y, NFONT, color, label) ;
X--- 51,57 ----
X BUT_STENCIL, image) ;
X label = items[(int) item].text ;
X if (image == BUT_INVERT) color = C_WHITE ;
X! else color = C_TEXT ;
X x += ((BWIDTH - get_strwidth(NFONT, label)) / 2) ;
X y += (nfont_height + (BHEIGHT - nfont_height) / 2) - 5 ;
X draw_text(wtype, x, y, NFONT, color, label) ;
X***************
X*** 64,75 ****
X int color ;
X {
X char *str ;
X! int height, i, maxw, val, width, x, xoff, y ;
X
X if (strlen(items[(int) item].label))
X draw_text(items[(int) item].wtype,
X items[(int) item].lx, items[(int) item].ly + bfont_height,
X! BFONT, C_BLACK, items[(int) item].label) ;
X
X maxw = 0 ;
X for (i = 0; i < items[(int) item].nopts; i++)
X--- 65,77 ----
X int color ;
X {
X char *str ;
X! int height, i, maxw, tcol, val, width, x, xoff, y ;
X
X+ tcol = B_COLOR(C_TEXT) ;
X if (strlen(items[(int) item].label))
X draw_text(items[(int) item].wtype,
X items[(int) item].lx, items[(int) item].ly + bfont_height,
X! BFONT, tcol, items[(int) item].label) ;
X
X maxw = 0 ;
X for (i = 0; i < items[(int) item].nopts; i++)
X***************
X*** 100,109 ****
X xoff = (maxw - val) / 2 ;
X draw_text(items[(int) item].wtype,
X x + (i * maxw) + xoff,
X! y + nfont_height + (nfont_height / 2), NFONT, C_BLACK, str) ;
X }
X
X val = items[(int) item].value ;
X draw_rect(wtype,
X x + (val * maxw) + 1, y + 1,
X x + ((val + 1) * maxw) - 1, y + height - 1, RSRC, C_BLACK) ;
X--- 102,112 ----
X xoff = (maxw - val) / 2 ;
X draw_text(items[(int) item].wtype,
X x + (i * maxw) + xoff,
X! y + nfont_height + (nfont_height / 2), NFONT, tcol, str) ;
X }
X
X val = items[(int) item].value ;
X+ if (val < 0 || val >= items[(int) item].nopts) return ;
X draw_rect(wtype,
X x + (val * maxw) + 1, y + 1,
X x + ((val + 1) * maxw) - 1, y + height - 1, RSRC, C_BLACK) ;
X***************
X*** 140,152 ****
X enum image_type image ;
X {
X char val[4] ;
X
X if (strlen(items[(int) item].label))
X draw_text(items[(int) item].wtype,
X items[(int) item].lx, items[(int) item].ly + bfont_height,
X! BFONT, C_BLACK, items[(int) item].label) ;
X
X! SPRINTF(val, "%d", items[(int) item].value) ;
X set_cycle(wtype, item, val) ;
X draw_cycle(wtype, item, color, image) ;
X }
X--- 143,158 ----
X enum image_type image ;
X {
X char val[4] ;
X+ int tcol ;
X
X+ tcol = B_COLOR(C_TEXT) ;
X if (strlen(items[(int) item].label))
X draw_text(items[(int) item].wtype,
X items[(int) item].lx, items[(int) item].ly + bfont_height,
X! BFONT, tcol, items[(int) item].label) ;
X
X! if (item == MAX_DEPTH && !items[(int) item].value) STRCPY(val, "off") ;
X! else SPRINTF(val, "%d", items[(int) item].value) ;
X set_cycle(wtype, item, val) ;
X draw_cycle(wtype, item, color, image) ;
X }
X***************
X*** 158,166 ****
X {
X int y ;
X
X! color_area(W_MAIN, tx + 1, ty + 1, tw - 2, th - 2, C_WHITE) ;
X y = ty + (nfont_height + (th - nfont_height) / 2) - 5 ;
X! draw_text(W_MAIN, tx + 5, y, NFONT, C_BLACK, str) ;
X draw_line(W_MAIN, tx + 5 + get_strwidth(NFONT, str), y + 5,
X tx + 5 + get_strwidth(NFONT, str), y + 5 - nfont_height,
X RSRC, C_BLACK) ;
X--- 164,172 ----
X {
X int y ;
X
X! color_area(W_MAIN, tx + 1, ty + 1, tw - 2, th - 2, W_COLOR(C_PANEL)) ;
X y = ty + (nfont_height + (th - nfont_height) / 2) - 5 ;
X! draw_text(W_MAIN, tx + 5, y, NFONT, B_COLOR(C_TEXT), str) ;
X draw_line(W_MAIN, tx + 5 + get_strwidth(NFONT, str), y + 5,
X tx + 5 + get_strwidth(NFONT, str), y + 5 - nfont_height,
X RSRC, C_BLACK) ;
X***************
X*** 174,185 ****
X int color ;
X {
X enum image_type image ;
X! int x, y ;
X
X if (strlen(items[(int) item].label))
X draw_text(items[(int) item].wtype,
X items[(int) item].lx, items[(int) item].ly + bfont_height,
X! BFONT, C_BLACK, items[(int) item].label) ;
X
X if (items[(int) item].value) image = TOGGLE_ON ;
X else image = TOGGLE_OFF ;
X--- 180,192 ----
X int color ;
X {
X enum image_type image ;
X! int tcol, x, y ;
X
X+ tcol = B_COLOR(C_TEXT) ;
X if (strlen(items[(int) item].label))
X draw_text(items[(int) item].wtype,
X items[(int) item].lx, items[(int) item].ly + bfont_height,
X! BFONT, tcol, items[(int) item].label) ;
X
X if (items[(int) item].value) image = TOGGLE_ON ;
X else image = TOGGLE_OFF ;
X***************
X*** 199,205 ****
X draw_text(items[(int) item].wtype,
X items[(int) item].x + TICKWIDTH + 10,
X items[(int) item].y + nfont_height,
X! NFONT, C_BLACK, items[(int) item].text) ;
X }
X
X
X--- 206,212 ----
X draw_text(items[(int) item].wtype,
X items[(int) item].x + TICKWIDTH + 10,
X items[(int) item].y + nfont_height,
X! NFONT, tcol, items[(int) item].text) ;
X }
X
X
X***************
X*** 211,222 ****
X lsval = (curx < (BBORDER + (2*(BWIDTH+BGAP)))) ? 'l' : 's' ;
X x1 = BBORDER + BWIDTH + (BGAP / 2) ;
X y1 = BBORDER + BHEIGHT + (BGAP / 2) ;
X! color_area(W_MAIN, x1, y1, 4 * (BWIDTH + BGAP), BHEIGHT + BGAP, C_WHITE) ;
X draw_rect(W_MAIN, x1, y1, x1 + (4 * (BWIDTH + BGAP)) - 1,
X y1 + BHEIGHT + BGAP - 1, RSRC, C_BLACK) ;
X draw_text(W_MAIN, BBORDER + BWIDTH + BGAP, BBORDER + BHEIGHT + BGAP +
X (nfont_height + (BHEIGHT - nfont_height) / 2) - 5,
X! BFONT, C_BLACK, "File:") ;
X tx = BBORDER + BWIDTH + BGAP + (BWIDTH / 2) + 10 ;
X ty = BBORDER + BHEIGHT + BGAP ;
X tw = (BWIDTH / 2) - 10 + (2 * (BWIDTH + BGAP)) ;
X--- 218,230 ----
X lsval = (curx < (BBORDER + (2*(BWIDTH+BGAP)))) ? 'l' : 's' ;
X x1 = BBORDER + BWIDTH + (BGAP / 2) ;
X y1 = BBORDER + BHEIGHT + (BGAP / 2) ;
X! color_area(W_MAIN, x1, y1,
X! 4 * (BWIDTH + BGAP), BHEIGHT + BGAP, W_COLOR(C_PANEL)) ;
X draw_rect(W_MAIN, x1, y1, x1 + (4 * (BWIDTH + BGAP)) - 1,
X y1 + BHEIGHT + BGAP - 1, RSRC, C_BLACK) ;
X draw_text(W_MAIN, BBORDER + BWIDTH + BGAP, BBORDER + BHEIGHT + BGAP +
X (nfont_height + (BHEIGHT - nfont_height) / 2) - 5,
X! BFONT, B_COLOR(C_TEXT), "File:") ;
X tx = BBORDER + BWIDTH + BGAP + (BWIDTH / 2) + 10 ;
X ty = BBORDER + BHEIGHT + BGAP ;
X tw = (BWIDTH / 2) - 10 + (2 * (BWIDTH + BGAP)) ;
X***************
X*** 227,233 ****
X tinput = 1 ;
X items[(int) CANCEL_BUT].x = BBORDER + (4*(BWIDTH+BGAP)) ;
X items[(int) CANCEL_BUT].y = BBORDER + (1*(BHEIGHT+BGAP)) ;
X! draw_button(W_MAIN, CANCEL_BUT, C_LGREY, BUT_NORMAL) ;
X }
X
X
X--- 235,241 ----
X tinput = 1 ;
X items[(int) CANCEL_BUT].x = BBORDER + (4*(BWIDTH+BGAP)) ;
X items[(int) CANCEL_BUT].y = BBORDER + (1*(BHEIGHT+BGAP)) ;
X! draw_button(W_MAIN, CANCEL_BUT, C_ITEMS, BUT_NORMAL) ;
X }
X
X
X***************
X*** 273,286 ****
X if (strlen(items[(int) item].label))
X draw_text(items[(int) item].wtype,
X items[(int) item].lx, items[(int) item].ly + bfont_height,
X! BFONT, C_BLACK, items[(int) item].label) ;
X
X message = items[(int) item].text ;
X x = items[(int) item].x ;
X y = items[(int) item].y ;
X! color = (iscolor[(int) cur_dpyno]) ? C_BEIGE : C_WHITE ;
X! color_area(wtype, x, y, TOTAL_WIDTH, 15, color) ;
X! draw_text(wtype, x, y + nfont_height, NFONT, C_BLACK, message) ;
X }
X
X
X--- 281,293 ----
X if (strlen(items[(int) item].label))
X draw_text(items[(int) item].wtype,
X items[(int) item].lx, items[(int) item].ly + bfont_height,
X! BFONT, B_COLOR(C_TEXT), items[(int) item].label) ;
X
X message = items[(int) item].text ;
X x = items[(int) item].x ;
X y = items[(int) item].y ;
X! color_area(wtype, x, y, TOTAL_WIDTH, 15, W_COLOR(C_PANEL)) ;
X! draw_text(wtype, x, y + nfont_height, NFONT, B_COLOR(C_TEXT), message) ;
X }
X
X
X***************
X*** 287,301 ****
X void
X make_panel()
X {
X! draw_button(W_MAIN, LOAD_BUT, C_LGREY, BUT_NORMAL) ;
X! draw_button(W_MAIN, MOVES_BUT, C_LGREY, BUT_NORMAL) ;
X! draw_button(W_MAIN, NEW_GAME_BUT, C_LGREY, BUT_NORMAL) ;
X! draw_button(W_MAIN, SAVE_BUT, C_LGREY, BUT_NORMAL) ;
X! draw_button(W_MAIN, SUGGEST_BUT, C_LGREY, BUT_NORMAL) ;
X! draw_button(W_MAIN, UNDO_BUT, C_LGREY, BUT_NORMAL) ;
X
X! draw_button(W_MAIN, PROPS_BUT, C_LGREY, BUT_NORMAL) ;
X! draw_button(W_MAIN, QUIT_BUT, C_LGREY, BUT_NORMAL) ;
X
X make_message(W_MAIN, BLACK_PLAYS) ;
X make_message(W_MAIN, WHITE_PLAYS) ;
X--- 294,312 ----
X void
X make_panel()
X {
X! draw_button(W_MAIN, LOAD_BUT, C_ITEMS, BUT_NORMAL) ;
X! draw_button(W_MAIN, MOVES_BUT, C_ITEMS, BUT_NORMAL) ;
X! draw_button(W_MAIN, NEW_GAME_BUT, C_ITEMS, BUT_NORMAL) ;
X! draw_button(W_MAIN, HELP_BUT, C_ITEMS, BUT_NORMAL) ;
X! draw_button(W_MAIN, REDO_BUT, C_ITEMS, BUT_NORMAL) ;
X! draw_button(W_MAIN, PROPS_BUT, C_ITEMS, BUT_NORMAL) ;
X
X! draw_button(W_MAIN, SAVE_BUT, C_ITEMS, BUT_NORMAL) ;
X! draw_button(W_MAIN, SUGGEST_BUT, C_ITEMS, BUT_NORMAL) ;
X! draw_button(W_MAIN, EDIT_BUT, C_ITEMS, BUT_NORMAL) ;
X! draw_button(W_MAIN, STOP_BUT, C_ITEMS, BUT_NORMAL) ;
X! draw_button(W_MAIN, UNDO_BUT, C_ITEMS, BUT_NORMAL) ;
X! draw_button(W_MAIN, QUIT_BUT, C_ITEMS, BUT_NORMAL) ;
X
X make_message(W_MAIN, BLACK_PLAYS) ;
X make_message(W_MAIN, WHITE_PLAYS) ;
X***************
X*** 314,342 ****
X int n ;
X
X n = (int) mtype ;
X- color = (iscolor[(int) cur_dpyno]) ? C_BEIGE : C_WHITE ;
X color_area(W_MAIN, items[n].x, items[n].y,
X! get_strwidth(NFONT, items[n].text), nfont_height + 5, color) ;
X draw_text(W_MAIN, items[n].x, items[n].y + nfont_height,
X! NFONT, C_BLACK, str) ;
X STRCPY(items[n].text, str) ;
X }
X
X
X void
X paint_prop_sheet()
X {
X! int color, d ;
X
X! d = (int) cur_dpyno ;
X! color = (iscolor[d]) ? C_BEIGE : C_WHITE ;
X color_area(W_PROPS, 0, 0, PROPS_WIDTH, PROPS_HEIGHT, color) ;
X
X- color = (iscolor[d]) ? C_BEIGE : C_WHITE ;
X draw_choice(W_PROPS, COMP_CHOICE, color) ;
X draw_choice(W_PROPS, DIFF_CHOICE, color) ;
X
X! draw_cycle_item(W_PROPS, MAX_DEPTH, C_LGREY, CY_NORMAL) ;
X
X draw_toggle(W_PROPS, OPT_ANIM, color) ;
X draw_toggle(W_PROPS, OPT_BEST, color) ;
X--- 325,383 ----
X int n ;
X
X n = (int) mtype ;
X color_area(W_MAIN, items[n].x, items[n].y,
X! get_strwidth(NFONT, items[n].text),
X! nfont_height + 5, W_COLOR(C_PANEL)) ;
X draw_text(W_MAIN, items[n].x, items[n].y + nfont_height,
X! NFONT, B_COLOR(C_TEXT), str) ;
X STRCPY(items[n].text, str) ;
X }
X
X
X void
X+ paint_help()
X+ {
X+ if (hfp == NULL) return ;
X+ color_area(W_HELP, 0, 0,
X+ help_width, (2 * CGAP) + CHEIGHT, W_COLOR(C_PANEL)) ;
X+ draw_cycle_item(W_HELP, HELP_PAGE, C_ITEMS, CY_NORMAL) ;
X+ draw_line(W_HELP, 0, (2 * CGAP) + CHEIGHT,
X+ help_width, (2 * CGAP) + CHEIGHT, RSRC, C_BLACK) ;
X+ paint_help_text() ;
X+ }
X+
X+
X+ void
X+ paint_help_text()
X+ {
X+ char buf[MAXLINE] ;
X+ int i, y ;
X+
X+ color_area(W_HELP, 0, (2 * CGAP) + CHEIGHT + 1,
X+ help_width, ((hfont_height + 1) * HELP_ROWS) + (2 * CGAP) - 1,
X+ W_COLOR(C_PANEL)) ;
X+ FSEEK(hfp, help_offsets[items[(int) HELP_PAGE].value], 0) ;
X+ for (i = 0; i < HELP_ROWS; i++)
X+ {
X+ if (fgets(buf, MAXLINE, hfp) == NULL) return ;
X+ y = (3 * CGAP) + CHEIGHT + ((i + 1) * (hfont_height + 1)) ;
X+ draw_text(W_HELP, CGAP, y, NFONT, B_COLOR(C_TEXT), buf) ;
X+ }
X+ }
X+
X+
X+ void
X paint_prop_sheet()
X {
X! int color ;
X
X! color = W_COLOR(C_PANEL) ;
X color_area(W_PROPS, 0, 0, PROPS_WIDTH, PROPS_HEIGHT, color) ;
X
X draw_choice(W_PROPS, COMP_CHOICE, color) ;
X draw_choice(W_PROPS, DIFF_CHOICE, color) ;
X
X! draw_cycle_item(W_PROPS, MAX_DEPTH, C_ITEMS, CY_NORMAL) ;
X
X draw_toggle(W_PROPS, OPT_ANIM, color) ;
X draw_toggle(W_PROPS, OPT_BEST, color) ;
X***************
X*** 355,364 ****
X x1 = BBORDER + BWIDTH + (BGAP / 2) ;
X y1 = BBORDER + BHEIGHT + (BGAP / 2) ;
X color_area(W_MAIN, x1, y1, 4 * (BWIDTH + BGAP), BHEIGHT + BGAP,
X! (iscolor[(int) cur_dpyno]) ? C_BEIGE : C_WHITE) ;
X tinput = 0 ;
X items[(int) CANCEL_BUT].x = -1 ;
X items[(int) CANCEL_BUT].y = -1 ;
X }
X
X
X--- 396,410 ----
X x1 = BBORDER + BWIDTH + (BGAP / 2) ;
X y1 = BBORDER + BHEIGHT + (BGAP / 2) ;
X color_area(W_MAIN, x1, y1, 4 * (BWIDTH + BGAP), BHEIGHT + BGAP,
X! W_COLOR(C_PANEL)) ;
X tinput = 0 ;
X items[(int) CANCEL_BUT].x = -1 ;
X items[(int) CANCEL_BUT].y = -1 ;
X+
X+ draw_button(W_MAIN, SUGGEST_BUT, C_ITEMS, BUT_NORMAL) ;
X+ draw_button(W_MAIN, EDIT_BUT, C_ITEMS, BUT_NORMAL) ;
X+ draw_button(W_MAIN, STOP_BUT, C_ITEMS, BUT_NORMAL) ;
X+ draw_button(W_MAIN, UNDO_BUT, C_ITEMS, BUT_NORMAL) ;
X }
X
X
X***************
X*** 368,379 ****
X enum panel_type item ;
X char *str ;
X {
X- color = (iscolor[(int) cur_dpyno]) ? C_BEIGE : C_WHITE ;
X-
X color_area(wtype, items[(int) item].x, items[(int) item].y,
X! items[(int) item].width, CHEIGHT, color) ;
X draw_text(wtype, items[(int) item].x, items[(int) item].y + nfont_height,
X! NFONT, C_BLACK, str) ;
X STRCPY(items[(int) item].text, str) ;
X items[(int) item].width = get_strwidth(NFONT, str) ;
X }
X--- 414,423 ----
X enum panel_type item ;
X char *str ;
X {
X color_area(wtype, items[(int) item].x, items[(int) item].y,
X! items[(int) item].width, CHEIGHT, W_COLOR(C_PANEL)) ;
X draw_text(wtype, items[(int) item].x, items[(int) item].y + nfont_height,
X! NFONT, B_COLOR(C_TEXT), str) ;
X STRCPY(items[(int) item].text, str) ;
X items[(int) item].width = get_strwidth(NFONT, str) ;
X }
X
X------- main.c -------
X*** /tmp/da06885 Tue Dec 18 10:10:24 1990
X--- main.c Sun Dec 16 02:44:07 1990
X***************
X*** 38,46 ****
X } ;
X #endif /*NO_TIMEVAL*/
X
X! /* Text values for the cyclic buttons. */
X char *comp_plays[] = { "white", "black", "neither", "both" } ;
X- char *diff_values[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL } ;
X char *notes_values[] = { "off", "on", NULL } ;
X char *player_values[] = { "human", "computer", NULL } ;
X
X--- 38,48 ----
X } ;
X #endif /*NO_TIMEVAL*/
X
X! char *diff_values[] = {
X! " 1 ", " 2 ", " 3 ", " 4 ", " 5 ", " 6 ", " 7 ", " 8 ", " 9 ", NULL
X! } ;
X!
X char *comp_plays[] = { "white", "black", "neither", "both" } ;
X char *notes_values[] = { "off", "on", NULL } ;
X char *player_values[] = { "human", "computer", NULL } ;
X
X***************
X*** 52,58 ****
X "log", /* Boolean: write computer info to log file. */
X "notes", /* Boolean: show computer notes. */
X "number", /* Boolean: show last move (number on stone). */
X! "quick" /* Boolean: play quick game (don't flip stones). */
X } ;
X
X enum cantype cmode, last_cmode ;
X--- 54,68 ----
X "log", /* Boolean: write computer info to log file. */
X "notes", /* Boolean: show computer notes. */
X "number", /* Boolean: show last move (number on stone). */
X! "quick", /* Boolean: play quick game (don't flip stones). */
X! "panelColor", /* String: main and property panels color. */
X! "boardColor", /* String: playing board color. */
X! "boardBorderColor", /* String: playing board border color. */
X! "gridColor", /* String: grid lines color. */
X! "textColor", /* String: text color. */
X! "itemColor", /* String: color of the panel items. */
X! "properties", /* Boolean: initially show property window? */
X! "showHelp" /* Boolean: initially show help window? */
X } ;
X
X enum cantype cmode, last_cmode ;
X***************
X*** 61,66 ****
X--- 71,86 ----
X enum set_type direction ; /* Incremental direction for cycle item. */
X enum win_type curwin ; /* Window the current event for in. */
X
X+ FILE *hfp ; /* File descriptor for online help file. */
X+
X+ char *colstr[REVE_COLORSIZE] = {
X+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
X+ } ;
X+
X+ int rcols[REVE_COLORSIZE] ; /* Red colormap values. */
X+ int gcols[REVE_COLORSIZE] ; /* Green colormap values. */
X+ int bcols[REVE_COLORSIZE] ; /* Blue colormap values. */
X+
X int tx, ty, tw, th ; /* Position and size of text field. */
X
X int piece_x ; /* Current X position of moving piece. */
X***************
X*** 77,82 ****
X--- 97,106 ----
X int down ; /* Indicates is a mouse button is down. */
X int first_move = 0 ; /* Set if computer plays first move. */
X int iconic ; /* Set if window is currently iconic. */
X+ int help_height ; /* Height of the help window. */
X+ int help_showing ; /* If set, the help window is visible. */
X+ int help_width ; /* Width of the help window. */
X+ int hfont_height ; /* Height in pixels for help font. */
X int inv_video = 0 ; /* Set if displaying in inverse video. */
X int isblack ; /* Set if human to play the black pieces. */
X int iscolor[MAXDPY] ; /* Set if this is a color screen. */
X***************
X*** 96,101 ****
X--- 120,126 ----
X int nextc ; /* Current event identifier. */
X int next_player ; /* Next player (BLACK or WHITE) to move. */
X int nfont_height ; /* Height in pixels for normal font. */
X+ int old_diffval ; /* Old difficulty value (possibly restored). */
X int play_computer ; /* Set if playing against the computer. */
X int posspec ; /* Set if -Wp or -g option is present (for X11) */
X int processing ; /* If set, computer is procesing a move. */
X***************
X*** 110,115 ****
X--- 135,142 ----
X int wx ; /* Initial X position of the window. */
X int wy ; /* Initial Y position of the window. */
X
X+ long help_offsets[MAXPAGES] ; /* Offsets into the reve help file. */
X+
X /* Globals for passing arguments to "sandwich";
X * this is to save time putting arguments on and off the
X * stack in a very heavily used piece of code
X***************
X*** 168,177 ****
X new_game
X },
X
X! { /* save button. */
X W_MAIN, P_BUTTON, 0, 0,
X "",
X BBORDER + (3*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
X BWIDTH, BHEIGHT, "save", 0,
X (char **) NULL, 0,
X draw_textfield
X--- 195,231 ----
X new_game
X },
X
X! { /* help button. */
X W_MAIN, P_BUTTON, 0, 0,
X "",
X BBORDER + (3*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
X+ BWIDTH, BHEIGHT, "help", 0,
X+ (char **) NULL, 0,
X+ do_help
X+ },
X+
X+ { /* redo button. */
X+ W_MAIN, P_BUTTON, 0, 0,
X+ "",
X+ BBORDER + (4*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
X+ BWIDTH, BHEIGHT, "redo", 0,
X+ (char **) NULL, 0,
X+ redo
X+ },
X+
X+ { /* props button. */
X+ W_MAIN, P_BUTTON, 0, 0,
X+ "",
X+ BBORDER + (5*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
X+ BWIDTH, BHEIGHT, "props", 0,
X+ (char **) NULL, 0,
X+ do_props
X+ },
X+
X+ { /* save button. */
X+ W_MAIN, P_BUTTON, 0, 0,
X+ "",
X+ BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)),
X BWIDTH, BHEIGHT, "save", 0,
X (char **) NULL, 0,
X draw_textfield
X***************
X*** 180,209 ****
X { /* suggest button. */
X W_MAIN, P_BUTTON, 0, 0,
X "",
X! BBORDER + (4*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
X BWIDTH, BHEIGHT, "suggest", 0,
X (char **) NULL, 0,
X suggest
X },
X
X { /* undo button. */
X W_MAIN, P_BUTTON, 0, 0,
X "",
X! BBORDER + (5*(BWIDTH+BGAP)), BBORDER + (0*(BHEIGHT+BGAP)),
X BWIDTH, BHEIGHT, "undo", 0,
X (char **) NULL, 0,
X undo
X },
X
X- { /* props button. */
X- W_MAIN, P_BUTTON, 0, 0,
X- "",
X- BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)),
X- BWIDTH, BHEIGHT, "props", 0,
X- (char **) NULL, 0,
X- do_props
X- },
X-
X { /* cancel button. */
X W_MAIN, P_BUTTON, 0, 0,
X "",
X--- 234,274 ----
X { /* suggest button. */
X W_MAIN, P_BUTTON, 0, 0,
X "",
X! BBORDER + (1*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)),
X BWIDTH, BHEIGHT, "suggest", 0,
X (char **) NULL, 0,
X suggest
X },
X
X+ { /* edit button. */
X+ W_MAIN, P_BUTTON, 0, 0,
X+ "",
X+ /* BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)), */
X+ -1, -1,
X+ BWIDTH, BHEIGHT, "edit", 0,
X+ (char **) NULL, 0,
X+ do_edit
X+ },
X+
X+ { /* stop button. */
X+ W_MAIN, P_BUTTON, 0, 0,
X+ "",
X+ /* BBORDER + (3*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)), */
X+ -1, -1,
X+ BWIDTH, BHEIGHT, "stop", 0,
X+ (char **) NULL, 0,
X+ do_stop
X+ },
X+
X { /* undo button. */
X W_MAIN, P_BUTTON, 0, 0,
X "",
X! BBORDER + (4*(BWIDTH+BGAP)), BBORDER + (1*(BHEIGHT+BGAP)),
X BWIDTH, BHEIGHT, "undo", 0,
X (char **) NULL, 0,
X undo
X },
X
X { /* cancel button. */
X W_MAIN, P_BUTTON, 0, 0,
X "",
X***************
X*** 312,318 ****
X BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)),
X "Set search depth:",
X BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)),
X! 0, 0, "", INIT_DEPTH,
X (char **) NULL, 0,
X set_option
X },
X--- 377,383 ----
X BBORDER + (0*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)),
X "Set search depth:",
X BBORDER + (2*(BWIDTH+BGAP)), BBORDER + (2*(BHEIGHT+BGAP)),
X! 0, 0, "", 0,
X (char **) NULL, 0,
X set_option
X },
X***************
X*** 371,376 ****
X--- 436,451 ----
X (char **) NULL, 0,
X set_option
X },
X+
X+ { /* Help window page cycle. */
X+ W_HELP, P_CYCLE,
X+ BBORDER + (0*(BWIDTH+BGAP)), CGAP,
X+ "Page",
X+ BBORDER + (1*(BWIDTH+BGAP)), CGAP,
X+ 0, 0, "", 1,
X+ (char **) NULL, 0,
X+ display_help
X+ },
X } ;
X
X char geometry[MAXDPY][MAXLINE] ; /* X11 geometry information. */
X***************
X*** 378,383 ****
X--- 453,459 ----
X char *black_dpy ; /* Black piece display information. */
X char edgefile[MAXLINE] ; /* Location of the reve edge table file. */
X char gamefile[MAXLINE] ; /* Name of file for load/save. */
X+ char helpfile[MAXLINE] ; /* Location of the reve online help file. */
X char line[40] ;
X char progname[MAXLINE] ; /* The name of this program. */
X char *white_dpy ; /* White piece display information. */
X***************
X*** 405,410 ****
X--- 481,487 ----
X STRCPY(gamefile, "reve.game") ;
X SPRINTF(line, " Reve. V1.1.%1d", PATCHLEVEL) ;
X init_graphics(&argc, argv) ;
X+ reve_colorsetup(rcols, gcols, bcols) ; /* Setup default colors. */
X initialise() ; /* Initialise variables used by reve. */
X load_resources() ; /* Get resources from various places. */
X read_resources() ; /* Read resources from merged database. */
X***************
X*** 414,420 ****
X init_edge_table(edgefile) ; /* Load reve edge table values. */
X #endif /*XVIEW*/
X
X! set_display_types() ; /* Work out what displays to initialise. */
X if (init_ws_type()) /* Determine window system type. */
X {
X FPRINTF(stderr,"Error initialising window system.\n") ;
X--- 491,499 ----
X init_edge_table(edgefile) ; /* Load reve edge table values. */
X #endif /*XVIEW*/
X
X! init_help_file(helpfile) ; /* Load reve help file page offsets. */
X!
X! set_display_types() ; /* Work out what displays to initialise. */
X if (init_ws_type()) /* Determine window system type. */
X {
X FPRINTF(stderr,"Error initialising window system.\n") ;
X***************
X*** 450,458 ****
X {
X cur_dpyno = dpyno ;
X make_icon() ;
X! make_frame(argc, argv) ; /* Create reve window/icon. */
X! make_canvas() ; /* Create drawing canvas. */
X! init_fonts() ; /* Load normal and bold fonts. */
X initboard() ;
X set_cursor(CANVASCUR) ;
X }
X--- 529,538 ----
X {
X cur_dpyno = dpyno ;
X make_icon() ;
X! make_frame(argc, argv) ; /* Create reve window/icon. */
X! make_canvas() ; /* Create drawing canvas. */
X! init_fonts() ; /* Load normal and bold fonts. */
X! make_help_window(argc, argv) ; /* Make help window based on normal font. */
X initboard() ;
X set_cursor(CANVASCUR) ;
X }
X***************
X*** 521,527 ****
X getparam(next, argv, "-d needs difficulty") ;
X level = atoi(next) ;
X if (level < 1 || level > MAXDIFF) level = INIT_DEPTH ;
X! items[(int) DIFF_CHOICE].value = level - 1 ;
X break ;
X case 'e' : INC ;
X getparam(edgefile, argv, "-e needs an edgetable file") ;
X--- 601,607 ----
X getparam(next, argv, "-d needs difficulty") ;
X level = atoi(next) ;
X if (level < 1 || level > MAXDIFF) level = INIT_DEPTH ;
X! items[(int) DIFF_CHOICE].value = old_diffval = level-1 ;
X break ;
X case 'e' : INC ;
X getparam(edgefile, argv, "-e needs an edgetable file") ;
X***************
X*** 530,535 ****
X--- 610,622 ----
X getparam(geometry[0], argv,
X "-g needs geometry information") ;
X break ;
X+ case 'h' : if (EQUAL(argv[0], "-help")) help_showing = TRUE ;
X+ else
X+ {
X+ INC ;
X+ getparam(helpfile, argv, "-h needs a help file") ;
X+ }
X+ break ;
X case 'i' : inv_video = 1 ; /* Display in inverse video. */
X break ;
X case 'l' : if (EQUAL(argv[0], "-last")) DO_LAST = TRUE ;
X***************
X*** 547,552 ****
X--- 634,641 ----
X case 'n' : if (EQUAL(argv[0], "-notes")) SHOW_NOTES = TRUE ;
X else if (EQUAL(argv[0], "-number")) DO_NUMBER = TRUE ;
X break ;
X+ case 'p' : if (EQUAL(argv[0], "-props")) props_showing = TRUE ;
X+ break ;
X case 'q' : if (EQUAL(argv[0], "-quick")) QUICKGAME = TRUE ;
X break ;
X case '?' :
X***************
X*** 654,663 ****
X color_area(W_MAIN, 0, 0, TOTAL_WIDTH, TOTAL_HEIGHT, C_WHITE) ;
X if (iscolor[d])
X {
X! color_area(W_MAIN, 0, 0, TOTAL_WIDTH, CY, C_BEIGE) ;
X! color_area(W_MAIN, 0, CY, TOTAL_WIDTH, TOTAL_WIDTH, C_DBROWN) ;
X color_area(W_MAIN, 0 + BBORDER, CY + BBORDER, BOARD_SIZE * CELL_SIZE,
X! BOARD_SIZE * CELL_SIZE, C_LBROWN) ;
X }
X make_panel() ; /* Create panel and panel items. */
X
X--- 743,752 ----
X color_area(W_MAIN, 0, 0, TOTAL_WIDTH, TOTAL_HEIGHT, C_WHITE) ;
X if (iscolor[d])
X {
X! color_area(W_MAIN, 0, 0, TOTAL_WIDTH, CY, C_PANEL) ;
X! color_area(W_MAIN, 0, CY, TOTAL_WIDTH, TOTAL_WIDTH, C_BORDER) ;
X color_area(W_MAIN, 0 + BBORDER, CY + BBORDER, BOARD_SIZE * CELL_SIZE,
X! BOARD_SIZE * CELL_SIZE, C_SQUARE) ;
X }
X make_panel() ; /* Create panel and panel items. */
X
X***************
X*** 666,674 ****
X batch(IS_ON) ;
X for (n = 0; n <= BOARD_SIZE; n++)
X {
X! color = (iscolor[d]) ? C_LGREY : C_BLACK ;
X if (n == 0 || n == BOARD_SIZE) color = C_BLACK ;
X! if (color == C_LGREY) adjust = 1 ;
X else adjust = 0 ;
X draw_line(W_MAIN, (n*CELL_SIZE)+BBORDER, /* Vertical. */
X CY+BBORDER+adjust, (n*CELL_SIZE)+BBORDER,
X--- 755,763 ----
X batch(IS_ON) ;
X for (n = 0; n <= BOARD_SIZE; n++)
X {
X! color = B_COLOR(C_GRID) ;
X if (n == 0 || n == BOARD_SIZE) color = C_BLACK ;
X! if (color == C_GRID) adjust = 1 ;
X else adjust = 0 ;
X draw_line(W_MAIN, (n*CELL_SIZE)+BBORDER, /* Vertical. */
X CY+BBORDER+adjust, (n*CELL_SIZE)+BBORDER,
X***************
X*** 711,716 ****
X--- 800,808 ----
X message(TURN_MES, "Black to move.") ;
X batch(IS_OFF) ;
X
X+ if (help_showing) set_frame(W_HELP, help_showing) ;
X+ if (props_showing) set_frame(W_PROPS, props_showing) ;
X+
X if (loadgame)
X {
X loadgame = 0 ;
X***************
X*** 741,748 ****
X DO_BESTMOVE = FALSE ;
X DO_LAST = FALSE ;
X DO_NUMBER = FALSE ;
X processing = FALSE ; /* No computer move initially. */
X! props_showing = FALSE ;
X QUICKGAME = FALSE ;
X validkey = 0 ;
X cmode = BLACK_START ;
X--- 833,841 ----
X DO_BESTMOVE = FALSE ;
X DO_LAST = FALSE ;
X DO_NUMBER = FALSE ;
X+ help_showing = FALSE ; /* Help window not visible. */
X processing = FALSE ; /* No computer move initially. */
X! props_showing = FALSE ; /* Properties window not visible. */
X QUICKGAME = FALSE ;
X validkey = 0 ;
X cmode = BLACK_START ;
X***************
X*** 751,757 ****
X isblack = 0 ;
X iswhite = 0 ;
X level = INIT_DEPTH ;
X! items[(int) DIFF_CHOICE].value = level - 1 ;
X
X black_dpy = NULL ; /* X11 black piece display information. */
X white_dpy = NULL ; /* X11 white piece display information. */
X--- 844,850 ----
X isblack = 0 ;
X iswhite = 0 ;
X level = INIT_DEPTH ;
X! items[(int) DIFF_CHOICE].value = old_diffval = level - 1 ;
X
X black_dpy = NULL ; /* X11 black piece display information. */
X white_dpy = NULL ; /* X11 white piece display information. */
X***************
X*** 758,763 ****
X--- 851,857 ----
X STRCPY(geometry[(int) DPY1], "") ; /* X11 geometry information. */
X STRCPY(geometry[(int) DPY2], "") ;
X STRCPY(edgefile, EDGENAME) ;
X+ STRCPY(helpfile, HELPNAME) ;
X }
X
X
X***************
X*** 765,770 ****
X--- 859,865 ----
X read_resources() /* Read all possible resources from database. */
X {
X int boolval, intval ;
X+ char str[MAXLINE] ;
X
X if (get_bool_resource(R_ANIMATE, &boolval)) ANIMATION = boolval ;
X if (get_bool_resource(R_BESTMOVE, &boolval)) DO_BESTMOVE = boolval ;
X***************
X*** 773,779 ****
X {
X level = intval ;
X if (level < 1 || level > MAXDIFF) level = INIT_DEPTH ;
X! items[(int) DIFF_CHOICE].value = level - 1 ;
X }
X
X if (get_bool_resource(R_LAST, &boolval)) DO_LAST = boolval ;
X--- 868,874 ----
X {
X level = intval ;
X if (level < 1 || level > MAXDIFF) level = INIT_DEPTH ;
X! items[(int) DIFF_CHOICE].value = old_diffval = level - 1 ;
X }
X
X if (get_bool_resource(R_LAST, &boolval)) DO_LAST = boolval ;
X***************
X*** 781,789 ****
X--- 876,907 ----
X if (get_bool_resource(R_NOTES, &boolval)) SHOW_NOTES = boolval ;
X if (get_bool_resource(R_NUMBER, &boolval)) DO_NUMBER = boolval ;
X if (get_bool_resource(R_QUICK, &boolval)) QUICKGAME = boolval ;
X+ if (get_bool_resource(R_PROPS, &boolval)) props_showing = boolval ;
X+ if (get_bool_resource(R_HELP, &boolval)) help_showing = boolval ;
X+
X+ if (get_str_resource(R_PANELC, str)) read_str(&colstr[C_PANEL], str) ;
X+ if (get_str_resource(R_BOARDC, str)) read_str(&colstr[C_SQUARE], str) ;
X+ if (get_str_resource(R_BOARDBC, str)) read_str(&colstr[C_BORDER], str) ;
X+ if (get_str_resource(R_GRIDC, str)) read_str(&colstr[C_GRID], str) ;
X+ if (get_str_resource(R_TEXTC, str)) read_str(&colstr[C_TEXT], str) ;
X+ if (get_str_resource(R_ITEMC, str)) read_str(&colstr[C_ITEMS], str) ;
X }
X
X
X+ void
X+ read_str(str, value)
X+ char **str, *value ;
X+ {
X+ if (*str != NULL) (void) free(*str) ;
X+ if (value != NULL && strlen(value))
X+ {
X+ *str = (char *) malloc((unsigned) (strlen(value) + 1)) ;
X+ STRCPY(*str, value) ;
X+ }
X+ else *str = NULL ;
X+ }
X+
X+
X /* Setup the display information for the black and white displays.
X * There are a fair number of combinations allowed. This table hopefully
X * gives the setup information for each combination.
X***************
X*** 875,883 ****
X FPRINTF(stderr, "%s version 1.1.%1d\n\n", progname, PATCHLEVEL) ;
X FPRINTF(stderr, "Usage: %s: [-animate] [-bestmove]\n", progname) ;
X FPRINTF(stderr, "\t[-black [display] ] [-c] [-d difficulty]\n") ;
X! FPRINTF(stderr, "\t[-e edgefile] [-g geometry] [-last]\n") ;
X! FPRINTF(stderr, "\t[-load gamefile] [-number] [-notes] [-v]\n") ;
X! FPRINTF(stderr, "\t[-w [display] ] [-?] [-Wi] [-Wp x y] [-WP x y]\n") ;
X }
X
X
X--- 993,1002 ----
X FPRINTF(stderr, "%s version 1.1.%1d\n\n", progname, PATCHLEVEL) ;
X FPRINTF(stderr, "Usage: %s: [-animate] [-bestmove]\n", progname) ;
X FPRINTF(stderr, "\t[-black [display] ] [-c] [-d difficulty]\n") ;
X! FPRINTF(stderr, "\t[-e edgefile] [-g geometry] [-h helpfile] [-help]\n") ;
X! FPRINTF(stderr, "\t[-i] [-last] [-load gamefile] [-log] [-m] [-number]\n") ;
X! FPRINTF(stderr, "\t[-notes] [-props] [-quick] [-v] [-w [display] ]\n") ;
X! FPRINTF(stderr, "\t[-?] [-Wi] [-Wp x y] [-WP x y]\n") ;
X }
X
X
X
X------- procs.c -------
X*** /tmp/da06888 Tue Dec 18 10:10:25 1990
X--- procs.c Mon Dec 17 10:32:34 1990
X***************
X*** 29,39 ****
X
X
X void
X do_props()
X {
X props_showing = !props_showing ;
X! if (props_showing == TRUE) open_frame(W_PROPS) ;
X! else close_frame(W_PROPS) ;
X }
X
X
X--- 29,78 ----
X
X
X void
X+ display_help()
X+ {
X+ char str[4] ;
X+ int val ;
X+
X+ val = items[itemno].value ;
X+ if (direction == INCREMENT && help_offsets[++val] != -1)
X+ items[itemno].value++ ;
X+ else if (direction == DECREMENT && help_offsets[--val] != -1)
X+ items[itemno].value-- ;
X+ else return ;
X+ SPRINTF(str, "%d", items[itemno].value) ;
X+ set_cycle(W_HELP, HELP_PAGE, str) ;
X+ paint_help_text() ;
X+ }
X+
X+
X+ void
X+ do_edit()
X+ {
X+ message(PANEL_MES, "Not currently implemented.") ;
X+ }
X+
X+
X+ void
X+ do_help()
X+ {
X+ help_showing = !help_showing ;
X+ set_frame(W_HELP, help_showing) ;
X+ }
X+
X+
X+ void
X+ do_stop()
X+ {
X+ message(PANEL_MES, "Not currently implemented.") ;
X+ }
X+
X+
X+ void
X do_props()
X {
X props_showing = !props_showing ;
X! set_frame(W_PROPS, props_showing) ;
X }
X
X
X***************
X*** 81,89 ****
X
X suggest_x = BBORDER + ((suggestion & 7) + 1) * CELL_SIZE - CELL_SIZE / 2 ;
X suggest_y = BBORDER + ((suggestion >> 3) + 1) * CELL_SIZE - CELL_SIZE / 2 ;
X! if (state == IS_OFF)
X! color = (iscolor[(int) cur_dpyno]) ? C_LBROWN : C_WHITE ;
X! else color = C_BLACK ;
X
X draw_line(W_MAIN, suggest_x-5, CY+suggest_y-5,
X suggest_x+5, CY+suggest_y+5, RSRC, color) ;
X--- 120,127 ----
X
X suggest_x = BBORDER + ((suggestion & 7) + 1) * CELL_SIZE - CELL_SIZE / 2 ;
X suggest_y = BBORDER + ((suggestion >> 3) + 1) * CELL_SIZE - CELL_SIZE / 2 ;
X! if (state == IS_OFF) color = W_COLOR(C_SQUARE) ;
X! else color = C_BLACK ;
X
X draw_line(W_MAIN, suggest_x-5, CY+suggest_y-5,
X suggest_x+5, CY+suggest_y+5, RSRC, color) ;
X***************
X*** 94,99 ****
X--- 132,161 ----
X
X
X void
X+ init_help_file(helpfile) /* Load reve help page offsets. */
X+ char *helpfile ;
X+ {
X+ char buf[MAXLINE] ;
X+ int i, page ;
X+ long offset ;
X+
X+ for (i = 0; i < MAXPAGES; i++) help_offsets[i] = -1 ;
X+ if ((hfp = find_file(helpfile)) == NULL)
X+ {
X+ FPRINTF(stderr, "Cannot open online help file\n") ;
X+ return ;
X+ }
X+ page = 1 ;
X+ for (;;)
X+ {
X+ offset = ftell(hfp) ;
X+ if (fgets(buf, MAXLINE, hfp) == NULL) return ;
X+ if (EQUAL(buf, "REVE(6)")) help_offsets[page++] = offset ;
X+ }
X+ }
X+
X+
X+ void
X make_move()
X {
X if (legal(move, next_player, &board) == FALSE)
X***************
X*** 129,135 ****
X init_canvas() ;
X message(EVAL_MES, "") ;
X message(PANEL_MES, "Use left mouse button to move") ;
X! draw_button(W_MAIN, NEW_GAME_BUT, C_LGREY, BUT_NORMAL) ;
X }
X
X
X--- 191,197 ----
X init_canvas() ;
X message(EVAL_MES, "") ;
X message(PANEL_MES, "Use left mouse button to move") ;
X! draw_button(W_MAIN, NEW_GAME_BUT, C_ITEMS, BUT_NORMAL) ;
X }
X
X
X***************
X*** 142,151 ****
X
X
X void
X set_computer(val)
X int val ;
X {
X! int color, curi ;
X
X if (val == CP_WHITE)
X {
X--- 204,294 ----
X
X
X void
X+ redo()
X+ {
X+ enum panel_type p ;
X+
X+ /* The amount we redo is dependant upon two things:
X+ *
X+ * 1/ Whether the opponent is the computer, in which case we redo
X+ * two "moves". Otherwise we just redo one "move".
X+ *
X+ * 2/ A "move" is considered to be all consecutive moves by the opponent.
X+ */
X+
X+ redo_move(next_player) ;
X+ p = (next_player == BLACK) ? BLACK_PLAYS : WHITE_PLAYS ;
X+ if (items[(int) p].value == COMPUTER) redo_move(next_player) ;
X+
X+ set_score() ;
X+ set_turn(next_player) ;
X+ }
X+
X+
X+ void
X+ redo_move(player)
X+ int player ;
X+ {
X+ int i, limit, n, x, y ;
X+
X+ n = 63 - board.moves_left ;
X+ while (moves[n].move != -1 && moves[n].player != player) n++ ;
X+
X+ if (moves[n].move == -1 || n > 63) message(PANEL_MES, "No moves to redo.") ;
X+ else
X+ {
X+ if (DO_LAST) show_last(last_move, IS_OFF) ;
X+ if (DO_NUMBER) show_number(last_move, 60 - board.moves_left, IS_OFF) ;
X+ do_suggest(player, suggestion, note, IS_OFF) ;
X+ FOR_BOARD(i)
X+ {
X+ if (moves[n].square[i] != board.square[i])
X+ {
X+ get_xy(i, &x, &y) ;
X+ if (moves[n].square[i] == FREE)
X+ color_area(W_MAIN, x, CY+y, PSIZE, PSIZE, W_COLOR(C_SQUARE)) ;
X+ else draw_piece(moves[n].square[i], x, CY+y, RSRC) ;
X+ }
X+ board.square[i] = moves[n].square[i] ;
X+ }
X+ board.moves_left = moves[n].moves_left ;
X+ board.player = moves[n].player ;
X+ board.move = moves[n].move ;
X+ board.note = moves[n].note ;
X+ board.timeleft = moves[n].timeleft ;
X+ last_move = board.move ;
X+
X+ FOR_BOARD(i) old_board.square[i] = moves[n-1].square[i] ;
X+ old_board.moves_left = moves[n-1].moves_left ;
X+ old_board.player = moves[n-1].player ;
X+ old_board.move = moves[n-1].move ;
X+ old_board.note = moves[n-1].note ;
X+ old_board.timeleft = moves[n-1].timeleft ;
X+
X+ timeleft = board.timeleft ;
X+
X+ #ifdef XVIEW
X+ reset_time(timeleft) ;
X+ #endif /*XVIEW*/
X+
X+ if (OPPONENT(player) == BLACK) cmode = BLACK_START ;
X+ else cmode = WHITE_START ;
X+ message(PANEL_MES, "") ;
X+
X+ if (DO_LAST) show_last(last_move, IS_ON) ;
X+ if (DO_NUMBER) show_number(last_move, 60 - board.moves_left, IS_ON) ;
X+ if (SHOW_NOTES) set_eval(board.player, board.move, board.note) ;
X+ else message(EVAL_MES, "") ;
X+ next_player = OPPONENT(board.player) ;
X+ }
X+ }
X+
X+
X+ void
X set_computer(val)
X int val ;
X {
X! int curi ;
X
X if (val == CP_WHITE)
X {
X***************
X*** 175,182 ****
X STRCPY(items[(int) WHITE_PLAYS].text, player_values[HUMAN]) ;
X }
X
X! color = (iscolor[(int) cur_dpyno]) ? C_BEIGE : C_WHITE ;
X! draw_choice(W_PROPS, COMP_CHOICE, color) ;
X
X val = items[(int) BLACK_PLAYS].value ;
X val = items[(int) WHITE_PLAYS].value ;
X--- 318,326 ----
X STRCPY(items[(int) WHITE_PLAYS].text, player_values[HUMAN]) ;
X }
X
X! draw_choice(W_PROPS, COMP_CHOICE, W_COLOR(C_PANEL)) ;
X! make_message(W_MAIN, BLACK_PLAYS) ;
X! make_message(W_MAIN, WHITE_PLAYS) ;
X
X val = items[(int) BLACK_PLAYS].value ;
X val = items[(int) WHITE_PLAYS].value ;
X***************
X*** 194,202 ****
X set_option()
X {
X char str[4] ;
X! int color, d, maxw, n, val ;
X
X- d = (int) cur_dpyno ;
X switch (itemno)
X {
X case COMP_CHOICE : maxw = items[itemno].width / items[itemno].nopts ;
X--- 338,345 ----
X set_option()
X {
X char str[4] ;
X! int maxw, n, val ;
X
X switch (itemno)
X {
X case COMP_CHOICE : maxw = items[itemno].width / items[itemno].nopts ;
X***************
X*** 214,233 ****
X val = (curx - items[itemno].x) / maxw ;
X level = val + 1 ;
X items[itemno].value = val ;
X! color = (iscolor[d]) ? C_BEIGE : C_WHITE ;
X! draw_choice(W_PROPS, DIFF_CHOICE, color) ;
X break ;
X
X case MAX_DEPTH : val = items[itemno].value ;
X if (direction == INCREMENT && val < MAX_PROFMAX)
X items[itemno].value++ ;
X! else if (direction == DECREMENT && val > INIT_DEPTH)
X items[itemno].value-- ;
X! SPRINTF(str, "%d", items[itemno].value) ;
X! color = (iscolor[d]) ? C_LGREY : C_WHITE ;
X set_cycle(W_PROPS, MAX_DEPTH, str) ;
X! profmax = items[itemno].value ;
X! level = 1 ;
X break ;
X
X case OPT_ANIM : ANIMATION = !ANIMATION ;
X--- 357,390 ----
X val = (curx - items[itemno].x) / maxw ;
X level = val + 1 ;
X items[itemno].value = val ;
X! draw_choice(W_PROPS, DIFF_CHOICE, W_COLOR(C_PANEL)) ;
X!
X! items[(int) MAX_DEPTH].value = 0 ;
X! set_cycle(W_PROPS, MAX_DEPTH, "off") ;
X break ;
X
X case MAX_DEPTH : val = items[itemno].value ;
X if (direction == INCREMENT && val < MAX_PROFMAX)
X items[itemno].value++ ;
X! else if (direction == DECREMENT && val > 0)
X items[itemno].value-- ;
X! if (!items[(int) itemno].value) STRCPY(str, "off") ;
X! else SPRINTF(str, "%d", items[itemno].value) ;
X set_cycle(W_PROPS, MAX_DEPTH, str) ;
X!
X! if (items[itemno].value)
X! {
X! items[(int) DIFF_CHOICE].value = -1 ;
X! level = 1 ;
X! max_depth = items[itemno].value ;
X! }
X! else
X! {
X! items[(int) DIFF_CHOICE].value = old_diffval ;
X! level = old_diffval + 1 ;
X! max_depth = 2 ;
X! }
X! draw_choice(W_PROPS, DIFF_CHOICE, W_COLOR(C_PANEL)) ;
X break ;
X
X case OPT_ANIM : ANIMATION = !ANIMATION ;
X***************
X*** 247,254 ****
X
X case OPT_NUM : DO_NUMBER = !DO_NUMBER ;
X n = 63 - board.moves_left ;
X! show_number(moves[n].move, 60 - board.moves_left,
X! DO_NUMBER, DO_NUMBER) ;
X break ;
X
X case OPT_FLIP : QUICKGAME = !QUICKGAME ;
X--- 404,412 ----
X
X case OPT_NUM : DO_NUMBER = !DO_NUMBER ;
X n = 63 - board.moves_left ;
X! if (board.moves_left < 60)
X! show_number(moves[n].move, 60 - board.moves_left,
X! DO_NUMBER) ;
X break ;
X
X case OPT_FLIP : QUICKGAME = !QUICKGAME ;
X***************
X*** 306,311 ****
X--- 464,470 ----
X }
X
X
X+ void
X undo_move(player)
X int player ;
X {
X***************
X*** 326,333 ****
X {
X get_xy(i, &x, &y) ;
X if (moves[n].square[i] == FREE)
X! color_area(W_MAIN, x, CY+y, PSIZE, PSIZE,
X! (iscolor[(int) cur_dpyno]) ? C_LBROWN : C_WHITE) ;
X else draw_piece(moves[n].square[i], x, CY+y, RSRC) ;
X }
X board.square[i] = moves[n].square[i] ;
X--- 485,491 ----
X {
X get_xy(i, &x, &y) ;
X if (moves[n].square[i] == FREE)
X! color_area(W_MAIN, x, CY+y, PSIZE, PSIZE, W_COLOR(C_SQUARE)) ;
X else draw_piece(moves[n].square[i], x, CY+y, RSRC) ;
X }
X board.square[i] = moves[n].square[i] ;
X***************
X*** 338,344 ****
X board.note = moves[n].note ;
X board.timeleft = moves[n].timeleft ;
X last_move = board.move ;
X- moves[n+1].move = -1 ;
X
X FOR_BOARD(i) old_board.square[i] = moves[n-1].square[i] ;
X old_board.moves_left = moves[n-1].moves_left ;
X--- 496,501 ----
X
X
END_OF_FILE
if test 46589 -ne `wc -c <'patches04d'`; then
echo shar: \"'patches04d'\" unpacked with wrong size!
fi
# end of 'patches04d'
fi
echo shar: End of archive 4 \(of 4\).
cp /dev/null ark4isdone
MISSING=""
for I in 1 2 3 4 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 4 archives.
rm -f ark[1-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0