[CF-Devel] [PATCH] Misc fixes for the 1.1.0 client

Edgar Toernig froese at gmx.de
Mon Jan 7 16:24:40 CST 2002


Hi,

I noticed that there were some problems with the X11 version of
the 1.1.0 client and I fixed them.  On the way I added some other
features.

These two were required to configure and compile:

 - configure script: libpng needs z-lib.  A lot of version of
   libpng have an explicit dependency for that within the lib.
   Some not.  I added -lz to the -lpng test.  Someone has to
   figure out how to teach this to autoconf.

 - cfsndserv.c needs a #include <time.h> here.  Should be save
   on all systems.

Other changes:

 - Added the status icons again.  They were removed from the
   1.0.0 version due to the png-changes.  I converted these
   icons to bitmaps and use them instead.  This also fixes
   a crash when opening/closing a container.

 - Commented the png rescale code for the x11 version.  I fixed
   the gtk version to not use ~9MB of static arrays (now ~48kB).

 - Option to turn off autorepeat for directional keys.  With
   fast autorepeat and remote server it was very difficult to
   move around.  Commandline option: -noautorepeat.  During play:
   'autorepeat.  Setting is saved in defaults file.

 - Disable nagle algorithm.  That way packets are sent immediately
   without additional delay.  Seems to make interactive feel a
   little bit better.  I had to rework some of newpacket.c to send
   only complete packages.  This cleaned up a lot of code and avoids
   a server failure (closes connection when receiving split packets).

 - Added -font option.  Setting is saved in the defaults-file.

 - Fixed builtin command argument handling (remove leading spaces from
   arguments).  Especially the 'show command did not work because of
   that.

 - Fixed the "not yet present" image (pixmaps/question.111).  It looked
   totally wrong.  It's now bigger but can still be used for 24x24 size.

 - When new images arrive, not the complete inventory is redrawn.  Only
   the icons of the currently displayed.

 - Some minor tweaks.  Browse the patch...

Ciao, ET.
-------------- next part --------------
diff -ruN crossfire-client-1.1.0/common/client.c crossfire-client-1.1.0-et/common/client.c
--- crossfire-client-1.1.0/common/client.c	Fri Dec 28 09:56:41 2001
+++ crossfire-client-1.1.0-et/common/client.c	Mon Jan  7 17:05:59 2002
@@ -128,7 +128,9 @@
 	i=SockList_ReadPacket(csocket->fd, &csocket->inbuf, MAXSOCKBUF-1);
 	if (i==-1) {
 	    /* Need to add some better logic here */
+	    /*ET: not an error.  It's EOF!  At least errno isn't valid.
 	    fprintf(stderr,"Got error on read (error %d)\n", errno);
+	    */
 	    csocket->fd=-1;
 	    return;
 	}
@@ -203,6 +205,14 @@
 	fprintf(stderr,"InitConnection:  Error on fcntl.\n");
     }
 
+    /* turn off nagle algorithm */
+    if (getenv("CF_NAGLE") == NULL) {	/* disabled by setting CF_NAGLE */
+	int i=1;
+
+	if (setsockopt(fd, SOL_TCP, TCP_NODELAY, &i, sizeof(i)) == -1)
+	    perror("TCP_NODELAY");
+    }
+
     if (getsockopt(fd,SOL_SOCKET,SO_RCVBUF, (char*)&oldbufsize, &buflen)==-1)
         oldbufsize=0;
 
@@ -221,9 +231,7 @@
 
 void negotiate_connection(int sound)
 {
-
     int cache;
-    char buf[BIG_BUF];
 
     SendVersion(csocket);
 
@@ -267,16 +275,14 @@
     }
 #endif
 
-    sprintf(buf,"setup sound %d sexp %d darkness %d newmapcmd %d",
-	    (sound<0?0:1), want_skill_exp, want_darkness, fog_of_war);
-    cs_write_string(csocket.fd, buf, strlen(buf));
+    cs_print_string(csocket.fd,
+		    "setup sound %d sexp %d darkness %d newmapcmd %d",
+		    sound>=0, want_skill_exp, want_darkness, fog_of_war);
 
     mapx=11;
     mapy=11;
-    if (want_mapx!=11 || want_mapy!=11) {
-	sprintf(buf,"setup mapsize %dx%d",want_mapx, want_mapy);
-	cs_write_string(csocket.fd, buf, strlen(buf));
-    }
+    if (want_mapx!=11 || want_mapy!=11)
+	cs_print_string(csocket.fd,"setup mapsize %dx%d",want_mapx, want_mapy);
 
     SendAddMe(csocket);
 }
diff -ruN crossfire-client-1.1.0/common/commands.c crossfire-client-1.1.0-et/common/commands.c
--- crossfire-client-1.1.0/common/commands.c	Fri Dec 28 09:56:41 2001
+++ crossfire-client-1.1.0-et/common/commands.c	Mon Jan  7 17:09:39 2002
@@ -112,12 +112,8 @@
 	 * methods, just report on error, or try another setup command.
 	 */
 	if (!strcmp(cmd,"sound")) {
-	    if (!strcmp(param,"FALSE")) {
-		if (nosound)
-		    cs_write_string(csocket.fd,"setsound 0", 10);
-		else
-		    cs_write_string(csocket.fd,"setsound 1", 10);
-	    }
+	    if (!strcmp(param,"FALSE"))
+		cs_print_string(csocket.fd, "setsound %d", !nosound);
 	} else if (!strcmp(cmd,"mapsize")) {
 	    int x, y=0;
 	    char *cp,tmpbuf[MAX_BUF];
@@ -143,8 +139,8 @@
 	    if (want_mapx > x || want_mapy > y) {
 		if (want_mapx > x) want_mapx = x;
 		if (want_mapy > y) want_mapy = y;
-		sprintf(tmpbuf," setup mapsize %dx%d", want_mapx, want_mapy);
-		cs_write_string(csocket.fd, tmpbuf, strlen(tmpbuf));
+		cs_print_string(csocket.fd,
+				"setup mapsize %dx%d", want_mapx, want_mapy);
 		sprintf(tmpbuf,"Server supports a max mapsize of %d x %d - requesting a %d x %d mapsize",
 			x, y, want_mapx, want_mapy);
 		draw_info(tmpbuf,NDI_RED);
@@ -501,11 +497,7 @@
 
 void send_reply(char *text)
 {
-    char buf[MAXSOCKBUF];
-
-    sprintf(buf,"reply %s", text);
-
-    cs_write_string(csocket.fd, buf, strlen(buf));
+    cs_print_string(csocket.fd, "reply %s", text);
 }
 
 
diff -ruN crossfire-client-1.1.0/common/external.h crossfire-client-1.1.0-et/common/external.h
--- crossfire-client-1.1.0/common/external.h	Fri Dec 28 09:56:41 2001
+++ crossfire-client-1.1.0-et/common/external.h	Mon Jan  7 01:46:46 2002
@@ -53,6 +53,7 @@
 extern void draw_prompt(const char *str);
 extern void x_set_echo(void);
 extern void set_scroll(char *s);
+extern void set_autorepeat(char *s);
 
 /* Stats related commands */
 extern void draw_stats(int redraw);
diff -ruN crossfire-client-1.1.0/common/init.c crossfire-client-1.1.0-et/common/init.c
--- crossfire-client-1.1.0/common/init.c	Fri Dec 28 09:56:41 2001
+++ crossfire-client-1.1.0-et/common/init.c	Mon Jan  7 17:10:49 2002
@@ -57,26 +57,20 @@
 
 void SendVersion(ClientSocket csock)
 {
-    char buf[MAX_BUF];
-
-    sprintf(buf,"version %d %d %s", VERSION_CS, VERSION_SC, VERSION_INFO);
-    cs_write_string(csock.fd, buf, strlen(buf));
+    cs_print_string(csock.fd,
+		    "version %d %d %s", VERSION_CS, VERSION_SC, VERSION_INFO);
 }
 
 
 void SendAddMe(ClientSocket csock)
 {
-
-    cs_write_string(csock.fd, "addme",5);
+    cs_print_string(csock.fd, "addme");
 }
 
 
 void SendSetFaceMode(ClientSocket csock,int mode)
 {
-    char buf[MAX_BUF];
-
-    sprintf(buf,"setfacemode %d", mode);
-    cs_write_string(csock.fd, buf, strlen(buf));
+    cs_print_string(csock.fd, "setfacemode %d", mode);
 }
 
 
diff -ruN crossfire-client-1.1.0/common/item.c crossfire-client-1.1.0-et/common/item.c
--- crossfire-client-1.1.0/common/item.c	Fri Dec 28 09:56:41 2001
+++ crossfire-client-1.1.0-et/common/item.c	Mon Jan  7 17:23:39 2002
@@ -575,32 +575,29 @@
 void toggle_locked (item *op)
 {
     SockList sl;
-    char    buf[MAX_BUF];
+    char buf[MAX_BUF];
 
     if (op->env->tag == 0)
 	return;	/* if item is on the ground, don't lock it */
 
-    sl.buf = (unsigned char*)buf;
-    strcpy((char*)sl.buf, "lock ");
-    sl.len=5;
-    if (op->locked) sl.buf[sl.len++]=0;
-    else sl.buf[sl.len++]=1;
+    SockList_Init(&sl, buf);
+    SockList_AddString(&sl, "lock "); 
+    SockList_AddChar(&sl, !op->locked);
     SockList_AddInt(&sl, op->tag);
-    send_socklist(csocket.fd, sl);
+    SockList_Send(&sl, csocket.fd);
 }
 
 void send_mark_obj (item *op) {
     SockList sl;
-    char    buf[MAX_BUF];
+    char buf[MAX_BUF];
 
     if (op->env->tag == 0)
 	return;	/* if item is on the ground, don't mark it */
 
-    sl.buf = (unsigned char*)buf;
-    strcpy((char*)sl.buf, "mark ");
-    sl.len=5;
+    SockList_Init(&sl, buf);
+    SockList_AddString(&sl, "mark ");
     SockList_AddInt(&sl, op->tag);
-    send_socklist(csocket.fd, sl);
+    SockList_Send(&sl, csocket.fd);
 }
 
 
diff -ruN crossfire-client-1.1.0/common/newsocket.c crossfire-client-1.1.0-et/common/newsocket.c
--- crossfire-client-1.1.0/common/newsocket.c	Fri Dec 28 09:56:41 2001
+++ crossfire-client-1.1.0-et/common/newsocket.c	Mon Jan  7 17:03:25 2002
@@ -30,15 +30,16 @@
  */
 
 
-#ifdef DEBUG
 #include <stdio.h>
 #include <stdarg.h>
-#endif
+#include <errno.h>
+
+#include <client.h>
+#include <newclient.h>
 
 /* The LOG function is normally part of the libcross.  If client compile,
  * we need to supply something since some of the common code calls this.
  */
-#include <client.h>
 void LOG (int logLevel, char *format, ...)
 {
 #ifdef DEBUG
@@ -48,42 +49,89 @@
     va_end(ap);
 #endif
 }
+
+
 /* We don't care what these values are in the client, since
  * we toss them
  */
 #define llevDebug 0
 #define llevError 0
-#include <errno.h>
 
-#include <newclient.h>
 
-void SockList_Init(SockList *sl)
+/*
+ * This writes data to the socket.
+ */
+static int write_socket(int fd, unsigned char *buf, int len)
+{
+    int amt=0;
+    unsigned char *pos=buf;
+
+    /* If we manage to write more than we wanted, take it as a bonus */
+    while (len>0) {
+	do {
+	    amt=write(fd, pos, len);
+	} while ((amt<0) && (errno==EINTR));
+
+	if (amt < 0) { /* We got an error */
+	    LOG(llevError,"New socket (fd=%d) write failed.\n", fd);
+	    return -1;
+	}
+	if (amt==0) {
+	    LOG(llevError,"Write_To_Socket: No data written out.\n");
+	}
+	len -= amt;
+	pos += amt;
+    }
+    return 0;
+}
+
+
+
+void SockList_Init(SockList *sl, char *buf)
 {
     sl->len=0;
-    sl->buf=NULL;
+    sl->buf=buf + 2;	/* reserve two bytes for total length */
 }
 
 void SockList_AddChar(SockList *sl, char c)
 {
-    sl->buf[sl->len]=c;
-    sl->len++;
+    sl->buf[sl->len++]=c;
 }
 
 void SockList_AddShort(SockList *sl, uint16 data)
 {
-    sl->buf[sl->len++]= (data>>8)&0xff;
+    sl->buf[sl->len++] = (data>>8)&0xff;
     sl->buf[sl->len++] = data & 0xff;
 }
 
 
 void SockList_AddInt(SockList *sl, uint32 data)
 {
-    sl->buf[sl->len++]= (data>>24)&0xff;
-    sl->buf[sl->len++]= (data>>16)&0xff;
-    sl->buf[sl->len++]= (data>>8)&0xff;
+    sl->buf[sl->len++] = (data>>24)&0xff;
+    sl->buf[sl->len++] = (data>>16)&0xff;
+    sl->buf[sl->len++] = (data>>8)&0xff;
     sl->buf[sl->len++] = data & 0xff;
 }
 
+void SockList_AddString(SockList *sl, const char *str)
+{
+    int len = strlen(str);
+
+    if (sl->len + len > MAX_BUF-2)
+	len = MAX_BUF-2 - sl->len;
+    memcpy(sl->buf + sl->len, str, len);
+    sl->len += len;
+}
+
+int SockList_Send(SockList *sl, int fd)
+{
+    sl->buf[-2] = sl->len / 256;
+    sl->buf[-1] = sl->len % 256;
+
+    return write_socket(fd, sl->buf-2, sl->len+2);
+}
+
+
 /* Basically does the reverse of SockList_AddInt, but on
  * strings instead.  Same for the GetShort, but for 16 bits.
  */
@@ -168,56 +216,19 @@
     return 0;
 }
 
-/* This writes data to the socket.  we precede the len information on the
- * packet.  Len needs to be passed here because buf could be binary
- * data
+/*
+ * Send a printf-formatted packet to the socket.
  */
-static int write_socket(int fd, unsigned char *buf, int len)
-{
-    int amt=0;
-    unsigned char *pos=buf;
-
-    /* If we manage to write more than we wanted, take it as a bonus */
-    while (len>0) {
-	do {
-	    amt=write(fd, pos, len);
-	} while ((amt<0) && (errno==EINTR));
-
-	if (amt < 0) { /* We got an error */
-	    LOG(llevError,"New socket (fd=%d) write failed.\n", fd);
-	    return -1;
-	}
-	if (amt==0) {
-	    LOG(llevError,"Write_To_Socket: No data written out.\n");
-	}
-	len -= amt;
-	pos += amt;
-    }
-    return 0;
-}
-
-/* Send With Handling - cnum is the client number, msg is what we want
- * to send.
- */
-int send_socklist(int fd,SockList  msg)
-{
-    unsigned char sbuf[2];
-
-    sbuf[0] = ((uint32)(msg.len) >> 8) & 0xFF;
-    sbuf[1] = ((uint32)(msg.len)) & 0xFF;
-
-    write_socket(fd, sbuf, 2);
-    return write_socket(fd, msg.buf, msg.len);
-}
-
-/* Takes a string of data, and writes it out to the socket. A very handy
- * shortcut function.
- */
-int cs_write_string(int fd, char *buf, int len)
+int cs_print_string(int fd, char *str, ...)
 {
+    va_list args;
     SockList sl;
+    char buf[MAX_BUF];
+
+    SockList_Init(&sl, buf);
+    va_start(args, str);
+    sl.len += vsprintf(sl.buf + sl.len, str, args);
+    va_end(args);
 
-    sl.len = len;
-    sl.buf = (unsigned char*)buf;
-    return send_socklist(fd, sl);
+    return SockList_Send(&sl, fd);
 }
diff -ruN crossfire-client-1.1.0/common/player.c crossfire-client-1.1.0-et/common/player.c
--- crossfire-client-1.1.0/common/player.c	Fri Dec 28 09:56:41 2001
+++ crossfire-client-1.1.0-et/common/player.c	Mon Jan  7 17:26:09 2002
@@ -64,36 +64,24 @@
 
 void look_at(int x, int y)
 {
-    char buf[MAX_BUF];
-
-    sprintf(buf,"lookat %d %d", x, y);
-    cs_write_string(csocket.fd, buf, strlen(buf));
+    cs_print_string(csocket.fd, "lookat %d %d", x, y);
 }
 
 void client_send_apply (int tag)
 {
-    char buf[MAX_BUF];
-
-    sprintf(buf,"apply %d", tag);
-    cs_write_string(csocket.fd, buf, strlen(buf));
+    cs_print_string(csocket.fd, "apply %d", tag);
 }
 
 void client_send_examine (int tag)
 {
-    char buf[MAX_BUF];
-
-    sprintf(buf,"examine %d", tag);
-    cs_write_string(csocket.fd, buf, strlen(buf));
+    cs_print_string(csocket.fd, "examine %d", tag);
 
 }
 
 /* Requests nrof objects of tag get moved to loc. */
 void client_send_move (int loc, int tag, int nrof)
 {
-    char buf[MAX_BUF];
-
-    sprintf(buf,"move %d %d %d", loc, tag, nrof);
-    cs_write_string(csocket.fd, buf, strlen(buf));
+    cs_print_string(csocket.fd, "move %d %d %d", loc, tag, nrof);
 }
 
 
@@ -195,7 +183,6 @@
  */
 
 int send_command(const char *command, int repeat, int must_send) {
-    char buf[MAX_BUF];
     static char last_command[MAX_BUF]="";
 
     if (cpl.input_state==Reply_One) {
@@ -231,19 +218,15 @@
 	    csocket.command_sent++;
 	    csocket.command_sent &= 0xff;   /* max out at 255 */
 
-	    sl.buf = (unsigned char*)buf;
-	    strcpy((char*)sl.buf,"ncom ");
-	    sl.len=5;
+	    SockList_Init(&sl, buf);
+	    SockList_AddString(&sl, "ncom ");
 	    SockList_AddShort(&sl, csocket.command_sent);
 	    SockList_AddInt(&sl, repeat);
-	    strncpy((char*)sl.buf + sl.len, command, MAX_BUF - sl.len);
-	    sl.buf[MAX_BUF-1]=0;
-	    sl.len += strlen(command);
-	    send_socklist(csocket.fd, sl);
+	    SockList_AddString(&sl, command);
+	    SockList_Send(&sl, csocket.fd);
 	}
     } else {
-	sprintf(buf,"command %d %s", repeat,command);
-	cs_write_string(csocket.fd, buf, strlen(buf));
+	cs_print_string(csocket.fd, "command %d %s", repeat,command);
     }
     if (repeat!=-1) cpl.count=0;
     return 1;
@@ -289,7 +272,7 @@
     draw_info("               ~/.crossfire/defaults", NDI_BLACK);
     draw_info(" show        - determine what type of items", NDI_BLACK);
     draw_info("               to show in inventory", NDI_BLACK);
-
+    draw_info(" autorepeat  - toggle autorepeat", NDI_BLACK);
 }
 
 /* This is an extended command (ie, 'who, 'whatever, etc).  In general,
@@ -312,6 +295,10 @@
 	strncpy(command, ocommand, len);
 	command[len] = '\0';
 	cp = command;
+	while (*cpnext == ' ')
+	    cpnext++;
+	if (*cpnext == 0)
+	    cpnext = NULL;
     }
     /* cp now contains the command (everything before first space),
      * and cpnext contains everything after that first space.  cpnext
@@ -327,6 +314,8 @@
 	set_show_weight (cpnext);
     else if (!strcmp(cp,"scroll"))
 	set_scroll(cpnext);
+    else if (!strcmp(cp,"autorepeat"))
+	set_autorepeat(cpnext);
     else if (!strcmp(cp,"magicmap")) {
 	cpl.showmagic=1;
 	draw_magic_map();
@@ -352,7 +341,7 @@
 	save_winpos();
     }
     else if (!strcmp(cp,"mapredraw")) {
-	cs_write_string(csocket.fd, "mapredraw",9);
+	cs_print_string(csocket.fd, "mapredraw");
     }
     else if (!strcmp(cp,"savedefaults")) {
 	save_defaults();
diff -ruN crossfire-client-1.1.0/common/proto.h crossfire-client-1.1.0-et/common/proto.h
--- crossfire-client-1.1.0/common/proto.h	Fri Dec 28 09:56:41 2001
+++ crossfire-client-1.1.0-et/common/proto.h	Mon Jan  7 17:19:30 2002
@@ -63,15 +63,16 @@
 extern char *strdup_local(char *str);
 /* newsocket.c */
 extern void LOG(int logLevel, char *format, ...);
-extern void SockList_Init(SockList *sl);
+extern void SockList_Init(SockList *sl, char *buf);
 extern void SockList_AddChar(SockList *sl, char c);
 extern void SockList_AddShort(SockList *sl, uint16 data);
 extern void SockList_AddInt(SockList *sl, uint32 data);
+extern void SockList_AddString(SockList *sl, const char *str);
+extern int SockList_Send(SockList *sl, int fd);
 extern int GetInt_String(unsigned char *data);
 extern short GetShort_String(unsigned char *data);
 extern int SockList_ReadPacket(int fd, SockList *sl, int len);
-extern int send_socklist(int fd, SockList msg);
-extern int cs_write_string(int fd, char *buf, int len);
+extern int cs_print_string(int fd, char *str, ...);
 /* player.c */
 extern void new_player(long tag, char *name, long weight, long face);
 extern void look_at(int x, int y);
diff -ruN crossfire-client-1.1.0/configure crossfire-client-1.1.0-et/configure
--- crossfire-client-1.1.0/configure	Fri Dec 28 09:56:41 2001
+++ crossfire-client-1.1.0-et/configure	Mon Jan  7 00:45:29 2002
@@ -7220,7 +7220,7 @@
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpng  $LIBS"
+LIBS="-lpng -lz $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 #line 7225 "configure"
 #include "confdefs.h"
@@ -7267,7 +7267,7 @@
 #define HAVE_LIBPNG 1
 _ACEOF
 
-  LIBS="-lpng $LIBS"
+  LIBS="-lpng -lz $LIBS"
 
 else
   { { echo "$as_me:7273: error: You must have the png library installed to compile the client" >&5
diff -ruN crossfire-client-1.1.0/gnome/gnome.c crossfire-client-1.1.0-et/gnome/gnome.c
--- crossfire-client-1.1.0/gnome/gnome.c	Fri Dec 28 09:56:41 2001
+++ crossfire-client-1.1.0-et/gnome/gnome.c	Mon Jan  7 17:14:33 2002
@@ -385,9 +385,9 @@
 requestface(int pnum, char *facename, char *facepath)
 {
 	char buf[MAX_BUF];
+
 	facetoname[pnum] = strdup_local(facepath);
-	sprintf(buf, "askface %d", pnum);
-	cs_write_string(csocket.fd, buf, strlen(buf));
+	cs_print_string(csocket.fd, "askface %d", pnum);
 	sprintf(buf, "%s/%c%c", facecachedir, facename[0], facename[1]);
 	if (access(buf, R_OK))
 		make_path_to_dir(buf);
@@ -3138,10 +3138,7 @@
 		if (nosound) {
 			nosound = FALSE;
 			sound = init_sounds();
-			if (sound < 0)
-				cs_write_string(csocket.fd, "setsound 0", 10);
-			else
-				cs_write_string(csocket.fd, "setsound 1", 10);
+			cs_print_string(csocket.fd, "setsound %d", sound >= 0);
 		}
 	} else {
 		if (!nosound) {
@@ -3912,6 +3909,11 @@
 
 void
 set_scroll(char *s)
+{
+}
+
+void
+set_autorepeat(char *s)
 {
 }
 
diff -ruN crossfire-client-1.1.0/gnome/map.c crossfire-client-1.1.0-et/gnome/map.c
--- crossfire-client-1.1.0/gnome/map.c	Fri Dec 28 09:56:41 2001
+++ crossfire-client-1.1.0-et/gnome/map.c	Mon Jan  7 17:14:46 2002
@@ -127,7 +127,7 @@
 	}
     }
     
-    cs_write_string( csocket.fd, "mapredraw", 9);
+    cs_print_string(csocket.fd, "mapredraw");
     
     return;
 }
diff -ruN crossfire-client-1.1.0/gtk/gtkproto.h crossfire-client-1.1.0-et/gtk/gtkproto.h
--- crossfire-client-1.1.0/gtk/gtkproto.h	Fri Dec 28 09:56:41 2001
+++ crossfire-client-1.1.0-et/gtk/gtkproto.h	Mon Jan  7 17:19:43 2002
@@ -50,6 +50,7 @@
 extern void create_windows(void);
 extern void set_weight_limit(uint32 wlim);
 extern void set_scroll(char *s);
+extern void set_autorepeat(char *s);
 extern int get_info_width(void);
 extern void do_clearlock(void);
 extern void x_set_echo(void);
@@ -109,10 +110,6 @@
 extern int rgba_to_gdkpixmap(GdkWindow *window, uint8 *data, int width, int height, GdkPixmap **pix, GdkBitmap **mask, GdkColormap *colormap);
 extern int png_to_gdkpixmap(GdkWindow *window, uint8 *data, int len, GdkPixmap **pix, GdkBitmap **mask, GdkColormap *colormap);
 /* sdl.c */
-extern void init_SDL(GtkWidget *sdl_window, int just_lightmap);
-extern void do_sdl_per_pixel_lighting(int x, int y, int mx, int my);
-extern void sdl_gen_map(void);
-extern void sdl_mapscroll(int dx, int dy);
 /* sound.c */
 extern void signal_pipe(int i);
 extern int init_sounds(void);
diff -ruN crossfire-client-1.1.0/gtk/gx11.c crossfire-client-1.1.0-et/gtk/gx11.c
--- crossfire-client-1.1.0/gtk/gx11.c	Fri Dec 28 09:56:41 2001
+++ crossfire-client-1.1.0-et/gtk/gx11.c	Mon Jan  7 17:18:10 2002
@@ -3138,10 +3138,7 @@
     if (nosound) {
       nosound=FALSE;
       sound = init_sounds();
-      if (sound<0)
-	cs_write_string(csocket.fd,"setsound 0", 10);
-      else
-	cs_write_string(csocket.fd,"setsound 1", 10);
+      cs_print_string(csocket.fd, "setsound %d", sound >= 0);
     }
   } else {
     if (!nosound) {
@@ -3211,7 +3208,7 @@
 		per_tile_lighting= 0;
 		init_SDL( NULL, 1);
 		if( csocket.fd)
-		    cs_write_string( csocket.fd, "mapredraw", 9);
+		    cs_print_string(csocket.fd, "mapredraw");
 	    }
 	} else {
 	    if( per_pixel_lighting == 1) {
@@ -3219,7 +3216,7 @@
 		per_tile_lighting= 1;
 		init_SDL( NULL, 1);
 		if( csocket.fd)
-		    cs_write_string( csocket.fd, "mapredraw", 9);
+		    cs_print_string(csocket.fd, "mapredraw");
 	    }
 	}
 	if( GTK_TOGGLE_BUTTON( ccheckbutton9)->active) {
@@ -3277,10 +3274,7 @@
     if (nosound) {
       nosound=FALSE;
       sound = init_sounds();
-      if (sound<0)
-	cs_write_string(csocket.fd,"setsound 0", 10);
-      else
-	cs_write_string(csocket.fd,"setsound 1", 10);
+      cs_print_string(csocket.fd, "setsound %d", sound >= 0);
     }
   } else {
     if (!nosound) {
@@ -3350,16 +3344,16 @@
 	    per_pixel_lighting= 1;
 	    per_tile_lighting= 0;
 	    init_SDL( NULL, 1);
-	    if( csocket.fd)
-	    cs_write_string( csocket.fd, "mapredraw", 9);
+	    if (csocket.fd)
+		cs_print_string(csocket.fd, "mapredraw");
 	}
     } else {
 	if( per_pixel_lighting == 1) {
 	    per_pixel_lighting= 0;
 	    per_tile_lighting= 1;
 	    init_SDL( NULL, 1);
-	    if( csocket.fd)
-	    cs_write_string( csocket.fd, "mapredraw", 9);
+	    if (csocket.fd)
+		cs_print_string(csocket.fd, "mapredraw");
 	}
     }
     if( GTK_TOGGLE_BUTTON( ccheckbutton9)->active) {
@@ -5033,6 +5027,10 @@
 {
 }
 
+
+void set_autorepeat(char *s)
+{
+}
 
 
 int get_info_width()
diff -ruN crossfire-client-1.1.0/gtk/image.c crossfire-client-1.1.0-et/gtk/image.c
--- crossfire-client-1.1.0/gtk/image.c	Fri Dec 28 09:56:41 2001
+++ crossfire-client-1.1.0-et/gtk/image.c	Mon Jan  7 17:18:35 2002
@@ -94,8 +94,7 @@
     char buf[MAX_BUF];
 
     facetoname[pnum] = strdup_local(facepath);
-    sprintf(buf,"askface %d", pnum);
-    cs_write_string(csocket.fd, buf, strlen(buf));
+    cs_print_string(csocket.fd, "askface %d", pnum);
     /* Need to make sure we have the directory */
     sprintf(buf,"%s/%c%c", facecachedir, facename[0], facename[1]);
     if (access(buf,R_OK)) make_path_to_dir(buf);
diff -ruN crossfire-client-1.1.0/gtk/map.c crossfire-client-1.1.0-et/gtk/map.c
--- crossfire-client-1.1.0/gtk/map.c	Fri Dec 28 09:56:41 2001
+++ crossfire-client-1.1.0-et/gtk/map.c	Mon Jan  7 17:18:48 2002
@@ -152,8 +152,7 @@
 	}
     }
     
-    cs_write_string( csocket.fd, "mapredraw", 9);
-    
+    cs_print_string(csocket.fd, "mapredraw");
     return;
 }
 
diff -ruN crossfire-client-1.1.0/gtk/png.c crossfire-client-1.1.0-et/gtk/png.c
--- crossfire-client-1.1.0/gtk/png.c	Fri Dec 28 09:56:41 2001
+++ crossfire-client-1.1.0-et/gtk/png.c	Mon Jan  7 20:15:48 2002
@@ -211,13 +211,14 @@
  */
 #define RATIO	100
 
-#define MAX_IMAGE_BYTES	512*512
+#define MAX_IMAGE_WIDTH		1024
+#define MAX_IMAGE_HEIGHT	1024
 #define BPP 4
 
 uint8 *rescale_rgba_data(uint8 *data, int *width, int *height, int scale)
 {
-    static    int xrow[BPP * MAX_IMAGE_BYTES], yrow[BPP*MAX_IMAGE_BYTES];
-    static  uint8  *nrows[MAX_IMAGE_BYTES];
+    static int xrow[BPP * MAX_IMAGE_WIDTH], yrow[BPP*MAX_IMAGE_HEIGHT];
+    static uint8 *nrows[MAX_IMAGE_HEIGHT];
 
     /* Figure out new height/width */
     int new_width = *width  * scale / RATIO, new_height = *height * scale / RATIO;
@@ -227,6 +228,13 @@
     int x,y;
     uint8 *ndata;
     uint8 r,g,b,a;
+
+    if (*width > MAX_IMAGE_WIDTH || new_width > MAX_IMAGE_WIDTH
+    || *height > MAX_IMAGE_HEIGHT || new_height > MAX_IMAGE_HEIGHT)
+    {
+	fprintf(stderr, "Image too big\n");
+	exit(0);
+    }
 
     /* clear old values these may have */
     memset(yrow, 0, sizeof(int) * *height * BPP);
diff -ruN crossfire-client-1.1.0/pixmaps/applied.xbm crossfire-client-1.1.0-et/pixmaps/applied.xbm
--- crossfire-client-1.1.0/pixmaps/applied.xbm	Thu Jan  1 01:00:00 1970
+++ crossfire-client-1.1.0-et/pixmaps/applied.xbm	Mon Jan  7 19:20:19 2002
@@ -0,0 +1,5 @@
+#define applied_width 24
+#define applied_height 6
+static char applied_bits[] = {
+ 0xe7,0xa4,0x3b,0x11,0x25,0x49,0x13,0x25,0x39,0x11,0x25,0x09,0xe7,0x98,0x0b,
+ 0x00,0x01,0x00};
diff -ruN crossfire-client-1.1.0/pixmaps/clear.xbm crossfire-client-1.1.0-et/pixmaps/clear.xbm
--- crossfire-client-1.1.0/pixmaps/clear.xbm	Thu Jan  1 01:00:00 1970
+++ crossfire-client-1.1.0-et/pixmaps/clear.xbm	Mon Jan  7 19:22:47 2002
@@ -0,0 +1,6 @@
+#define clear_width 24
+#define clear_height 13
+static char clear_bits[] = {
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
diff -ruN crossfire-client-1.1.0/pixmaps/close.xbm crossfire-client-1.1.0-et/pixmaps/close.xbm
--- crossfire-client-1.1.0/pixmaps/close.xbm	Thu Jan  1 01:00:00 1970
+++ crossfire-client-1.1.0-et/pixmaps/close.xbm	Mon Jan  7 19:20:19 2002
@@ -0,0 +1,6 @@
+#define close_width 24
+#define close_height 13
+static char close_bits[] = {
+ 0x00,0x00,0x00,0x26,0x18,0x73,0x29,0xa4,0x10,0x21,0x24,0x33,0x29,0x24,0x14,
+ 0xe6,0x19,0x73,0x00,0x00,0x00,0x40,0xc4,0x03,0xc0,0x46,0x00,0x40,0xc5,0x01,
+ 0x40,0x44,0x00,0x40,0xc4,0x03,0x00,0x00,0x00};
diff -ruN crossfire-client-1.1.0/pixmaps/cursed.xbm crossfire-client-1.1.0-et/pixmaps/cursed.xbm
--- crossfire-client-1.1.0/pixmaps/cursed.xbm	Thu Jan  1 01:00:00 1970
+++ crossfire-client-1.1.0-et/pixmaps/cursed.xbm	Mon Jan  7 19:20:19 2002
@@ -0,0 +1,5 @@
+#define cursed_width 24
+#define cursed_height 6
+static char cursed_bits[] = {
+ 0x4e,0x1a,0x77,0x51,0xaa,0x10,0x41,0x1a,0x73,0x51,0x2a,0x14,0x8e,0xa9,0x73,
+ 0x00,0x00,0x00};
diff -ruN crossfire-client-1.1.0/pixmaps/damned.xbm crossfire-client-1.1.0-et/pixmaps/damned.xbm
--- crossfire-client-1.1.0/pixmaps/damned.xbm	Thu Jan  1 01:00:00 1970
+++ crossfire-client-1.1.0-et/pixmaps/damned.xbm	Mon Jan  7 19:20:19 2002
@@ -0,0 +1,5 @@
+#define damned_width 24
+#define damned_height 6
+static char damned_bits[] = {
+ 0x8f,0x6c,0x09,0x52,0x6d,0x0b,0xd2,0x55,0x0b,0x52,0x55,0x0d,0x4f,0x45,0x09,
+ 0x00,0x00,0x00};
diff -ruN crossfire-client-1.1.0/pixmaps/locked.xbm crossfire-client-1.1.0-et/pixmaps/locked.xbm
--- crossfire-client-1.1.0/pixmaps/locked.xbm	Thu Jan  1 01:00:00 1970
+++ crossfire-client-1.1.0-et/pixmaps/locked.xbm	Mon Jan  7 19:20:19 2002
@@ -0,0 +1,5 @@
+#define locked_width 24
+#define locked_height 6
+static char locked_bits[] = {
+ 0xc7,0x71,0x26,0x22,0x8a,0x14,0x22,0x0a,0x0c,0x2a,0x8a,0x14,0xcf,0x71,0x36,
+ 0x00,0x00,0x00};
diff -ruN crossfire-client-1.1.0/pixmaps/magic.xbm crossfire-client-1.1.0-et/pixmaps/magic.xbm
--- crossfire-client-1.1.0/pixmaps/magic.xbm	Thu Jan  1 01:00:00 1970
+++ crossfire-client-1.1.0-et/pixmaps/magic.xbm	Mon Jan  7 19:20:19 2002
@@ -0,0 +1,5 @@
+#define magic_width 24
+#define magic_height 6
+static char magic_bits[] = {
+ 0x9b,0x38,0x39,0x5b,0x05,0x45,0xd5,0x75,0x05,0x55,0x45,0x45,0x51,0x39,0x39,
+ 0x00,0x00,0x00};
diff -ruN crossfire-client-1.1.0/pixmaps/question.111 crossfire-client-1.1.0-et/pixmaps/question.111
--- crossfire-client-1.1.0/pixmaps/question.111	Fri Dec 28 09:56:41 2001
+++ crossfire-client-1.1.0-et/pixmaps/question.111	Mon Jan  7 21:40:29 2002
@@ -1,9 +1,14 @@
-#define question_width 24
-#define question_height 24
+#define question_width 32
+#define question_height 32
 static unsigned char question_bits[] = {
-   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0xc0, 0x7f, 0x00,
-   0xe0, 0xff, 0x00, 0x70, 0xc0, 0x01, 0x38, 0x80, 0x03, 0x38, 0x80, 0x03,
-   0x38, 0x80, 0x03, 0x38, 0x80, 0x03, 0x38, 0x80, 0x03, 0x70, 0xc0, 0x01,
-   0x00, 0xc0, 0x01, 0x00, 0x70, 0x00, 0x00, 0x78, 0x00, 0x00, 0x3e, 0x00,
-   0x00, 0x0e, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-   0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x0e, 0x00};
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00,
+   0xc0, 0x7f, 0x00, 0x00, 0xe0, 0xff, 0x00, 0x00, 0x70, 0xc0, 0x01, 0x00,
+   0x38, 0x80, 0x03, 0x00, 0x38, 0x80, 0x03, 0x00, 0x38, 0x80, 0x03, 0x00,
+   0x38, 0x80, 0x03, 0x00, 0x38, 0x80, 0x03, 0x00, 0x70, 0xc0, 0x01, 0x00,
+   0x00, 0xc0, 0x01, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00,
+   0x00, 0x3e, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
diff -ruN crossfire-client-1.1.0/pixmaps/question24.111 crossfire-client-1.1.0-et/pixmaps/question24.111
--- crossfire-client-1.1.0/pixmaps/question24.111	Thu Jan  1 01:00:00 1970
+++ crossfire-client-1.1.0-et/pixmaps/question24.111	Mon Jan  7 21:32:59 2002
@@ -0,0 +1,9 @@
+#define question_width 24
+#define question_height 24
+static unsigned char question_bits[] = {
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0xc0, 0x7f, 0x00,
+   0xe0, 0xff, 0x00, 0x70, 0xc0, 0x01, 0x38, 0x80, 0x03, 0x38, 0x80, 0x03,
+   0x38, 0x80, 0x03, 0x38, 0x80, 0x03, 0x38, 0x80, 0x03, 0x70, 0xc0, 0x01,
+   0x00, 0xc0, 0x01, 0x00, 0x70, 0x00, 0x00, 0x78, 0x00, 0x00, 0x3e, 0x00,
+   0x00, 0x0e, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x0e, 0x00};
diff -ruN crossfire-client-1.1.0/pixmaps/unpaid.xbm crossfire-client-1.1.0-et/pixmaps/unpaid.xbm
--- crossfire-client-1.1.0/pixmaps/unpaid.xbm	Thu Jan  1 01:00:00 1970
+++ crossfire-client-1.1.0-et/pixmaps/unpaid.xbm	Mon Jan  7 19:20:19 2002
@@ -0,0 +1,5 @@
+#define unpaid_width 24
+#define unpaid_height 6
+static char unpaid_bits[] = {
+ 0x29,0x1d,0x69,0x69,0xa5,0xaa,0x69,0x9d,0xab,0xa9,0x85,0xaa,0x26,0x85,0x6a,
+ 0x00,0x00,0x00};
diff -ruN crossfire-client-1.1.0/sound-src/cfsndserv.c crossfire-client-1.1.0-et/sound-src/cfsndserv.c
--- crossfire-client-1.1.0/sound-src/cfsndserv.c	Fri Dec 28 09:56:41 2001
+++ crossfire-client-1.1.0-et/sound-src/cfsndserv.c	Mon Jan  7 01:15:35 2002
@@ -51,6 +51,7 @@
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <time.h>
 
 #ifdef HAVE_FCNTL_H
 #include <fcntl.h>
@@ -974,7 +975,7 @@
       if (FD_ISSET(infd,&inset)){
         int err=read(infd,inbuf+inbuf_pos,1);
 	if (err<1 && errno!=EINTR){
-	  perror("read");
+	  if (err<0) perror("read");
 	  break;
 	}  
         if (inbuf[inbuf_pos]=='\n'){
diff -ruN crossfire-client-1.1.0/x11/cfclient.man crossfire-client-1.1.0-et/x11/cfclient.man
--- crossfire-client-1.1.0/x11/cfclient.man	Fri Dec 28 09:56:41 2001
+++ crossfire-client-1.1.0-et/x11/cfclient.man	Mon Jan  7 17:38:17 2002
@@ -42,14 +42,21 @@
 be moved around and resized as desired.  -nosplit starts the game up with
 a single window - this is the default.  The option is useful if your
 saved defaults are set for -split (see Saved Defaults further down).
-
+.TP
+.B -font <name>
+Use the given font instead of the default 8x13.  Only fixed width
+fonts will work properly.
+.TP
+.B -noautorepeat
+Disable autorepeat on directional keys.  This may be useful when
+playing on a distant remote server.  This flag may be toggled
+while playing with the 'autorepeat' command.
 .TP
 .B -echo
 Echo commands as they are entered.  Normally, commands bound to keys
 are just sent to the server without any echoing on the client of what
 that command actually was.  This option causes the commands to also be
 printed in the information window as they are sent to the server.
-
 .TP
 .B -mapsize XxY
 Sets the desired viewable map window.  X and Y are number of tiles.
@@ -65,8 +72,6 @@
 (simple test - go to the start town, run in some direction, stop
 running and see how long it takes before the client stops moving
 you).
-
-
 .TP
 .B -pix|-xpm|-png
 This determines the graphic image types to use.  -pix uses pixmap images -
@@ -81,7 +86,6 @@
 efficiency of the png format, actually take less bandwidth to transmit
 than the xpm images.  Using the png images require that the client
 has been compiled with png support.
-
 .TP
 .B -pngximage
 gcfclient only.  This option is only meaningful if png graphics are
@@ -91,7 +95,6 @@
 the mapsize option above, it is suggested the experimentation is
 done to make performance is still acceptable.  This option does
 not affect bandwidth - it only affects cpu performancs.
-
 .TP
 .B -sdl
 gcfclient only.  Will only be available if the SDL library was
@@ -100,14 +103,12 @@
 library to actualy draw them to the screen.  This is slightly faster
 than -pngximage - if you have SDL, you should use this instead of
 -pngximage.
-
 .TP
 .B -showicon
 This shows a little icon next to items in your inventory that contains
 a brief description of some of the item properties (magic, cursed,
 equipped, etc.)  This can make spotting some items easier, but some
 players may not like the extra space these icons take up or the
-
 .TP
 .B -scollines <lines>
 This is the number of lines to use in the information window.  By default,
@@ -116,17 +117,14 @@
 through old messages.  It is strongly recommended you set this to some
 value, since some areas output more data than will fit in the output
 window at one time.
-
 .TP
 .B -sync
 Runs the server in synchronous display mode.  This option tends only to
 be useful in debugging purposes - using this will slow down the display
 and not gain anything for the typical player.
-
 .TP
 .B -help
 Prints out a brief description of the options to standard output.
-
 .TP
 .B -cache|-nocache
 Determines if the client will cache images for future runs.  With -nocache,
@@ -144,7 +142,6 @@
 is slower than home directory access - this is likely to be the case
 except in case of nfs mounted home directories on the server on the local
 lan.
-
 .TP
 .B -darkness|-nodarkness
 Controls whether the server sends darkness information to the client
@@ -152,7 +149,6 @@
 for maps that use darkness code (currently, very few maps use darkness
 code).  Turning off darkness may also be desirable as in some graphics
 mode the quality of darkness may not add much to the map.
-
 .TP
 .B -updatekeycodes
 The standard behaviour when a player uses the bind command to bind
@@ -221,13 +217,11 @@
 .TP
 .B savewinpos savedefaults
 These commands were described in the SAVED DEFAULTS options above.
-
 .TP
 .B scroll
 This toggles whether or the information windows scrolls when it gets to 
 the bottom of the window or wraps to the top.  Wrapping is slighly less
 cpu intensive, but is generally harder to read.
-
 .TP
 .B bind unbind
 bind is used to add new keybindings.  Do you want to be able to press
@@ -257,7 +251,11 @@
 Having this value too low on slow links can result in the
 character sitting idle even though they have an action
 comming to them.
-
+.TP
+.B autorepeat
+Toggle the autorepeat handling for directional keys.  When
+disabled artifical keystrokes generated by the autorepeat
+of the X-server are not sent to the Crossfire server.
 
 .SH FILES
 .TP
diff -ruN crossfire-client-1.1.0/x11/png.c crossfire-client-1.1.0-et/x11/png.c
--- crossfire-client-1.1.0/x11/png.c	Fri Dec 28 09:56:41 2001
+++ crossfire-client-1.1.0-et/x11/png.c	Mon Jan  7 22:45:25 2002
@@ -62,6 +62,8 @@
     data_start += length;
 }
 
+#ifdef PNG_GDK
+
 uint8 *png_to_data(unsigned char *data, int len, int *width, int *height)
 {
     uint8 *pixels=NULL;
@@ -217,13 +219,14 @@
  */
 #define RATIO	100
 
-#define MAX_IMAGE_BYTES	512*512
+#define MAX_IMAGE_WIDTH		1024
+#define MAX_IMAGE_HEIGHT	1024
 #define BPP 4
 
 uint8 *rescale_rgba_data(uint8 *data, int *width, int *height, int scale)
 {
-    static    int xrow[BPP * MAX_IMAGE_BYTES], yrow[BPP*MAX_IMAGE_BYTES];
-    static  uint8  *nrows[MAX_IMAGE_BYTES];
+    static    int xrow[BPP * MAX_IMAGE_WIDTH], yrow[BPP*MAX_IMAGE_HEIGHT];
+    static  uint8  *nrows[MAX_IMAGE_HEIGHT];
 
     /* Figure out new height/width */
     int new_width = *width  * scale / RATIO, new_height = *height * scale / RATIO;
@@ -234,6 +237,13 @@
     uint8 *ndata;
     uint8 r,g,b,a;
 
+    if (*width > MAX_IMAGE_WIDTH || new_width > MAX_IMAGE_WIDTH
+    || *height > MAX_IMAGE_HEIGHT || new_height > MAX_IMAGE_HEIGHT)
+    {
+	fprintf(stderr, "Image too big\n");
+	exit(0);
+    }
+
     /* clear old values these may have */
     memset(yrow, 0, sizeof(int) * *height * BPP);
 
@@ -365,7 +375,6 @@
     return ndata;
 }
 
-#ifdef PNG_GDK
 
 guchar rgb[512*512*3];	/* Make this especially big to support larger images in the future */
 
@@ -611,6 +620,8 @@
 }
 
 #else
+
+
 static XImage   *ximage;
 static int rmask=0, bmask=0,gmask=0,need_color_alloc=0, rshift=16, bshift=0, gshift=8,
     rev_rshift=0, rev_gshift=0, rev_bshift=0;
diff -ruN crossfire-client-1.1.0/x11/x11.c crossfire-client-1.1.0-et/x11/x11.c
--- crossfire-client-1.1.0/x11/x11.c	Fri Dec 28 09:56:41 2001
+++ crossfire-client-1.1.0-et/x11/x11.c	Mon Jan  7 21:59:11 2002
@@ -149,6 +149,8 @@
     uint32  weight_limit;   /* Weight limit for this list - used for title */
 } itemlist;
 
+int noautorepeat = FALSE;	/* turn off autorepeat detection */
+
 static char *font_name="8x13",	**gargv;
 struct Map the_map;
 
@@ -182,7 +184,8 @@
 Display_Mode display_mode = DISPLAY_MODE;
 uint8 cache_images=FALSE;
 Display *display;
-long screen_num;
+static Window def_root;	/* default root window */
+static long def_screen;	/* default screen number */
 static unsigned long foreground,background;
 Window win_stats,win_message;
 Window win_root,win_game;
@@ -246,11 +249,11 @@
 #define XPMGCS 100
 
 enum {
-    locked_icon = 1, applied_icon, unpaid_icon,
+    no_icon = 0, locked_icon, applied_icon, unpaid_icon,
     damned_icon, cursed_icon, magic_icon, close_icon, 
     stipple1_icon, stipple2_icon, max_icons
 };
-static struct PixmapInfo icons[max_icons];
+static Pixmap icons[max_icons];
 
 static Pixmap icon,xpm_pixmap,xpm_masks[XPMGCS]; 
 static GC gc_root,gc_stats,gc_message,
@@ -442,7 +445,7 @@
 	(_Xconst char *) crossfire_bits,
 	(unsigned int) crossfire_width, (unsigned int)crossfire_height);
     if (split_windows) {
-	iscolor=allocate_colors(display, win_root, screen_num,
+	iscolor=allocate_colors(display, win_root, def_screen,
 	    &colormap, discolor);
 	if (iscolor){
 	    foreground=discolor[0].pixel;
@@ -479,8 +482,7 @@
 	gc_xpm_object = XCreateGC(display,win_game,0,0);
 	XSetGraphicsExposures(display, gc_xpm_object, False);
 	XSetClipOrigin(display, gc_xpm_object,0, 0);
-	xpm_pixmap = XCreatePixmap(display, RootWindow(display,
-		DefaultScreen(display)), image_size, image_size, 
+	xpm_pixmap = XCreatePixmap(display, def_root, image_size, image_size, 
 		DefaultDepth(display, DefaultScreen(display)));
 	gc_clear_xpm = XCreateGC(display,xpm_pixmap,0,0);
 	XSetGraphicsExposures(display,gc_clear_xpm,False);
@@ -1471,22 +1473,12 @@
  ****************************************************************************/
 
 
-#if 1
-/* Do nothing - status icons are not being created - FIX THIS */
-#define draw_status_icon(l,x,y,face) 
+static void draw_status_icon(itemlist *l, int x, int y, int face)
+{
+    XCopyPlane(display, icons[face], l->win, l->gc_status, 0,0, 24,6, x,y, 1);
+}
+
 
-#else
-#define draw_status_icon(l,x,y,face) \
-do { \
-    XClearArea(display, l->win, x, y, 24, 6, False); \
-    if (face) { \
-	XSetClipMask(display, l->gc_status, icons[face].mask), \
-	XSetClipOrigin(display, l->gc_status, x, y), \
-	XCopyArea(display, icons[face].pixmap, l->win, l->gc_status, \
-		  0, 0, 24, 6, x, y); \
-    } \
-} while (0)
-#endif
 /* compares the 'flags' against the item.  return 1 if we should draw
  * that object, 0 if it should not be drawn.
  */
@@ -1513,55 +1505,42 @@
 
 static void create_status_icons ()
 {
+#include "pixmaps/clear.xbm"
+#include "pixmaps/locked.xbm"
+#include "pixmaps/applied.xbm"
+#include "pixmaps/unpaid.xbm"
+#include "pixmaps/damned.xbm"
+#include "pixmaps/cursed.xbm"
+#include "pixmaps/magic.xbm"
+#include "pixmaps/close.xbm"
 #include "pixmaps/stipple.111"
 #include "pixmaps/stipple.112"
-#if 0
-#include "pixmaps/locked.xpm"
-#include "pixmaps/unpaid.xpm"
-#include "pixmaps/applied.xpm"
-#include "pixmaps/magic.xpm"
-#include "pixmaps/damned.xpm"
-#include "pixmaps/cursed.xpm"
-#include "pixmaps/close.xpm"
     static int hasinit=0;
 
     if (hasinit) return;
     hasinit=1;
 
-
-    if (XpmCreatePixmapFromData(display, RootWindow(display, screen_num), 
-				locked_xpm, &(icons[locked_icon].pixmap), 
-				&(icons[locked_icon].mask), NULL)
-	|| XpmCreatePixmapFromData(display, RootWindow(display, screen_num), 
-				applied_xpm, &(icons[applied_icon].pixmap), 
-				&(icons[applied_icon].mask), NULL)
-	|| XpmCreatePixmapFromData(display, RootWindow(display, screen_num), 
-				unpaid_xpm, &(icons[unpaid_icon].pixmap), 
-				&(icons[unpaid_icon].mask), NULL)
-	|| XpmCreatePixmapFromData(display, RootWindow(display, screen_num), 
-				magic_xpm, &(icons[magic_icon].pixmap), 
-				&(icons[magic_icon].mask), NULL)
-	|| XpmCreatePixmapFromData(display, RootWindow(display, screen_num), 
-				damned_xpm, &(icons[damned_icon].pixmap), 
-				&(icons[damned_icon].mask), NULL)
-	|| XpmCreatePixmapFromData(display, RootWindow(display, screen_num), 
-				cursed_xpm, &(icons[cursed_icon].pixmap), 
-				&(icons[cursed_icon].mask), NULL)
-	|| XpmCreatePixmapFromData(display, RootWindow(display, screen_num), 
-				close_xpm, &(icons[close_icon].pixmap), 
-				&(icons[close_icon].mask), NULL)) {
-	fprintf(stderr, "Unable to create icon pixmaps.\n");
+#define CREATEPM(name,data) \
+    (icons[name] = XCreateBitmapFromData(display, def_root,\
+			    data##_bits, data##_width, data##_height))
+
+    if (0
+	|| CREATEPM(no_icon, clear) == None
+	|| CREATEPM(locked_icon, locked) == None
+	|| CREATEPM(applied_icon, applied) == None
+	|| CREATEPM(unpaid_icon, unpaid) == None
+	|| CREATEPM(damned_icon, damned) == None
+	|| CREATEPM(cursed_icon, cursed) == None
+	|| CREATEPM(magic_icon, magic) == None
+	|| CREATEPM(close_icon, close) == None
+	|| CREATEPM(stipple1_icon, stipple) == None
+	|| CREATEPM(stipple2_icon, stipple1) == None
+    )
+    {
+	fprintf(stderr, "Unable to create pixmaps.\n");
 	exit (0);
     }
-#endif
-    icons[stipple1_icon].bitmap = XCreateBitmapFromData(display, 
-	RootWindow(display, screen_num), (char*)stipple_bits, 24, 24);
-    icons[stipple2_icon].bitmap = XCreateBitmapFromData(display, 
-	RootWindow(display, screen_num), (char*)stipple1_bits, 24, 24);
-    if (icons[stipple1_icon].bitmap==None || icons[stipple2_icon].bitmap==None) {
-	fprintf(stderr, "Unable to create stipple pixmaps.\n");
-	exit(0);
-    }
+#undef CREATEPM
 }
 
 /*
@@ -1598,13 +1577,8 @@
 		l->weight_limit/1000);
 
     if (strcmp (buf, l->old_title)) {
-	XClearArea(display, l->win, 2, 2, image_size, 13, False);
-	if (l->env->open) {
-	    XSetClipMask(display, l->gc_status, icons[close_icon].mask);
-	    XSetClipOrigin(display, l->gc_status, 2, 2);
-	    XCopyArea(display, icons[close_icon].pixmap, l->win, l->gc_status,
-		      0, 0, image_size, 13, 2, 2); \
-	}
+	XCopyPlane(display, icons[l->env->open ? close_icon : no_icon], 
+			    l->win, l->gc_status, 0,0, image_size,13, 2,2, 1);
 	strcpy (l->old_title, buf);
 	XDrawImageString(display, l->win, l->gc_text, 
 			 (l->show_icon ? image_size+24+4 : image_size+4),
@@ -1638,24 +1612,24 @@
 	/* draw status icon */
 	if (l->show_icon) {
 	    sint8 tmp_icon;
-	    tmp_icon = tmp->locked ? locked_icon : 0;
+	    tmp_icon = tmp->locked ? locked_icon : no_icon;
 	    if (l->icon1[i] != tmp_icon) {
 		l->icon1[i] = tmp_icon;
 		draw_status_icon (l, image_size+4, 16 + image_size * i, tmp_icon);
 	    }
 	    tmp_icon = tmp->applied ? applied_icon :
-		       tmp->unpaid  ? unpaid_icon : 0;
+		       tmp->unpaid  ? unpaid_icon : no_icon;
 	    if (l->icon2[i] != tmp_icon) {
 		l->icon2[i] = tmp_icon;
 		draw_status_icon (l, image_size+4, 22 + image_size * i, tmp_icon);
 	    }
-	    tmp_icon = tmp->magical ? magic_icon : 0;
+	    tmp_icon = tmp->magical ? magic_icon : no_icon;
 	    if (l->icon3[i] != tmp_icon) {
 		l->icon3[i] = tmp_icon;
 		draw_status_icon (l, image_size+4, 28 + image_size * i, tmp_icon);
 	    }
 	    tmp_icon = tmp->damned ? damned_icon : 
-		       tmp->cursed ? cursed_icon : 0;
+		       tmp->cursed ? cursed_icon : no_icon;
 	    if (l->icon4[i] != tmp_icon) {
 		l->icon4[i] = tmp_icon;
 		draw_status_icon (l, image_size+4, 34 + image_size * i, tmp_icon);
@@ -1746,6 +1720,17 @@
     draw_list (l);
 }
 
+
+/* we have received new images.  update these only */
+static void update_icons_list(itemlist *l)
+{
+    int i;
+    for (i = 0; i < l->size; ++i)
+	l->faces[i] = 0;
+    draw_list(l);
+}
+
+
 void open_container (item *op) 
 {
     look_list.env = op;
@@ -1866,7 +1851,7 @@
 static int get_inv_display()
 {
     inv_list.env = cpl.ob;
-    strcpy (inv_list.title, "Inventory:");
+    strcpy (inv_list.title, ""/*ET: too long: "Inventory:"*/);
     inv_list.show_weight = 1;
     inv_list.show_what = show_all;
     inv_list.weight_limit=0;
@@ -1952,6 +1937,13 @@
     }
 }
 
+void set_autorepeat(char *s)
+{
+    noautorepeat = noautorepeat ? FALSE : TRUE;
+    draw_info(noautorepeat ? "Autorepeat is disabled":"Autorepeat is enabled",
+	      NDI_BLACK);
+}
+
 int get_info_width()
 {
     return infodata.info_chars;
@@ -1992,6 +1984,9 @@
     if ((getenv("ERIC_SYNC")!= NULL) || sync_display)
 	XSynchronize(display,True);
 
+    def_root = DefaultRootWindow(display);
+    def_screen = DefaultScreen(display);
+
     /* For both split_windows and display mode, check to make sure that
      * the command line has not set the value.  Command line settings
      * should always have precedence over settings in the Xdefaults file.
@@ -2027,10 +2022,20 @@
     if ((cp=XGetDefault(display,X_PROG_NAME, "scrollLines"))!=NULL) {
 	infodata.maxlines=atoi(cp);
     }
+    if ((cp=XGetDefault(display,X_PROG_NAME,"font")) != NULL) {
+	font_name = strdup_local(cp);
+    }
+    /* Failure will result in an uncaught X11 error */
+    font=XLoadQueryFont(display,font_name);
+    if (!font) {
+	fprintf(stderr,"Could not load font %s\n", font_name);
+	exit(1);
+    }
+    FONTWIDTH=font->max_bounds.width;
+    FONTHEIGHT=font->max_bounds.ascent + font->max_bounds.descent;
 
-    screen_num=DefaultScreen(display);
-    background=WhitePixel(display,screen_num);
-    foreground=BlackPixel(display,screen_num);
+    background=WhitePixel(display,def_screen);
+    foreground=BlackPixel(display,def_screen);
     roothint.x=0;
     roothint.y=0;
     roothint.width=582+6+INFOCHARS*FONTWIDTH;
@@ -2045,14 +2050,14 @@
     }
     roothint.max_width=roothint.min_width=roothint.width;
     roothint.max_height=roothint.min_height=roothint.height;
-    roothint.flags=PPosition | PSize;
+    roothint.flags=PSize; /*ET: no PPosition. let window manager handle that. */
 
     if(!split_windows) {
-	win_root=XCreateSimpleWindow(display,DefaultRootWindow(display),
+	win_root=XCreateSimpleWindow(display,def_root,
 	    roothint.x,roothint.y,roothint.width,roothint.height,2,
 	    background,foreground);
 
-	iscolor=allocate_colors(display, win_root, screen_num,
+	iscolor=allocate_colors(display, win_root, def_screen,
 	    &colormap, discolor);
 	if (iscolor){
 	    foreground=discolor[0].pixel;
@@ -2066,27 +2071,15 @@
 	gc_root=XCreateGC(display,win_root,0,0);
 	XSetForeground(display,gc_root,foreground);
 	XSetBackground(display,gc_root,background);
-    }
-    else win_root = DefaultRootWindow(display);
-
 
-    if(!split_windows) {
 	XSelectInput(display,win_root,KeyPressMask|
 	     KeyReleaseMask|ExposureMask|StructureNotifyMask);
 	XMapRaised(display,win_root);
-	XNextEvent(display,&event);
-    }
-    if ((cp=XGetDefault(display,X_PROG_NAME,"font")) != NULL) {
-	font_name = strdup_local(cp);
-    }
-    /* Failure will result in an uncaught X11 error */
-    font=XLoadQueryFont(display,font_name);
-    if (!font) {
-	fprintf(stderr,"Could not load font %s\n", font_name);
-	exit(1);
+	XNextEvent(display,&event);	/*ET: this is bogus */
     }
-    FONTWIDTH=font->max_bounds.width;
-    FONTHEIGHT=font->max_bounds.ascent + font->max_bounds.descent;
+    else
+	win_root = def_root;
+
     return 0;
 }
 
@@ -2226,7 +2219,7 @@
  * do this anyways, so it is not a problem.
  */
 
-static void do_key_press()
+static void do_key_press(int repeated)
 {
     KeySym gkey;
     char text[10];
@@ -2249,7 +2242,7 @@
     }
     switch(cpl.input_state) {
 	case Playing:
-	    parse_key(text[0],event.xkey.keycode,gkey);
+	    parse_key(text[0],event.xkey.keycode,gkey,repeated);
 	    break;
 
 	case Reply_One:
@@ -2432,7 +2425,7 @@
     draw_prompt(":");
     while (cpl.input_state == Metaserver_Select) {
 	check_x_events();
-	usleep(100);
+	usleep(50000);	/* 1/20 sec */
     } /* while input state is metaserver select. */
 
     /* We need to clear out cpl.input_text - otherwise the next
@@ -2461,6 +2454,7 @@
 void check_x_events() {
     KeySym gkey=0;
     static int lastupdate=0;
+    static XEvent prev_event;	/* to detect autorepeated keys */
 
     /* If not connected, the below area does not apply, so don't deal with it */
     if (cpl.input_state != Metaserver_Select) {
@@ -2473,8 +2467,8 @@
 	 * especially since we might get a bunch of images at the same time.
 	 */
 	if (cache_images && lastupdate>5 && newimages) {
-	    draw_all_list(&inv_list);
-	    draw_all_list(&look_list);
+	    update_icons_list(&inv_list);
+	    update_icons_list(&look_list);
 	    if (!cpl.showmagic) display_map_doneupdate(TRUE);
 	    newimages=0;
 	    lastupdate=0;
@@ -2488,6 +2482,7 @@
   
 
     while (XPending(display)!=0) {
+	prev_event = event;
 	XNextEvent(display,&event);
 	switch(event.type) {
 
@@ -2561,7 +2556,14 @@
 		break;
 
 	    case KeyPress:
-		do_key_press();
+		if (noautorepeat
+		    && prev_event.type == KeyRelease
+		    && prev_event.xkey.keycode == event.xkey.keycode
+		    && prev_event.xkey.state == event.xkey.state
+		    && prev_event.xkey.time == event.xkey.time)
+		    do_key_press(1);	/* auto-repeated key */
+		else
+		    do_key_press(0);	/* regular key */
 		break;
 	}
     }
@@ -2625,6 +2627,7 @@
     puts("-font <name>     - Use <name> as font to display data.");
     puts("-pngfile <name>  - Use <name> for source of images");
     puts("-mapsize xXy     - Set the mapsize to be X by Y spaces.");
+    puts("-noautorepeat    - Auto repeat on directional keys is ignored.");
     exit(0);
 }
 
@@ -2788,6 +2791,10 @@
 	    keepcache=TRUE;
 	    continue;
 	}
+	else if (!strcmp(argv[on_arg],"-autorepeat")) {
+	    noautorepeat=TRUE;
+	    continue;
+	}
 	else {
 	    fprintf(stderr,"Do not understand option %s\n", argv[on_arg]);
 	    usage(argv[0]);
@@ -3073,9 +3080,7 @@
 	}
     }
 
-    bitmap = XCreateBitmapFromData(display,
-                               RootWindow(display,DefaultScreen(display)),
-                               buf,image_size,image_size);
+    bitmap = XCreateBitmapFromData(display,def_root,buf,image_size,image_size);
     newimages++;
     pixmaps[face].bitmap = bitmap;
     pixmaps[face].fg = fg;
@@ -3171,12 +3176,12 @@
 		} else { /* interesting object */
 		    
 		    if ((val & FACE_COLOR_MASK)==0)
-			XCopyPlane(display, icons[stipple2_icon].bitmap,
+			XCopyPlane(display, icons[stipple2_icon],
 			       win_game, gc_game,
 			       0, 0, cpl.mapxres,cpl.mapyres, 2+cpl.mapxres*x, 2+cpl.mapyres*y,
 			       1);
 		    else
-			XCopyPlane(display, icons[stipple1_icon].bitmap,
+			XCopyPlane(display, icons[stipple1_icon],
 			       win_game, gc_game,
 			       0, 0, cpl.mapxres,cpl.mapyres, 2+cpl.mapxres*x, 2+cpl.mapyres*y,
 			       1);
@@ -3399,6 +3404,15 @@
 	    else cpl.food_beep=FALSE;
 	    continue;
 	}
+	if (!strcmp(inbuf,"noautorepeat")) {
+	    if (!strcmp(cp,"True")) noautorepeat=TRUE;
+	    else noautorepeat=FALSE;
+	    continue;
+	}
+	if (!strcmp(inbuf,"font")) {
+	    font_name = strdup_local(cp);
+	    continue;
+	}
 	fprintf(stderr,"Got line we did not understand: %s: %s\n", inbuf, cp);
     }
     fclose(fp);
@@ -3421,7 +3435,7 @@
     fprintf(fp,"# This file is generated automatically by cfclient.\n");
     fprintf(fp,"# Manually editing is allowed, however cfclient may be a bit finicky about\n");
     fprintf(fp,"# some of the matching it does.  all comparissons are case sensitive.\n");
-    fprintf(fp,"# 'True' and 'False' are the proper cases for those two values");
+    fprintf(fp,"# 'True' and 'False' are the proper cases for those two values\n");
 
     fprintf(fp,"port: %d\n", port_num);
     fprintf(fp,"server: %s\n", server);
@@ -3430,6 +3444,7 @@
     } else if (display_mode==Png_Display) {
 	fprintf(fp,"display: png\n");
     }
+    fprintf(fp,"font: %s\n", font_name);
     fprintf(fp,"cacheimages: %s\n", cache_images?"True":"False");
     fprintf(fp,"split: %s\n", split_windows?"True":"False");
     fprintf(fp,"showicon: %s\n", inv_list.show_icon?"True":"False");
@@ -3438,6 +3453,7 @@
     fprintf(fp,"sound: %s\n", nosound?"False":"True");
     fprintf(fp,"command_window: %d\n", cpl.command_window);
     fprintf(fp,"foodbeep: %s\n", cpl.food_beep?"True":"False");
+    fprintf(fp,"noautorepeat: %s\n", noautorepeat?"True":"False");
 
     fclose(fp);
     sprintf(buf,"Defaults saved to %s",path);
Binary files crossfire-client-1.1.0/x11/x11.c.swp and crossfire-client-1.1.0-et/x11/x11.c.swp differ
diff -ruN crossfire-client-1.1.0/x11/x11.h crossfire-client-1.1.0-et/x11/x11.h
--- crossfire-client-1.1.0/x11/x11.h	Fri Dec 28 09:56:41 2001
+++ crossfire-client-1.1.0-et/x11/x11.h	Mon Jan  7 18:56:56 2002
@@ -58,7 +58,6 @@
 
 extern struct PixmapInfo pixmaps[MAXPIXMAPNUM];
 extern Display *display;
-extern long screen_num;
 extern uint8   image_size;
 extern Window win_root,win_game;
 extern GC gc_game;
diff -ruN crossfire-client-1.1.0/x11/x11proto.h crossfire-client-1.1.0-et/x11/x11proto.h
--- crossfire-client-1.1.0/x11/x11proto.h	Fri Dec 28 09:56:41 2001
+++ crossfire-client-1.1.0-et/x11/x11proto.h	Mon Jan  7 17:19:32 2002
@@ -24,6 +24,7 @@
 extern void set_show_weight(char *s);
 extern void set_weight_limit(uint32 wlim);
 extern void set_scroll(char *s);
+extern void set_autorepeat(char *s);
 extern int get_info_width(void);
 extern char *get_metaserver(void);
 extern void check_x_events(void);
@@ -58,7 +59,7 @@
 extern void parse_keybind_line(char *buf, int line, int standard);
 extern void init_keys(void);
 extern void parse_key_release(KeyCode kc, KeySym ks);
-extern void parse_key(char key, KeyCode keycode, KeySym keysym);
+extern void parse_key(char key, KeyCode keycode, KeySym keysym, int repeated);
 extern void bind_key(char *params);
 extern void configure_keys(KeyCode k, KeySym keysym);
 extern void unbind_key(char *params);
diff -ruN crossfire-client-1.1.0/x11/xutil.c crossfire-client-1.1.0-et/x11/xutil.c
--- crossfire-client-1.1.0/x11/xutil.c	Fri Dec 28 09:56:41 2001
+++ crossfire-client-1.1.0-et/x11/xutil.c	Mon Jan  7 22:21:17 2002
@@ -51,7 +51,7 @@
 "White",                /* 1  */
 "Navy",                 /* 2  */
 "Red",                  /* 3  */
-"Orange",               /* 4  */
+"Chocolate",            /* 4  was Orange, but impossible to read on DarkSeaGreen */
 "DodgerBlue",           /* 5  */
 "DarkOrange2",          /* 6  */
 "SeaGreen",             /* 7  */
@@ -145,19 +145,16 @@
      */
 
     pixmaps[0].mask=None;
-    pixmaps[0].bitmap=XCreateBitmapFromData(display, 
-	RootWindow(display, screen_num), (const char*)question_bits, image_size,image_size);
+    pixmaps[0].bitmap=XCreateBitmapFromData(display,DefaultRootWindow(display),
+				question_bits,question_width,question_height);
 
     /* In xpm mode, XCopyArea is used from this data, so we need to copy
      * the image into an pixmap of appropriate depth.
-     * Note that while are image created is the image size, since we know
-     * that are filler image is currently only 24x24, we only copy that much
-     * data.
      */
     pixmaps[0].pixmap=XCreatePixmap(display, win_root, image_size, image_size, 
 	DefaultDepth(display,DefaultScreen(display)));
     XCopyPlane(display, pixmaps[0].bitmap, pixmaps[0].pixmap, gc_game,
-	       0,0,24,24,0,0,1);
+	       0,0,image_size,image_size,0,0,1);
 		
     pixmaps[0].bg = 0;
     pixmaps[0].fg = 1;
@@ -187,9 +184,9 @@
 {
     char buf[MAX_BUF];
 
+    //printf("requestface: %s (%d)\n", facename, pnum);//@@@
     facetoname[pnum] = strdup_local(facepath);
-    sprintf(buf,"askface %d", pnum);
-    cs_write_string(csocket.fd, buf, strlen(buf));
+    cs_print_string(csocket.fd, "askface %d", pnum);
     /* Need to make sure we have the directory */
     sprintf(buf,"%s/%c%c", facecachedir, facename[0], facename[1]);
     if (access(buf,R_OK)) make_path_to_dir(buf);
@@ -294,8 +291,7 @@
 
     } else if (display_mode==Pix_Display) {
 	pixmaps[pnum].bitmap = XCreateBitmapFromData(display,
-		RootWindow(display,DefaultScreen(display)),
-		(char*)data,24,24);
+				DefaultRootWindow(display), (char*)data,24,24);
 	pixmaps[pnum].fg = (data[24] << 24) + (data[25] << 16) + (data[26] << 8) +
 	    data[27];
 	pixmaps[pnum].bg = (data[28] << 24) + (data[29] << 16 )+ (data[30] << 8 )+
@@ -720,7 +716,7 @@
 /* This parses a keypress.  It should only be called when in Playing
  * mode.
  */
-void parse_key(char key, KeyCode keycode, KeySym keysym)
+void parse_key(char key, KeyCode keycode, KeySym keysym, int repeated)
 {
     Key_Entry *keyentry, *first_match=NULL;
     int present_flags=0;
@@ -809,10 +805,12 @@
 		run_dir(first_match->direction);
 		sprintf(buf,"run %s", first_match->command);
 	    }
-	    else {
+	    else if (!repeated) {
 		strcpy(buf,first_match->command);
 		extended_command(first_match->command);
 	    }
+	    else
+		sprintf(buf,"move %s (ignored)", first_match->command);
 	    if (cpl.echo_bindings) draw_info(buf,NDI_BLACK);
 	}
         else {
@@ -1503,8 +1501,7 @@
 	}
     }
     
-    cs_write_string( csocket.fd, "mapredraw", 9);
-    
+    cs_print_string(csocket.fd, "mapredraw");
     return;
 }
 
    
    


More information about the crossfire mailing list