/* * XScrabble - X version of the popular board game, for 1 to 4 players. * * This software comes with NO warranty whatsoever. I therefore take no * responsibility for any damages, losses or problems caused through use * or misuse of this program. * * I hereby grant permission for this program to be freely copied and * distributed by any means, provided no charge is made for it. * * Matthew Chapman, csuoq@csv.warwick.ac.uk * Mov 1994. */ /* mess.c - multiperson message system */ #include "scrab.h" #include "globals.h" #include #include extern char app_def_file[256]; Widget messmain[MAXPLAYERS],messentry[MAXPLAYERS],messf[MAXPLAYERS]; Widget messdismiss[MAXPLAYERS],ping[MAXPLAYERS]; XawTextPosition pos=0; void KeyRedirect(Widget w, XEvent *event,String *params,Cardinal num_params) { int dnum; for (dnum=0; dpy[dnum] != XtDisplay(w); dnum++) ; event->xany.window = XtWindow(messentry[dnum]); XtDispatchEvent(event); } void AddChar(Widget w, char *c) { XawTextBlock txt; txt.firstPos=0; txt.format=FMT8BIT; txt.length=strlen(c); txt.ptr=c; XawTextReplace(w, pos, pos, &txt); pos+=txt.length; XawTextSetInsertionPoint(w,pos); } void DoMessage(Widget w,XExposeEvent *event,String *params,Cardinal *num_params) { String line; int dnum,i; for (dnum=0; dpy[dnum] != XtDisplay(w); dnum++) ; /* send message to all human players */ XtVaGetValues(w,XtNstring,&line,NULL); if (strlen(line)>0) for (i=0; i