v12i002: kriegspiel - a chess variant, Patch1, Part01/01
Steve Schoch
schoch at trident.arc.nasa.gov
Sat Mar 2 19:23:35 AEST 1991
Submitted-by: schoch at trident.arc.nasa.gov (Steve Schoch)
Posting-number: Volume 12, Issue 2
Archive-name: kriegspiel/patch1
Patch-To: kriegspiel: Volume 11, Issue 56-58
*** patchlevel.h.old Mon Feb 25 10:57:22 1991
--- patchlevel.h Thu Feb 14 07:52:59 1991
***************
*** 0 ****
--- 1 ----
+ #define PATCHLEVEL 1
*** doesc.c.old Thu May 5 10:21:46 1988
--- doesc.c Wed Feb 13 17:12:40 1991
***************
*** 1,10 ****
#include <stdio.h>
- #include <curses.h>
#include <strings.h>
#include "constants.h"
static char buf[32];
! static char *cp;
doesc(c)
{
--- 1,13 ----
#include <stdio.h>
#include <strings.h>
#include "constants.h"
+ /* Termcap strings */
+ char *ks, *ke, *ku, *kd, *kl, *kr, *kh;
+ extern char *tgetstr();
+
static char buf[32];
! static char *cp = buf;
doesc(c)
{
***************
*** 13,34 ****
do {
*cp++ = c;
*cp = '\0';
! if (KU && strcmp(buf, KU) == 0)
value = K_UP;
! if (KD && strcmp(buf, KD) == 0)
value = K_DOWN;
! if (KL && strcmp(buf, KL) == 0)
value = K_LEFT;
! if (KR && strcmp(buf, KR) == 0)
value = K_RIGHT;
! if (KH && strcmp(buf, KH) == 0)
value = K_HOME;
if (value)
cp = &buf[1];
! if (cp - buf > sizeof buf - 1)
! if (cp = index(buf+1, '\033')) {
register char *ocp = buf;
while (*ocp++ = *cp++)
--- 16,37 ----
do {
*cp++ = c;
*cp = '\0';
! if (ku && strcmp(buf, ku) == 0)
value = K_UP;
! if (kd && strcmp(buf, kd) == 0)
value = K_DOWN;
! if (kl && strcmp(buf, kl) == 0)
value = K_LEFT;
! if (kr && strcmp(buf, kr) == 0)
value = K_RIGHT;
! if (kh && strcmp(buf, kh) == 0)
value = K_HOME;
if (value)
cp = &buf[1];
! if (cp >= &buf[sizeof buf - 1])
! if (cp = rindex(buf+1, '\033')) {
register char *ocp = buf;
while (*ocp++ = *cp++)
***************
*** 38,43 ****
--- 41,47 ----
cp = &buf[1];
if (value)
return value;
+
c = 0;
if (stdin->_cnt)
c = getchar();
***************
*** 47,54 ****
initesc()
{
! if (KS) {
! fputs(KS, stdout);
fflush(stdout);
}
--- 51,69 ----
initesc()
{
! static char tcbuf[256];
! auto char *tbp = tcbuf;
!
! ks = tgetstr("ks", &tbp);
! ke = tgetstr("ke", &tbp);
! ku = tgetstr("ku", &tbp);
! kd = tgetstr("kd", &tbp);
! kr = tgetstr("kr", &tbp);
! kl = tgetstr("kl", &tbp);
! kh = tgetstr("kh", &tbp);
!
! if (ks) {
! fputs(ks, stdout);
fflush(stdout);
}
*** /tmp/,RCSt1025441 Fri Feb 22 16:58:21 1991
--- move.c Thu Feb 14 16:55:15 1991
***************
*** 19,24
}
fprintf(out, "%1c%1d-%1c%1d\r\n", from%10-1+'a', 9-from/10,
to%10-1+'a', 9-to/10);
if (movetry(from, to, ourcolor))
return;
}
--- 19,25 -----
}
fprintf(out, "%1c%1d-%1c%1d\r\n", from%10-1+'a', 9-from/10,
to%10-1+'a', 9-to/10);
+ fflush(out);
if (movetry(from, to, ourcolor))
return;
}
*** /tmp/,RCSt1025498 Fri Feb 22 17:00:24 1991
--- movetry.c Thu Feb 14 17:03:57 1991
***************
*** 102,108
if (drawok[1 - color]) {
message("Draw offered.\n", LEGAL);
if (color == ourcolor)
! message("Type y or n.\n", TOMOVE);
else
mclear(TOMOVE);
} else {
--- 102,109 -----
if (drawok[1 - color]) {
message("Draw offered.\n", LEGAL);
if (color == ourcolor)
! message(xks ? "Press yes or no\n" :
! "Type y or n.\n", TOMOVE);
else
mclear(TOMOVE);
} else {
*** /tmp/,RCSt1025521 Fri Feb 22 17:01:17 1991
--- options.c Thu Feb 14 16:45:01 1991
***************
*** 22,28
*cp = '\0';
if (cp = index(optbuf, '\r'))
*cp = '\0';
! for (i = 0; optbuf[i]; i++)
if (optbuf[i] >= '0' && optbuf[i] <= '9')
nopts[i] = optbuf[i] - '0';
else
--- 22,28 -----
*cp = '\0';
if (cp = index(optbuf, '\r'))
*cp = '\0';
! for (i = 0; optbuf[i] && i < NOPTIONS; i++)
if (optbuf[i] >= '0' && optbuf[i] <= '9')
nopts[i] = optbuf[i] - '0';
else
***************
*** 46,51
optbuf[i] = nopts[i] + '0';
optbuf[i] = '\0';
fprintf(out, "%s\r\n", optbuf);
} else {
for (i = 0; i < NOPTIONS; i++)
nopts[i] = option [i];
--- 46,52 -----
optbuf[i] = nopts[i] + '0';
optbuf[i] = '\0';
fprintf(out, "%s\r\n", optbuf);
+ fflush(out);
} else {
for (i = 0; i < NOPTIONS; i++)
nopts[i] = option [i];
***************
*** 55,60
optbuf[i] = nopts[i] + '0';
optbuf[i] = '\0';
fprintf(out, "%s\r\n", optbuf);
if (fgets(optbuf, sizeof optbuf, inp) == NULL)
if (errno != EINTR)
error ("recv in dooptions");
--- 56,62 -----
optbuf[i] = nopts[i] + '0';
optbuf[i] = '\0';
fprintf(out, "%s\r\n", optbuf);
+ fflush(out);
if (fgets(optbuf, sizeof optbuf, inp) == NULL)
if (errno != EINTR)
error ("recv in dooptions");
***************
*** 62,68
*cp = '\0';
if (cp = index(optbuf, '\r'))
*cp = '\0';
! for (i = 0; optbuf[i]; i++)
option[i] = optbuf[i] - '0';
option [COLOR] = !(optbuf[COLOR]-'0');
}
--- 64,70 -----
*cp = '\0';
if (cp = index(optbuf, '\r'))
*cp = '\0';
! for (i = 0; optbuf[i] && i < NOPTIONS; i++)
option[i] = optbuf[i] - '0';
option [COLOR] = !(optbuf[COLOR]-'0');
}
*** /tmp/,RCSt1025582 Fri Feb 22 17:04:12 1991
--- review.c Thu Feb 14 13:41:20 1991
***************
*** 6,12
#define STEPTIME 3*1000 /* time between moves */
#define MINSTEPTIME 100 /* 1/10 second */
! static void make_next_move();
static long steptime;
static MOVELIST m;
--- 6,12 -----
#define STEPTIME 3*1000 /* time between moves */
#define MINSTEPTIME 100 /* 1/10 second */
! void make_next_move();
static long steptime;
static MOVELIST m;
*** /tmp/,RCSt1025616 Fri Feb 22 17:05:27 1991
--- screen.c Thu Feb 14 16:56:38 1991
***************
*** 270,273
;
cp++;
fprintf(out, "say %s\r\n", cp);
}
--- 270,274 -----
;
cp++;
fprintf(out, "say %s\r\n", cp);
+ fflush(out);
}
*** /tmp/,RCSt1025635 Fri Feb 22 17:06:08 1991
--- traps.c Thu Feb 14 16:58:22 1991
***************
*** 33,39
c = getchar();
}
if (c == 'y') {
! if (out)
fputs("resign\r\n", out);
error ((char *) NULL);
}
--- 33,39 -----
c = getchar();
}
if (c == 'y') {
! if (out) {
fputs("resign\r\n", out);
fflush(out);
}
***************
*** 35,40
if (c == 'y') {
if (out)
fputs("resign\r\n", out);
error ((char *) NULL);
}
overwrite (backupscreen, stdscr);
--- 35,42 -----
if (c == 'y') {
if (out) {
fputs("resign\r\n", out);
+ fflush(out);
+ }
error ((char *) NULL);
}
overwrite (backupscreen, stdscr);
*** /tmp/,RCSt1006545 Mon Feb 25 10:40:50 1991
--- xmain.c Mon Feb 25 10:31:39 1991
***************
*** 31,36
int lastmoveto = 0;
MOVELIST movelist = (MOVELIST)NULL;
extern int sock;
long random();
--- 31,37 -----
int lastmoveto = 0;
MOVELIST movelist = (MOVELIST)NULL;
extern int sock;
+ Widget topLevel;
long random();
***************
*** 61,67
int i;
u_short port=0;
char *cp;
- Widget toplevel;
if (cp = rindex(argv[0], '/'))
cp++;
--- 62,67 -----
int i;
u_short port=0;
char *cp;
if (cp = rindex(argv[0], '/'))
cp++;
***************
*** 68,75
else
cp = argv[0];
srandom(time(0) ^ getpid());
! toplevel = XtAppInitialize(&my_app, "XKs",
! optionDescList, XtNumber(optionDescList), &argc, argv, NULL, NULL, 0);
argv++; argc--;
if (argc != 1) {
--- 68,76 -----
else
cp = argv[0];
srandom(time(0) ^ getpid());
! topLevel = XtAppInitialize(&my_app, "XKs",
! optionDescList, XtNumber(optionDescList), &argc, argv,
! NULL, NULL, 0);
argv++; argc--;
if (argc != 1) {
***************
*** 78,84
exit(1);
}
! initwidgets(toplevel);
XtRealizeWidget(toplevel);
initdirlists();
--- 79,85 -----
exit(1);
}
! initwidgets(topLevel);
XtRealizeWidget(topLevel);
p_init();
***************
*** 80,86
initwidgets(toplevel);
! XtRealizeWidget(toplevel);
initdirlists();
initpiecelocs();
screen_init();
--- 81,88 -----
initwidgets(topLevel);
! XtRealizeWidget(topLevel);
! p_init();
initdirlists();
initpiecelocs();
screen_init();
***************
*** 84,90
initdirlists();
initpiecelocs();
screen_init();
- p_init();
message("Connecting...", MESSAGE);
start_conn(*argv, port);
XtAppMainLoop(my_app);
--- 86,91 -----
initdirlists();
initpiecelocs();
screen_init();
message("Connecting...", MESSAGE);
start_conn(*argv, port);
XtAppMainLoop(my_app);
*** /tmp/,RCSt1006603 Mon Feb 25 10:43:10 1991
--- xpieces.c Fri Feb 22 16:32:14 1991
***************
*** 3,8
#endif
#include "externs.h"
#define piece_width 64
#define piece_height 64
--- 3,9 -----
#endif
#include "externs.h"
+ #include <X11/Shell.h>
#define piece_width 64
#define piece_height 64
***************
*** 21,26
#include "icon.h"
GC black_gc, white_gc, move_gc;
/* Must be in correct order! */
static char *bitmaps[] = {
--- 22,28 -----
#include "icon.h"
GC black_gc, white_gc, move_gc;
+ extern Widget topLevel;
/* Must be in correct order! */
static char *bitmaps[] = {
***************
*** 72,77
bm++;
}
#ifdef notdef
iconwindow = XCreateWindow(RootWindow, 0, 0,
icon_width, icon_height, 0, 0, 0);
--- 74,82 -----
bm++;
}
+ pm = XCreateBitmapFromData(XtDisplay(topLevel), XtWindow(topLevel),
+ icon_bits, icon_width, icon_height);
+ XtVaSetValues(topLevel, XtNiconPixmap, pm, NULL);
#ifdef notdef
iconwindow = XCreateWindow(DefaultRootWindow(XtDisplay(topLevel)), 0, 0,
icon_width, icon_height, 0, 0, 0);
***************
*** 73,79
}
#ifdef notdef
! iconwindow = XCreateWindow(RootWindow, 0, 0,
icon_width, icon_height, 0, 0, 0);
XSetIconWindow(window, iconwindow);
--- 78,84 -----
icon_bits, icon_width, icon_height);
XtVaSetValues(topLevel, XtNiconPixmap, pm, NULL);
#ifdef notdef
! iconwindow = XCreateWindow(DefaultRootWindow(XtDisplay(topLevel)), 0, 0,
icon_width, icon_height, 0, 0, 0);
XtVaSetValues(topLevel, XtNiconWindow, iconwindow, NULL);
***************
*** 76,83
iconwindow = XCreateWindow(RootWindow, 0, 0,
icon_width, icon_height, 0, 0, 0);
! XSetIconWindow(window, iconwindow);
! XSelectInput(iconwindow, ExposeWindow);
#endif
}
--- 81,88 -----
iconwindow = XCreateWindow(DefaultRootWindow(XtDisplay(topLevel)), 0, 0,
icon_width, icon_height, 0, 0, 0);
! XtVaSetValues(topLevel, XtNiconWindow, iconwindow, NULL);
! XSelectInput(iconwindow, ExposureMask);
#endif
}
More information about the Comp.sources.x
mailing list