Return-Path: pachydq
Delivery-Date: Thu Aug 16 21:01:58 PDT 
Delivery-Date: Mon, 07 May 2001 21:10:54 -0700
Return-Path: scott@wannabe.guru.org
Received: by src-mail.pa.dec.com; id VAA05853; Mon, 7 May 2001 21:10:54 -0700 (PDT)
Received: from exchou-gh02.cca.cpqcorp.net by pobox1.pa.dec.com (5.65v3.2/1.1.10.5/07Nov97-1157AM)
	id AA23630; Mon, 7 May 2001 21:10:53 -0700
Received: by exchou-gh02.cca.cpqcorp.net with Internet Mail Service (5.5.2652.78)
	id <KC4R99YN>; Mon, 7 May 2001 23:10:52 -0500
Received: from zmamail02.zma.compaq.com (zmamail02.nz-tay.cpqcorp.net [161.114.72.102]) by exchou-gh02.cca.cpqcorp.net with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2652.78)
	id KC4R99YK; Mon, 7 May 2001 23:10:48 -0500
Received: by zmamail02.zma.compaq.com (Postfix, from userid 12345)
	id A94B654E3; Tue,  8 May 2001 00:10:47 -0400 (EDT)
Received: from www.medsp.com (wannabe.guru.org [209.203.250.44])
	by zmamail02.zma.compaq.com (Postfix) with ESMTP id 8193E22A9
	for <tim.mann@compaq.com>; Tue,  8 May 2001 00:10:46 -0400 (EDT)
Received: from sgaschhome (scott.lan [10.0.0.100])
	by www.medsp.com (8.11.1/8.9.3) with SMTP id f4848ob99228
	for <tim.mann@compaq.com>; Mon, 7 May 2001 21:08:50 -0700 (PDT)
	(envelope-from scott@wannabe.guru.org)
Reply-To: <scott@wannabe.guru.org>
From: "Scott Gasch" <scott@wannabe.guru.org>
To: <tim.mann@compaq.com>
Subject: xboard patch
Date: Mon, 7 May 2001 21:08:37 -0700
Message-Id: <HNEBLCFIAIOENBOEFDACCEAGCAAA.scott@wannabe.guru.org>
Mime-Version: 1.0
Content-Type: multipart/mixed;
	boundary="----=_NextPart_000_0000_01C0D739.E2D82E20"
X-Priority: 3 (Normal)
X-Msmail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0)
Importance: Normal
X-Mimeole: Produced By Microsoft MimeOLE V5.50.4133.2400
Status:   

This is a multi-part message in MIME format.

------=_NextPart_000_0000_01C0D739.E2D82E20
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Hi Timm,

Here's (very) simple patch to the xboard 4.2.3 sources that gets rid of what
I think is a bad feature in it.  With the new ping-pong stuff in the
protocol, xboard says something like "Oops I'm not quite ready for another
game yet." as I'm sure you're aware.

Anyway, I added a hack to make it go ahead and accept the pending challenge
on the pong reciept.  This doesn't screw up any of the N-in-a-row checking
or single opponent checking.

I didn't put a lot of thought into this and just threw it together... but
its more the idea I wanted to send you and not so much the code... code is
trivial if unelegant.

Thanks for xboard.

Scott


------=_NextPart_000_0000_01C0D739.E2D82E20
Content-Type: application/octet-stream;
	name="xboard.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="xboard.patch"

Only in myxboard: Makefile=0A=
diff -ru xboard-4.2.3/backend.c myxboard/backend.c=0A=
--- xboard-4.2.3/backend.c	Mon Feb 19 20:02:23 2001=0A=
+++ myxboard/backend.c	Tue May  1 16:41:09 2001=0A=
@@ -202,6 +202,8 @@=0A=
 void InitBackEnd3 P((void));=0A=
 =0A=
 extern int tinyLayout, smallLayout;=0A=
+extern char g_szPendingChallenger[256];=0A=
+extern int g_fPendingChallenge;=0A=
 static ChessProgramStats programStats;=0A=
 =0A=
 /* States for ics_getting_history */=0A=
@@ -3942,7 +3944,22 @@=0A=
       ParseFeatures(message+8, cps);=0A=
     }=0A=
     if (sscanf(message, "pong %d", &cps->lastPong) =3D=3D 1) {=0A=
-      return;=0A=
+#ifdef ZIPPY=0A=
+        if ((cps->lastPong =3D=3D cps->lastPing) &&=0A=
+            (g_fPendingChallenge =3D=3D 1) &&=0A=
+            (appData.zippyPlay))=0A=
+        {=0A=
+            sprintf(buf1, "%saccept %s\n", ics_prefix, =0A=
+                    g_szPendingChallenger);=0A=
+            SendToICS(buf1);=0A=
+            g_fPendingChallenge =3D 0;=0A=
+            if (appData.zippyTalk) =0A=
+            {=0A=
+                Speak("tell", g_szPendingChallenger);=0A=
+            }=0A=
+        }=0A=
+#endif=0A=
+        return;=0A=
     }=0A=
     /*=0A=
      * If the move is illegal, cancel it and redraw the board.=0A=
diff -ru xboard-4.2.3/zippy.c myxboard/zippy.c=0A=
--- xboard-4.2.3/zippy.c	Mon Feb 19 20:03:10 2001=0A=
+++ myxboard/zippy.c	Tue May  1 20:49:22 2001=0A=
@@ -92,6 +92,8 @@=0A=
 static char zippyLastOpp[MSG_SIZ];=0A=
 static int zippyConsecGames;=0A=
 static time_t zippyLastGameEnd;=0A=
+char g_szPendingChallenger[256];=0A=
+int g_fPendingChallenge =3D 0;=0A=
 =0A=
 void ZippyInit()=0A=
 {=0A=
@@ -733,6 +735,15 @@=0A=
        based on rated, variant, base, and increment, but it is=0A=
        easier to use the ICS formula feature instead. */=0A=
 =0A=
+    if (toupper(rated) =3D=3D 'U')=0A=
+    {=0A=
+        SendToProgram("unrated\n", &first);=0A=
+    }=0A=
+    else=0A=
+    {=0A=
+        SendToProgram("rated\n", &first);=0A=
+    }=0A=
+=0A=
     if ((variant =3D=3D VariantLoadable) || =0A=
 	(StrStr(appData.zippyVariants, varname) =3D=3D NULL)) {=0A=
         sprintf(buf,=0A=
@@ -765,8 +776,10 @@=0A=
 =0A=
     /* Engine still thinking about last game? */=0A=
     if (first.lastPing !=3D first.lastPong) {=0A=
-      sprintf(buf, "%stell %s Oops, I'm not quite ready for a new game =
yet.\n",=0A=
-	      ics_prefix, opponent);=0A=
+      sprintf(buf, "%stell %s Hang on, I'm still thinking about last =
game... I'll accept as soon as I'm ready.\n", ics_prefix, opponent);=0A=
+      g_szPendingChallenger[255] =3D 0;=0A=
+      strncpy(g_szPendingChallenger, opponent, 254);=0A=
+      g_fPendingChallenge =3D 1;=0A=
       SendToICS(buf);=0A=
       return;=0A=
     }=0A=
@@ -783,6 +796,18 @@=0A=
      char *buf;=0A=
      int *i;=0A=
 {=0A=
+    //=0A=
+    // Clear the last challenger when they join another game.=0A=
+    //=0A=
+    if ((looking_at(buf, i, "*, who was challenging you")) ||=0A=
+        (looking_at(buf, i, "The challenge from * has been =
withdrawn")))=0A=
+    {=0A=
+        if (!strncmp(star_match[0], g_szPendingChallenger, 255))=0A=
+        {=0A=
+            g_fPendingChallenge =3D 0;=0A=
+        }=0A=
+    }=0A=
+=0A=
     /* Accept matches */=0A=
     if (looking_at(buf, i, "* * match * * requested with * (*)")) {=0A=
 =0A=

------=_NextPart_000_0000_01C0D739.E2D82E20--
