1    | /*
2    |  * $Log: ml_set.c,v $
3    |  * Revision 1.51  2003/08/27 12:04:56  millis
4    |  * Fix bug 222
5    |  *
6    |  * Revision 1.50  2003/08/26 23:54:32  millis
7    |  * Fix bug 188
8    |  *
9    |  * Revision 1.49  2003/08/23 09:59:47  russblau
10   |  * deleted commented-out keywords
11   |  *
12   |  * Revision 1.48  2003/08/10 15:27:51  millis
13   |  * Fix bug 25 (Add TouchPress)
14   |  *
15   |  * Revision 1.47  2003/06/29 01:06:58  millis
16   |  * Fix bug 176 (duplicate grace setting line to master)
17   |  *
18   |  * Revision 1.46  2003/05/24 23:57:15  millis
19   |  * Bug 97, removed Generic Handling code
20   |  *
21   |  * Revision 1.45  2003/05/24 22:55:43  millis
22   |  * Bug 142, allow use of AutoCreate flag
23   |  *
24   |  * Revision 1.44  2003/05/16 20:37:45  millis
25   |  * Small compile error fix.
26   |  *
27   |  * Revision 1.43  2003/05/15 00:09:46  russblau
28   |  * Corrected errors in keyword arrays, and commented out very many redundant entries.
29   |  *
30   |  * Revision 1.42  2003/05/10 00:33:37  millis
31   |  * Fix bug 125, removing money also disables loans, assassinations and special units
32   |  *
33   |  * Revision 1.41  2003/05/05 11:52:49  millis
34   |  * Slight text improvement
35   |  *
36   |  * Revision 1.40  2003/05/03 23:33:50  millis
37   |  * Fix bug 150 (NO_GARRISONS flag)
38   |  *
39   |  * Revision 1.39  2003/05/03 14:22:51  millis
40   |  * Really small change
41   |  *
42   |  * Revision 1.38  2003/05/03 14:19:33  millis
43   |  * Merged in USTV version, with Neutrals etc.
44   |  *
45   |  * Revision 1.37  2003/04/16 04:34:42  millis
46   |  * Implement Bug 65
47   |  *
48   |  * Revision 1.36  2003/03/07 21:24:09  russblau
49   |  * Editorial changes.
50   |  *
51   |  * Revision 1.35  2003/02/28 22:27:28  russblau
52   |  * Minor changes to documentation; "SET BROADCAST" should now work as described
53   |  * in documentation (but kept previous form "SET NORMAL BROADCAST" for backwards
54   |  * compatibility).
55   |  *
56   |  * Revision 1.34  2003/02/28 20:16:43  nzmb
57   |  * Changed the name of resignation ratio to CD ratio, to avoid confusion with
58   |  * Doug Massey's DRR.
59   |  *
60   |  * Revision 1.33  2003/02/25 11:11:24  russblau
61   |  * Improved absence documentation and related Judge message strings.
62   |  *
63   |  * Revision 1.32  2003/02/17 15:39:20  millis
64   |  * bug 10, prevent overlapping absences
65   |  * Also improve text output for absences.
66   |  *
67   |  * Revision 1.31  2003/01/15 13:59:26  millis
68   |  * Removed Dipstats
69   |  *
70   |  * Revision 1.30  2003/01/14 13:51:37  millis
71   |  * Merges from USTV
72   |  *
73   |  * Revision 1.29  2002/12/28 01:00:57  millis
74   |  * Small text change
75   |  *
76   |  * Revision 1.28  2002/12/28 00:52:19  millis
77   |  * Proper fix to CR 17
78   |  *
79   |  * Revision 1.27  2002/12/28 00:42:54  millis
80   |  * Implement bug 17, noBcentres option (to hide others centres in blind)
81   |  *
82   |  * Revision 1.26  2002/08/27 22:27:54  millis
83   |  * Updated for automake/autoconf functionality
84   |  *
85   |  * Revision 1.25  2002/07/17 16:50:44  nzmb
86   |  *
87   |  * Fixed up mistake in PRV array, added more flexibility to commands.
88   |  *
89   |  * Revision 1.24  2002/07/16 18:14:22  nzmb
90   |  * Many changes dealing with the addition of szine style postal press. Also 
91   |  * fixed apparent bug in signons for games which have not started.
92   |  *
93   |  * Revision 1.23  2002/06/11 16:26:19  nzmb
94   |  *
95   |  * Added set [no]mustorder to require players to submit avalid set of orders
96   |  * before they may send press (to be used in conjunction with set wait).
97   |  *
98   |  * Revision 1.22  2002/05/11 09:15:33  greg
99   |  * Minor bug fixes
100  |  * - fixed subjectline for absence requests
101  |  * - fixed phase length, so it's no longer hard coded for responses
102  |  * - partial fix for unusable builds, players with only unusable builds
103  |  *    will no longer be flagged as having orders due, however players
104  |  *    with some usable builds will need to waive any unusable builds,
105  |  *    also, if one or more players have unusable builds, but no
106  |  *    player has usable builds, the build phase will process after
107  |  *    a short delay
108  |  *
109  |  * Revision 1.21  2002/04/18 04:44:32  greg
110  |  * Added the following commands:
111  |  * - unstart
112  |  * - set secret
113  |  * - set [prflist|prfrand|prfboth]
114  |  *
115  |  * Fixed Set Absence so that "to" is not case sensitive
116  |  *
117  |  * Fixed Quiet games so that new players are announced
118  |  * before the game starts
119  |  *
120  |  * Fixed ascii_to_ded.c so thatit no longer generates an
121  |  * error when compiled
122  |  *
123  |  * Revision 1.20  2002/04/15 12:55:44  miller
124  |  * Multiple changes for blind & Colonial & setup from USTV
125  |  *
126  |  * Revision 1.19  2002/02/25 12:35:14  miller
127  |  * mall compile error fix
128  |  *
129  |  * Revision 1.18  2002/02/25 11:51:52  miller
130  |  * Various updates for Machiavelli bug fixes
131  |  *
132  |  * Revision 1.17  2001/11/11 21:16:21  greg
133  |  * Subjectline Fixes
134  |  *  - New player signons will no longer show "Preference Change"
135  |  *  - Manual start games will no longer say "Waiting for More Players" after 
136  |  *    the game is full
137  |  *  - reply lines no longer assume JUDGE_CODE is four characters
138  |  *
139  |  * Revision 1.16  2001/10/20 12:11:13  miller
140  |  * Merged in changes from DEMA and USTV 
141  |  *
142  |  * Revision 1.15.2.3  2001/10/19 23:55:13  dedo
143  |  * Remove warning for over-large string literal
144  |  *
145  |  * Revision 1.15.2.2  2001/10/19 23:43:02  dema
146  |  * Allowed seting/clearing of NoMoney flag and Basic/Advanced
147  |  *
148  |  * Revision 1.15.2.1  2001/10/15 22:23:18  ustv
149  |  * Merged concessions, duality and Colonial flags
150  |  *
151  |  * Revision 1.15  2001/08/31 02:03:01  greg
152  |  * added "Ready to Start" subjectline for manual start games
153  |  *
154  |  * Revision 1.14  2001/08/30 05:01:30  nzmb
155  |  * Modified second argument of calls to check_can_vote.
156  |  *
157  |  * Revision 1.11  2001/07/22 10:03:32  greg
158  |  * customized subjectline for player's preference change
159  |  *
160  |  * Revision 1.10  2001/07/15 09:17:53  greg
161  |  * added support for game directories in a sub directory
162  |  *
163  |  * Revision 1.9  2001/07/08 23:00:05  miller
164  |  * New commands XF_COSTALCONVOY, MOVEDISBAND
165  |  *
166  |  * Revision 1.8  2001/07/01 23:19:29  miller
167  |  * Add costal convoys
168  |  *
169  |  * Revision 1.7  2001/06/24 05:49:30  nzmb
170  |  * Added functionality to set ontime ratio, CD ratio in a game.
171  |  *
172  |  * Revision 1.5  2001/05/14 22:58:21  miller
173  |  * Corrected transformation setting/display. Also disabled Mach1,2,3 flags 
174  |  * (to be removed later for good).
175  |  *
176  |  * Revision 1.4  2001/05/10 08:33:25  greg
177  |  * added subjectlines
178  |  *
179  |  * Revision 1.3  2001/04/15 21:21:22  miller
180  |  * Add SET_(NO)ATTACKTRANS flag settings
181  |  *
182  |  * Revision 1.2  2000/11/14 14:27:37  miller
183  |  * ENORMOUS number of changes, including:
184  |  *  - Checks to warn if trying to set 'silly' options  (for example, Mach 
185  |  *    options in non-Mach game, press options in nopress game etc.)
186  |  *  - Check when a quorum exists to start the game if number of plyers is 
187  |  *    changed
188  |  *  - Show players' preferences to master
189  |  *  - New general purpose function to ease flag setting/resetting
190  |  *  - setting of absence delay checks (non-master cannot be greater than game 
191  |  *    limit)
192  |  *  - New commands, which are:
193  |  *     SET_(NO)LATECOUNT, SET_(NO)STRCONVOY, SET(NO)LATEPRESS, SET(NO)MANUALPROC,
194  |  *     SET_(NO)MANSTART, SET_(NO)TRANSFORM, SET_(ANY/ONE/HOME)CENTRES,
195  |  *     SET_(NO)ABSENCE, SET_MAXABSENCE, SET_(NO)NORMBROAD, SET_(NO)BLANKPRESS,
196  |  *     SET_(NO)MINORPRESS, SET_MAC(1/2/3), SET_(NO)AIRLIFT, SET_BLANKBOARD,
197  |  *     SET_(NO)AUTODISBAND
198  |  *    (some of which are to be implemented still)
199  |  *   - Observers can watch press of a game (if flag enablingthis is set)
200  |  *   - Passwords only allow alpha-numeric characters
201  |  *
202  |  * Revision 1.1  1998/02/28 17:49:42  david
203  |  * Initial revision
204  |  *
205  |  * Revision 1.2  1997/02/16 20:43:18  davidn
206  |  * Additions to dipent structure and associated code, to allow duplex variants.
207  |  * Command is "set players n".
208  |  *
209  |  * Revision 1.1  1996/10/20 12:29:45  rpaar
210  |  * Morrolan v9.0
211  |  */
212  | 
213  | /*  mail_set.c -- process set commands
214  |  *  Copyright 1987, Lowe.
215  |  *
216  |  *  Diplomacy is a trademark of the Avalon Hill Game Company, Baltimore,
217  |  *  Maryland, all rights reserved; used with permission.
218  |  *
219  |  *  Redistribution and use in source and binary forms are permitted
220  |  *  provided that it is for non-profit purposes, that this and the 
221  |  *  above notices are preserved and that due credit is given to Mr.
222  |  *  Lowe.
223  |  *
224  |  *  DATE        NAME         REASON
225  |  *  ----------- ------------ ---------------------------------------
226  |  *  ?? ??? 1987 Ken Lowe     He wrote it
227  |  *  ?? Jan 1995 BLR          See comment below
228  |  *  29 Dec 1996 David Norman Setting of dipent.no_of_players
229  |  *  17 Mar 1997 N Wagner     replaced unlink(2) with remove(3)
230  |  *  17 Nov 1999 M. Miller    Added CheckForGameStart() to start if
231  |  *                           we have a quorum if variant changed
232  |                              Also disallow set password!=alphanum
233  |  *  25 Nov 1999 M. Miller    Added SET [nø]LATECOUNT parameter 
234  |  *  26 May 2001 M. Becroft   Added ontimerat & resrat commands
235  |  *		T. Miller
236  |  */
237  | 
238  | /*
239  |  * Modified to remove the mfprintf calls and replace with separate
240  |  * calls to output to the general broadcast file and the master
241  |  * broadcast file separately, so that the real address can be placed
242  |  * in the master broadcast file.  Many of these were unnecessary, as
243  |  * many of the commands are master specific, but I didn't process them
244  |  * that intelligently.  1/95  BLR
245  |  */
246  | 
247  | #include <string.h>
248  | #include <stdlib.h>
249  | #include <stdio.h>
250  | #include <time.h>
251  | #include <ctype.h>
252  | 
253  | #include "config.h"
254  | #include "dip.h"
255  | #include "mail.h"
256  | #include "functions.h"
257  | #include "diplog.h"
258  | #include "plyrdata.h"
259  | 
260  | extern char *accesses[], *levels[];
261  | extern int avalue[], lvalue[], naccess, nlevel;
262  | 
263  | void ChangeTransform( char *s);
264  | void ShowTransformSettings(FILE* rfp);
265  | char * SetSubkey(int act, char *s);
266  | 
267  | #define SETFLAGS(set,mask) dipent.flags = (dipent.flags & ~(mask)) | (set)
268  | 
269  | #define SETX2FLAGS(set,mask) dipent.x2flags = (dipent.x2flags & ~(mask)) | (set)
270  | 
271  | #define CheckMach() if (!(dipent.flags & F_MACH)) fprintf(rfp, "Game '%s' is not Machiavelli, option is useless.\n\n", dipent.name);
272  | 
273  | #define CheckNoMach() if ((dipent.flags & F_MACH)) fprintf(rfp, "Game '%s' is Machiavelli, option is useless.\n\n", dipent.name); 
274  | 
275  | #define CheckMach2() if (!(dipent.xflags & XF_MACH2)) fprintf(rfp, "Game '%s' is not Machiavelli2, option is useless.\n\n", dipent.name);
276  | 
277  | #define CheckNoMach2() if ((dipent.xflags & XF_MACH2)) fprintf(rfp, "Game '%s' is Machiavelli2, option is useless.\n\n", dipent.name);
278  | 
279  | #define CheckPress() if (!HasPress(dipent)) fprintf(rfp, "Game '%s' has no press enabled, option is useless.\n\n", dipent.name); 
280  | 
281  | #define CheckWings() if (!(dipent.flags & F_WINGS)) fprintf(rfp, "Game '%s' has no wings, option is useless.\n\n", dipent.name);
282  | 
283  | #define CheckBlind() if (!(dipent.flags & F_BLIND)) fprintf(rfp, "Game '%s' is not blind, option is useless.\n\n", dipent.name);
284  | 
285  | 
286  | /* Check if the game has already been started */
287  | 
288  | int CheckNotStarted(char *text)
289  | {
290  |     char *outtext = text;
291  |     int ret = 1;
292  | 
293  |     if (dipent.seq[0] != 'x') {
294  |         if (outtext == NULL)
295  | 	    outtext = "not allowed to change setting";
296  | 
297  |         fprintf(rfp, "Game '%s' has already started: %s!\n\n",
298  |                                     dipent.name, outtext);
299  | 	ret = 0;
300  |     }
301  |     return ret;
302  | }
303  | 
304  | #define DRAW_VOTE 1
305  | #define CONC_VOTE 2
306  | /***** Show the curent preference settings 
307  | ** Note: Caller DID check this is the master calling this routine?!
308  | **
309  | */
310  | 
311  | void ShowPreferences(FILE *out_fptr)
312  | {
313  | 	int i;
314  | 	int one_found = 0;
315  | 
316  |         for (i=0; i < dipent.n; i++)
317  |         {
318  |           if (dipent.players[i].power == WILD_PLAYER) {
319  | 	    one_found++;
320  | 	    if (one_found == 1 ) fprintf(out_fptr," Preference lists are now:\n");
321  |             fprintf(out_fptr,
322  |                 "%s has set '%s'.\n",
323  |                  dipent.players[i].address,
324  |                  dipent.players[i].pref);
325  | 	  }
326  |        }
327  |        if (one_found > 0) fprintf(out_fptr,"\n");
328  | }
329  | 
330  | 
331  | /***************************************************************************/
332  | /***
333  |  *** See if we are ready to start game or not yet, and start it if we are
334  |  ***
335  |  */
336  | 
337  | void CheckForGameStart()
338  | {
339  |     int i,n;
340  | 
341  |     if (dipent.seq[0] != 'x') return; /* can't start already started game */
342  |     for (i = n = 0; i < dipent.n; i++) {
343  |         if (dipent.players[i].power == WILD_PLAYER) {
344  |          if (n < dipent.no_of_players) {
345  |              n++;
346  |              } else {
347  |                  dipent.players[i].power = OBSERVER;
348  |              }
349  |          }
350  |     }
351  | 
352  |     if (n == dipent.no_of_players) {
353  |           /*mail_igame();*/
354  | 	  if (!(dipent.xflags & XF_MANUALSTART) ) {
355  | 	     /* Following will signal game is ready to start */
356  |               strcpy(dipent.seq, "001");
357  | 	      starting++;
358  | 	} else {
359  | 	    fprintf(rfp,"Game '%s' is now ready for Master to start the game.\n", dipent.name);
360  |             mfprintf(bfp, "Game '%s' is now ready for Master to start the game.\n", dipent.name);
361  | 
362  | 	    sprintf(subjectline, "%s:%s - %s Ready to Start", JUDGE_CODE, dipent.name, dipent.phase);
363  |         }
364  |      broadcast = 1;
365  |      }
366  | }
367  | 
368  | #define CATF_SETON 1
369  | #define CATF_SETOFF 0
370  | #define CATF_NORMAL 0
371  | #define CATF_INVERSE 1
372  | 
373  | int CheckAndToggleFlag( int *flag,   /* dipent.flags or dipent.xflags */
374  | 			    int flag_mask,  /* F_MASK or XF_MASK */
375  | 			    char *flag_name,  /* name of mask for user to see */
376  | 			    int set_on,       /* == 1 if set on, 0 if set off */
377  | 			    char *warn_text , /* Text to show when flag is changed */
378  | 			    int inverted_logic /*set to 1 if flag is negative logic, i.e. On = No... */
379  | 			)
380  | {
381  | 	char *op_text; /* Either set or cleared */
382  | 	char *no_text;   /*Either no or nothing */
383  | 	int setting = 0; /* returns 1 if flag whas changed, else 0 */
384  | #define CLEARED_TEXT "cleared"
385  | #define SET_TEXT "set"
386  | 
387  | 	if (set_on == CATF_SETON) {
388  | 	   if (*flag & flag_mask) {
389  |                 fprintf(rfp, "Game '%s' is already %s.\n", dipent.name, flag_name);
390  |            } else {
391  |                 *flag |= flag_mask;
392  |                 fprintf(rfp, warn_text);
393  | 		if (inverted_logic == CATF_INVERSE) {
394  | 		   op_text = CLEARED_TEXT;
395  | 		} else {
396  | 		   op_text = SET_TEXT;
397  | 		}
398  |                 pprintf(cfp, "%s%s as %s in '%s' %s the %s flag.\n", NowString(),
399  | 			xaddr, powers[dipent.players[player].power], dipent.name, op_text, flag_name);
400  |                 /* WAS mfprintf  1/95 BLR */
401  |                 fprintf(bfp, "%s as %s in '%s' %s the %s flag.\n", xaddr, PRINT_POWER, dipent.name,
402  | 			op_text, flag_name);
403  |                 fprintf(mbfp, "%s as %s in '%s' %s the %s flag.\n", raddr, PRINT_POWER, dipent.name, 
404  | 			op_text, flag_name);
405  |                 fprintf(mbfp, warn_text);
406  | 		broadcast = 1;
407  | 		setting = 1;
408  | 	   }
409  | 	}
410  | 	else {
411  | 	    if (!(*flag & flag_mask)) {
412  | 		if (inverted_logic==CATF_INVERSE) {
413  | 		    no_text = ""; 
414  | 		} else { 
415  | 		  no_text = "No";
416  | 		}
417  |                 fprintf(rfp, "Game '%s' is already %s%s.\n", dipent.name, no_text, flag_name);
418  |              } else {
419  | 		if (inverted_logic==CATF_INVERSE) {
420  | 		   op_text = SET_TEXT;
421  |                 } else {
422  |                    op_text = CLEARED_TEXT;
423  |                 }
424  |                 *flag &= ~flag_mask;
425  |                 fprintf(rfp, warn_text);
426  |                 pprintf(cfp, "%s%s as %s in '%s' %s the %s flag.\n", NowString(),
427  |                         xaddr, powers[dipent.players[player].power], dipent.name, op_text, flag_name);
428  |                /* WAS mfprintf  1/95 BLR */
429  |                fprintf(bfp, "%s as %s in '%s' %s the %s flag.\n", xaddr, PRINT_POWER, dipent.name, op_text, flag_name);
430  |                fprintf(mbfp, "%s as %s in '%s' %s the %s flag.\n", raddr, PRINT_POWER, dipent.name, op_text, flag_name);
431  |                fprintf(mbfp, warn_text);
432  | 		broadcast = 1;
433  | 		setting = 1;
434  | 	    }
435  |        }
436  |        return setting;
437  | }
438  | 
439  | /*
440  |  * The following function will determine if delay is
441  |  * automatically permissible or not
442  |  *
443  |  * It will round up the requested delay to a day before comparing
444  |  *
445  |  */
446  | 
447  | #define TOO_BIG (-1)
448  | #define JUST_RIGHT (0)
449  | 
450  | int absence_delay(int max_delay, long delay_period)
451  | {
452  |     int delay_days;
453  | 
454  |     delay_days = delay_period / (24 * 60 * 60 );
455  |     delay_days += 1;  /* add on a day */
456  | 
457  |     if (delay_days <= max_delay )
458  |         return JUST_RIGHT;
459  |     else
460  | 	return TOO_BIG; 
461  | 
462  | }
463  | 
464  | /* This function is supposed to separate two dates into two strings */
465  | /* If only one date string is found, the second one is blanked */
466  | 
467  | void break_date_into_two(char * instring, char *s1, char *s2)
468  | {
469  | 	char *t;
470  | 	char *c;
471  | 
472  | 	strcpy(s1, instring);
473  | 	*s2 = '\0';
474  | 
475  | 	for (c = s1; *c != '\n'; c++)
476  | 		*c = tolower(*c);
477  | 
478  | 	t = strstr(s1,"to");
479  | 	if (t) {
480  | 	    /* Remove the "to" component" */
481  | 	    *t++ = '\0'; t++;
482  | 	    
483  | 	    while (isspace(*t) && t) t++;	
484  | 	    strcpy(s2, t);
485  | 	}
486  | }
487  | 
488  | void mail_setp(char *s)
489  | {
490  | 	int i, k, chk24nmr;
491  | 	float f,temprat; /* Used in ratio dedication systems. */
492  |         int passOK;  /* used to see if password string is alright on setpass */
493  | 	char c, *t, *temp,*s1, *u;
494  | 	sequence seq;
495  | 	long dates, datee;
496  | 	struct tm *tm, *localtime();
497  | 	char ss1[150],se1[150];
498  | 	char *ss = ss1;
499  | 	char *se = se1;
500  | 	char stat_text[20];
501  | 
502  | #define SET_ADD		1
503  | #define PRV_ADD		'a'
504  | #define SET_PW		2
505  | #define PRV_PW		'a'
506  | #define SET_WAIT	3
507  | #define PRV_WAIT	'a'
508  | #define SET_NOWAIT	4
509  | #define PRV_NOWAIT	'a'
510  | #define SET_MOVES	5
511  | #define PRV_MOVES	'm'
512  | #define SET_BUILD	6
513  | #define PRV_BUILD	'm'
514  | #define SET_RETREAT	7
515  | #define PRV_RETREAT	'm'
516  | #define SET_DEADLINE	8
517  | #define PRV_DEADLINE	'm'
518  | #define SET_START	9
519  | #define PRV_START	'm'
520  | #define SET_GRACE	10
521  | #define PRV_GRACE	'm'
522  | #define SET_NONMR	11
523  | #define PRV_NONMR	'm'
524  | #define SET_NMR		12
525  | #define PRV_NMR		'm'
526  | #define SET_MODERATE	13
527  | #define PRV_MODERATE	'm'
528  | #define SET_UNMODERATE	14
529  | #define PRV_UNMODERATE	'm'
530  | #define SET_NOLIST	15
531  | #define PRV_NOLIST	'm'
532  | #define SET_LIST	16
533  | #define PRV_LIST	'm'
534  | #define SET_ACCESS	17
535  | #define PRV_ACCESS	'm'
536  | #define SET_LEVEL	18
537  | #define PRV_LEVEL	'm'
538  | #define SET_VARIANT	19
539  | #define PRV_VARIANT	'm'
540  | #define SET_DEDICATE	20
541  | #define PRV_DEDICATE	'm'
542  | #define SET_NOOP	21
543  | #define PRV_NOOP	'a'
544  | #define SET_FLAG	22
545  | #define PRV_FLAG	'm'
546  | #define SET_FAKEB	23
547  | #define PRV_FAKEB	'm'
548  | #define SET_GREY	24
549  | #define PRV_GREY	'm'
550  | #define SET_GRYWHT	25
551  | #define PRV_GRYWHT	'm'
552  | #define SET_NOFAKEB	26
553  | #define PRV_NOFAKEB	'm'
554  | #define SET_NOPART	27
555  | #define PRV_NOPART	'm'
556  | #define SET_PART	28
557  | #define PRV_PART	'm'
558  | #define SET_PARTFBD	29
559  | #define PRV_PARTFBD	'm'
560  | #define SET_PARTMAY	30
561  | #define PRV_PARTMAY	'm'
562  | #define SET_WHITE	31
563  | #define PRV_WHITE	'm'
564  | #define SET_WHTGRY	32
565  | #define PRV_WHTGRY	'm'
566  | #define SET_PREF	33
567  | #define PRV_PREF	'a'
568  | #define SET_NOPRESS	34
569  | #define PRV_NOPRESS	'm'
570  | #define SET_OBANY	35
571  | #define PRV_OBANY	'm'
572  | #define SET_OBNONE	36
573  | #define PRV_OBNONE	'm'
574  | #define SET_OBWHITE	37
575  | #define PRV_OBWHITE	'm'
576  | #define SET_NOPROXY	38
577  | #define PRV_NOPROXY	'm'
578  | #define SET_PROXY	39
579  | #define PRV_PROXY	'm'
580  | #define SET_NODICE	40
581  | #define PRV_NODICE	'm'
582  | #define SET_DICE	41
583  | #define PRV_DICE	'm'
584  | #define SET_NOFAMINE	42
585  | #define PRV_NOFAMINE	'm'
586  | #define SET_FAMINE	43
587  | #define PRV_FAMINE	'm'
588  | #define SET_NOPLAGUE	44
589  | #define PRV_NOPLAGUE	'm'
590  | #define SET_PLAGUE	45
591  | #define PRV_PLAGUE	'm'
592  | #define SET_NOLOANS	46
593  | #define PRV_NOLOANS	'm'
594  | #define SET_LOANS	47
595  | #define PRV_LOANS	'm'
596  | #define SET_NOASSASS	48
597  | #define PRV_NOASSASS	'm'
598  | #define SET_ASSASS	49
599  | #define PRV_ASSASS	'm'
600  | #define SET_NOADJ	50
601  | #define PRV_NOADJ	'm'
602  | #define SET_ADJ		51
603  | #define PRV_ADJ		'm'
604  | #define SET_NOSPECIAL	52
605  | #define PRV_NOSPECIAL	'm'
606  | #define SET_SPECIAL	53
607  | #define PRV_SPECIAL	'm'
608  | #define SET_ALLPRESS	54
609  | #define PRV_ALLPRESS	'a'
610  | #define SET_NOALLPRESS	55
611  | #define PRV_NOALLPRESS	'a'
612  | #define SET_COMMENT	56
613  | #define PRV_COMMENT	'm'
614  | #define SET_QUIET	57
615  | #define PRV_QUIET	'm'
616  | #define SET_NOQUIET	58
617  | #define PRV_NOQUIET	'm'
618  | #define SET_RATE	59
619  | #define PRV_RATE	'm'
620  | #define SET_NORATE	60
621  | #define PRV_NORATE	'm'
622  | #define SET_REVEAL	61
623  | #define PRV_REVEAL	'm'
624  | #define SET_NOREVEAL	62
625  | #define PRV_NOREVEAL	'm'
626  | #define SET_SHOW	63
627  | #define PRV_SHOW	'm'
628  | #define SET_NOSHOW	64
629  | #define PRV_NOSHOW	'm'
630  | #define SET_NODIAS      65
631  | #define PRV_NODIAS      'm'
632  | #define SET_DIAS        66
633  | #define PRV_DIAS        'm'
634  | #define SET_DRAW        67
635  | #define PRV_DRAW        'a'
636  | #define SET_NODRAW      68
637  | #define PRV_NODRAW      'a'
638  | #define SET_EPNUM       69
639  | #define PRV_EPNUM       'm'
640  | #define SET_CENTERS     70
641  | #define PRV_CENTERS     'm'
642  | #define SET_BN_MN       71
643  | #define PRV_BN_MN       'm'
644  | #define SET_GRACEDAYS   72
645  | #define PRV_GRACEDAYS   'm'
646  | #define SET_NOGRACEDAYS 73
647  | #define PRV_NOGRACEDAYS	'm'
648  | #define SET_PLAYERALLOW 74
649  | #define PRV_PLAYERALLOW	'm'
650  | #define SET_PLAYERDENY  75
651  | #define PRV_PLAYERDENY	'm'
652  | #define SET_MASTERALLOW 76
653  | #define PRV_MASTERALLOW	'm'
654  | #define SET_MASTERDENY  77
655  | #define PRV_MASTERDENY	'm'
656  | #define SET_STRWAIT	78
657  | #define PRV_STRWAIT	'm'
658  | #define SET_NOSTRWAIT	79
659  | #define PRV_NOSTRWAIT	'm'
660  | #define SET_NO_PLAYERS  80
661  | #define PRV_NO_PLAYERS  'm'
662  | #define SET_LATECOUNT   81
663  | #define PRV_LATECOUNT   'm'
664  | #define SET_NOLATECOUNT 82
665  | #define PRV_NOLATECOUNT 'm'
666  | #define SET_STRCONVOY	83
667  | #define PRV_STRCONVOY   'm'
668  | #define SET_NOSTRCONVOY 84
669  | #define PRV_NOSTRCONVOY 'm'
670  | #define SET_LATEPRESS	85
671  | #define PRV_LATEPRESS	'm'
672  | #define SET_NOLATEPRESS 86
673  | #define PRV_NOLATEPRESS 'm'
674  | #define SET_MANPROC  87
675  | #define PRV_MANPROC 'm'
676  | #define SET_NOMANPROC 88
677  | #define PRV_NOMANPROC 'm'
678  | #define SET_MANSTART 89
679  | #define PRV_MANSTART 'm'
680  | #define SET_NOMANSTART 90
681  | #define PRV_NOMANSTART 'm'
682  | #define SET_TRANSFORM   91
683  | #define PRV_TRANSFORM	'm'
684  | #define SET_NOTRANSFORM 92
685  | #define PRV_NOTRANSFORM 'm'
686  | #define SET_XFLAG	93
687  | #define PRV_XFLAG	'm'
688  | #define SET_ANYCENTRE   94
689  | #define PRV_ANYCENTRE   'm'
690  | #define SET_HOMECENTRE  95
691  | #define PRV_HOMECENTRE  'm'
692  | #define SET_RESUME	96
693  | #define PRV_RESUME	'm'
694  | #define SET_NORESUME	97
695  | #define PRV_NORESUME	'm'
696  | #define SET_WATCHALL	98
697  | #define PRV_WATCHALL	'm'
698  | #define SET_NOWATCHALL  99
699  | #define PRV_NOWATCHALL 'm'
700  | #define SET_ABSENCE    100
701  | #define PRV_ABSENCE	'a'
702  | #define SET_NOABSENCE	101
703  | #define PRV_NOABSENCE   'a'
704  | #define SET_MAXABSENCE  102
705  | #define PRV_MAXABSENCE  'm'
706  | #define SET_ONECENTRE   103
707  | #define PRV_ONECENTRE   'm'
708  | #define SET_NORMBROAD	104
709  | #define PRV_NORMBROAD   'a'
710  | #define SET_NONORMBROAD 105
711  | #define PRV_NONORMBROAD 'a'
712  | #define SET_BLANKPRESS	106
713  | #define PRV_BLANKPRESS	'm'
714  | #define SET_NOBLANKPRESS 107
715  | #define PRV_NOBLANKPRESS 'm'
716  | #define SET_MINORPRESS  108
717  | #define PRV_MINORPRESS 'm'
718  | #define SET_NOMINORPRESS 109
719  | #define PRV_NOMINORPRESS 'm'
720  | #define SET_MACH2	110
721  | #define PRV_MACH2	'm'
722  | #define SET_NOMACH2     111
723  | #define PRV_NOMACH2     'm'
724  | /*
725  | #define SET_MACH3       112
726  | #define PRV_MACH3       'm'
727  | */
728  | #define SET_AIRLIFT     113
729  | #define PRV_AIRLIFT     'm'
730  | #define SET_NOAIRLIFT   114
731  | #define PRV_NOAIRLIFT   'm'
732  | #define SET_BLANKBOARD  115
733  | #define PRV_BLANKBOARD   'm'
734  | #define SET_FORT	116
735  | #define PRV_FORT	'm'
736  | #define SET_NOFORT	117
737  | #define PRV_NOFORT      'm'
738  | #define SET_AUTODISBAND	118
739  | #define PRV_AUTODISBAND	'm'
740  | #define SET_NOAUTODISBAND 119
741  | #define PRV_NOAUTODISBAND 'm'
742  | /* NOTE: 120 CANNOT be used: it is the 'unassigned' value */
743  | #define SET_ANYDISBAND 121
744  | #define PRV_ANYDISBAND 'm'
745  | #define SET_NORMALDISBAND 122
746  | #define PRV_NORMALDISBAND 'm'
747  | #define SET_ATTACKTRANS	  123
748  | #define PRV_ATTACKTRANS	 'm'
749  | #define SET_NOATTACKTRANS 124
750  | #define PRV_NOATTACKTRANS 'm'
751  | #define SET_ONTIMERAT     125
752  | #define PRV_ONTIMERAT     'm'
753  | #define SET_RESRAT        126
754  | #define PRV_RESRAT        'm'
755  | #define SET_COASTALCONVOY   127
756  | #define PRV_COASTALCONVOY  'm'
757  | #define SET_NOCOASTALCONVOY 128
758  | #define PRV_NOCOASTALCONVOY 'm'
759  | #define SET_MONEY	  129
760  | #define PRV_MONEY	  'm'
761  | #define SET_NOMONEY	  130
762  | #define PRV_NOMONEY	  'm'
763  | #define SET_MOVEDISBAND	  131
764  | #define	PRV_MOVEDISBAND	  'm'
765  | #define SET_NOMOVEDISBAND 132
766  | #define PRV_NOMOVEDISBAND 'm'
767  | #define SET_BASIC	  133
768  | #define PRV_BASIC	  'm'
769  | #define SET_ADVANCED	  134
770  | #define PRV_ADVANCED	  'm'
771  | /* Tim Miller's Concession stuff */
772  | #define SET_CONCESSIONS   135
773  | #define PRV_CONCESSIONS   'm'
774  | #define SET_NOCONCESSIONS 136
775  | #define PRV_NOCONCESSIONS 'm'
776  | #define SET_CONC          137 /* This is how player votes to concede */
777  | #define PRV_CONC          'a'
778  | #define SET_NOCONC        138
779  | #define PRV_NOCONC        'a'
780  | #define SET_DUALITY	  139
781  | #define	PRV_DUALITY	  'm'
782  | #define SET_NODUALITY	  140
783  | #define PRV_NODUALITY	  'm'
784  | #define SET_HONGKONG	  141
785  | #define PRV_HONGKONG      'm'
786  | #define SET_NOHONGKONG	  142
787  | #define PRV_NOHONGKONG	  'm'
788  | #define SET_GATEWAY	  143
789  | #define PRV_GATEWAY	  'm'
790  | #define SET_NOGATEWAY	  144
791  | #define PRV_NOGATEWAY	  'm'
792  | #define SET_RAILWAY	  145
793  | #define PRV_RAILWAY	  'm'
794  | #define SET_NORAILWAY     146
795  | #define PRV_NORAILWAY     'm'
796  | #define SET_STORM	  147
797  | #define PRV_STORM	  'm'
798  | #define SET_NOSTORM	  148
799  | #define PRV_NOSTORM	  'm'
800  | #define SET_PREFLIST	  149
801  | #define PRV_PREFLIST	  'm'
802  | #define SET_PREFBOTH	  150
803  | #define PRV_PREFBOTH	  'm'
804  | #define SET_PREFRAND	  151
805  | #define PRV_PREFRAND	  'm'
806  | #define SET_SECRET	  152
807  | #define PRV_SECRET	  'm'
808  | #define SET_NOSECRET	  153
809  | #define PRV_NOSECRET	  'm'
810  | #define SET_NOTVARIANT    154
811  | #define PRV_NOTVARIANT    'm'
812  | #define SET_MUSTORDER	  155
813  | #define PRV_MUSTORDER	  'm'
814  | #define SET_NOMUSTORDER   156
815  | #define PRV_NOMUSTORDER   'm'
816  | #define SET_POSTALPRESS   157
817  | #define PRV_POSTALPRESS   'm'
818  | #define SET_NOPOSTALPRESS 158
819  | #define PRV_NOPOSTALPRESS 'm'
820  | #define SET_BLIND_CENTRES 159
821  | #define PRV_BLIND_CENTRES 'm'
822  | #define SET_BLIND_NOCENTRES 160
823  | #define PRV_BLIND_NOCENTRES 'm'
824  | #define SET_SUMMER	  161
825  | #define PRV_SUMMER	  'm'
826  | #define SET_NOSUMMER	  162
827  | #define PRV_NOSUMMER	  'm'
828  | #define SET_GARRISONS	  163
829  | #define PRV_GARRISONS	  'm'
830  | #define SET_NOGARRISONS	  164
831  | #define PRV_NOGARRISONS	  'm'
832  | #define SET_NEUTRALS	  165
833  | #define PRV_NEUTRALS	  'm'
834  | #define SET_NONEUTRALS	  166
835  | #define PRV_NONEUTRALS	  'm'
836  | #define SET_CAPTUREWIN	  167
837  | #define PRV_CAPTUREWIN	  'm'
838  | #define SET_NOCAPTUREWIN  168
839  | #define PRV_NOCAPTUREWIN  'm'
840  | #define SET_AUTOCREATE    169
841  | #define PRV_AUTOCREATE    'm'
842  | #define SET_NOAUTOCREATE  170
843  | #define PRV_NOAUTOCREATE  'm'
844  | #define SET_TOUCHPRESS    171
845  | #define PRV_TOUCHPRESS     'm'
846  | #define SET_NOTOUCHPRESS 172
847  | #define PRV_NOTOUCHPRESS 'm'
848  | 
849  | /***********************************************************************
850  |  * Note:  in keys below, a blank space indicates that whitespace is    *
851  |  * optional at that point in the user input; a '#' character indicates *
852  |  * that white space (or parentheses) is required in user input.        *
853  |  ***********************************************************************/
854  | 
855  | 	static char *keys[] = {
856  | 	    "", ",", "press",
857  | 	    "address", "ad#",
858  | 	    "password#", "pw#", "p#",
859  | 	    "wait", "w#", "no wait", "now#",
860  | 	    "preference", "pref",
861  | 	    "moves", "builds", "adjusts", "retreats",
862  | 	    "move", "build", "adjust", "retreat",
863  | 	    "deadline", "start", "grace",
864  | 	    "no nmr", "no cd", "nmr", "cd",
865  | 	    "moderated", "unmoderated", "moderate", "unmoderate",
866  | 	    "reveal", "no reveal",
867  | 	    "no list", "unlist", "private", "list", "public",
868  | 	    "white/grey", "grey/white", "white", "grey", "no white", "no grey",
869  | 	    "no press", "none", "gray", "white/gray", "gray/white", "no gray",
870  | 	    "no fake broadcast", "no fake", "partial may be faked",
871  | 	    "partial may", "partial fakes broadcast by default", "default",
872  | 	    "partial default", "partial fakes broadcast", "partial fakes",
873  | 	    "no partial", "partial",
874  | 	    "observer any", "any observer", "no observer", "observer none",
875  | 	    "observer no", "white observer", "observer white",
876  | 	    "proxy", "no proxy", "dice", "no dice",
877  | 	    "famine", "no famine", "plague", "no plague",
878  | 	    "loans", "bankers", "no loans", "no bankers", "bank", "no bank",
879  | 	    "assassinations", "assassins", "assassination", "no assassins",
880  | 	    "no assassinations", "no assassination",
881  | 	    "adjacency", "adjacent", "adj",
882  | 	    "no adjacency", "no adjacent", "no adj",
883  | 	    "special", "no special", "all press", "normal press",
884  | 	    "comment", "info", "information",
885  | 	    "quiet", "no quiet", "rated", "unrated",
886  | 	    "access", "level", "variant",
887  | 	    "dedication", "ontimerat", "resrat",
888  | 	    "show", "no show", "dias", "no dias", 
889  | 	    "concessions", "no concessions",
890  | 	    "conc", "concede", "no conc", "no concede",
891  | 	    "draw", "no draw", 
892  | 	    "ep", "ep number", "ep num", 
893  | 	    "centres", "centers",
894  | 	    "bn", "bn number", "bn num", 
895  | 	    "bnc", "bnc number", "bnc num", 
896  | 	    "mn", "mn number", "mn num", 
897  | 	    "mnc", "mnc number", "mnc num", 
898  | 	    "no strict grace", "strict grace",
899  | 	    "players", "allow player", "allow players",
900  | 	    "player allow", "players allow",
901  | 	    "deny player", "deny players", "player deny", "players deny",
902  | 	    "allow master", "allow masters", "master allow", "masters allow",
903  | 	    "deny master", "deny masters", "master deny", "masters deny",
904  | 	    "strict wait", "no strict wait", "late count", "no late count",
905  | 	    "strict convoy", "no strict convoy", "late press", "no late press",
906  | 	    "manual process", "man proc", "no manual process", "no man proc",
907  | 	    "auto process", "auto proc",
908  | 	    "manual start", "man start", "no manual start", "no man start", "auto start",
909  | 	    "transform", "trafo",
910  | 	    "no transform", "no trafo",
911  | 	    "xflag", "xflags",
912  | 	    "any centres", "any centre", "any centers", "any center",
913  | 	    "home centres", "home centre", "home centers", "home center",
914  | 	    "watch all press", "no watch all press",
915  | 	    "holidays", "holiday", "vacations", "vacation", "absence",
916  | 	    "no holidays", "no holiday", "no vacations", "no vacation", "no absence",
917  | 	    "max absence", "max vacations",
918  | 	    "max holidays", "one centre",
919  | 	    "one center", "broadcast", "broadcast press",
920  | 	    "normal broadcast", "no broadcast", "no broadcast press",
921  | 	    "no normal broadcast",
922  | 	    "blank press", "no blank press",
923  | 	    "minor press", "no minor press",
924  | 	    "mach2", "machiavelli2", "mach-2", "machiavelli-2",
925  | 	    "no mach2", "no machiavelli2", "no mach-2", "no machiavelli-2",
926  | 	     "air lifts", "air lift",
927  | 	    "no air lifts", "no air lift",
928  | 	    "blank board", "empty board",
929  | 	    "fortresses", "fortress", "forts", "fort",
930  | 	    "no fortresses", "no fortress", "no forts", "no fort",
931  | 	    "resume", "no resume",
932  | 	    "auto disband", "no auto disband",
933  | 	    "any disband", "normal disband",
934  | 	    "attack transform", "attack transforms", "no attack transforms", "no attack tranform",
935  | 	    "coastal convoys", "coastal convoy",
936  | 	    "no coastal convoys", "no coastal convoy",
937  | 	    "money", "no money",
938  | 	    "disband", "no disband",
939  | 	    "basic", "advanced",
940  | 	    "duality", "no duality",
941  | 	    "hong kong", "no hong kong",
942  | 	    "gateways", "gateway", "no gateways", "no gateway",
943  | 	    "railways", "railway", "no railways", "no railway",
944  | 	    "storms", "storm", "no storms", "no storm",
945  | 	    "prflist", "prfboth", "prfrand",
946  | 	    "must order", "no must order",
947  | 	    "secret", "no secret",
948  | 	    "not variant",
949  | 	    "postal press", "no postal press",
950  | 	    "bcenters", "bcentres",
951  | 	    "no bcentres", "no bcenters",
952  | 	    "summer", "no summer",
953  | 	    "garrisons", "no garrisons",
954  | 	    "neutrals", "no neutrals",
955  | 	    "capture win", "no capture win", 
956  | 	    "auto create", "no auto create",
957  | 	    "touch press", "no touch press"
958  | 	};
959  | 
960  | 	static unsigned char action[] = {
961  | 	    'x', SET_NOOP, SET_NOOP, SET_ADD, SET_ADD, SET_PW, SET_PW, SET_PW,
962  | 	    SET_WAIT, SET_WAIT, SET_NOWAIT, SET_NOWAIT, SET_PREF, SET_PREF,
963  | 	    SET_MOVES, SET_BUILD, SET_BUILD, SET_RETREAT, SET_MOVES, SET_BUILD,
964  | 	    SET_BUILD, SET_RETREAT, SET_DEADLINE, SET_START, SET_GRACE,
965  | 	    SET_NONMR, SET_NONMR, SET_NMR, SET_NMR, SET_MODERATE,
966  | 	    SET_UNMODERATE, SET_MODERATE, SET_UNMODERATE, SET_REVEAL,
967  | 	    SET_NOREVEAL, SET_NOLIST, SET_NOLIST, SET_NOLIST, SET_LIST,
968  | 	    SET_LIST, SET_WHTGRY, SET_GRYWHT, SET_WHITE, SET_GREY, SET_GREY,
969  | 	    SET_WHITE, SET_NOPRESS, SET_NOPRESS, SET_GREY, SET_WHTGRY,
970  | 	    SET_GRYWHT, SET_WHITE, SET_NOFAKEB, SET_NOFAKEB, SET_PARTMAY,
971  | 	    SET_PARTMAY, SET_PARTFBD, SET_PARTFBD, SET_PARTFBD, SET_FAKEB,
972  | 	    SET_FAKEB, SET_NOPART, SET_PART, SET_OBANY, SET_OBANY, SET_OBNONE,
973  | 	    SET_OBNONE, SET_OBNONE, SET_OBWHITE, SET_OBWHITE, SET_PROXY,
974  | 	    SET_NOPROXY, SET_DICE, SET_NODICE, SET_FAMINE, SET_NOFAMINE,
975  | 	    SET_PLAGUE, SET_NOPLAGUE, SET_LOANS, SET_LOANS, SET_NOLOANS,
976  | 	    SET_NOLOANS, SET_LOANS, SET_NOLOANS, SET_ASSASS, SET_ASSASS,
977  | 	    SET_ASSASS, SET_NOASSASS, SET_NOASSASS, SET_NOASSASS, SET_ADJ,
978  | 	    SET_ADJ, SET_ADJ, SET_NOADJ, SET_NOADJ, SET_NOADJ, SET_SPECIAL,
979  | 	    SET_NOSPECIAL, SET_ALLPRESS, SET_NOALLPRESS, SET_COMMENT,
980  | 	    SET_COMMENT, SET_COMMENT, SET_QUIET, SET_NOQUIET, SET_RATE,
981  | 	    SET_NORATE, SET_ACCESS, SET_LEVEL, SET_VARIANT, SET_DEDICATE,
982  | 	    SET_ONTIMERAT, SET_RESRAT, SET_SHOW, SET_NOSHOW, SET_DIAS,
983  | 	    SET_NODIAS, SET_CONCESSIONS, 
984  | 	    SET_NOCONCESSIONS, SET_CONC, SET_CONC, SET_NOCONC, SET_NOCONC,
985  | 	    SET_DRAW, SET_NODRAW, SET_EPNUM, SET_EPNUM,
986  | 	    SET_EPNUM, SET_CENTERS, SET_CENTERS,
987  | 	    SET_BN_MN, SET_BN_MN, SET_BN_MN, 
988  | 	    SET_BN_MN, SET_BN_MN, SET_BN_MN,
989  | 	    SET_BN_MN, SET_BN_MN, SET_BN_MN,
990  | 	    SET_BN_MN, SET_BN_MN, SET_BN_MN,
991  | 	    SET_GRACEDAYS, SET_NOGRACEDAYS,
992  | 	    SET_NO_PLAYERS, SET_PLAYERALLOW, SET_PLAYERALLOW, SET_PLAYERALLOW,
993  | 	    SET_PLAYERALLOW, SET_PLAYERDENY, SET_PLAYERDENY, SET_PLAYERDENY,
994  | 	    SET_PLAYERDENY, SET_MASTERALLOW, SET_MASTERALLOW, SET_MASTERALLOW,
995  | 	    SET_MASTERALLOW, SET_MASTERDENY, SET_MASTERDENY, SET_MASTERDENY,
996  | 	    SET_MASTERDENY, SET_STRWAIT, SET_NOSTRWAIT,
997  | 	    SET_LATECOUNT, SET_NOLATECOUNT, SET_STRCONVOY, SET_NOSTRCONVOY,
998  | 	    SET_LATEPRESS, SET_NOLATEPRESS, SET_MANPROC,
999  | 	    SET_MANPROC, SET_NOMANPROC,
1000 | 	    SET_NOMANPROC, SET_NOMANPROC,
1001 | 	    SET_NOMANPROC, SET_MANSTART, SET_MANSTART,
1002 | 	    SET_NOMANSTART, SET_NOMANSTART,
1003 | 	    SET_NOMANSTART, SET_TRANSFORM, SET_TRANSFORM, SET_NOTRANSFORM,
1004 | 	    SET_NOTRANSFORM, SET_XFLAG, SET_XFLAG, SET_ANYCENTRE, SET_ANYCENTRE,
1005 | 	    SET_ANYCENTRE, SET_ANYCENTRE,
1006 | 	    SET_HOMECENTRE, SET_HOMECENTRE, SET_HOMECENTRE, SET_HOMECENTRE,
1007 | 	    SET_WATCHALL, SET_NOWATCHALL,
1008 | 	    SET_ABSENCE, SET_ABSENCE, SET_ABSENCE, SET_ABSENCE, SET_ABSENCE,
1009 | 	    SET_NOABSENCE, SET_NOABSENCE, SET_NOABSENCE, SET_NOABSENCE, SET_NOABSENCE,
1010 | 	    SET_MAXABSENCE, SET_MAXABSENCE,
1011 | 	    SET_MAXABSENCE, SET_ONECENTRE,
1012 | 	    SET_ONECENTRE, SET_NORMBROAD, SET_NORMBROAD,
1013 | 	    SET_NORMBROAD, SET_NONORMBROAD, SET_NONORMBROAD, SET_NONORMBROAD,
1014 | 	    SET_BLANKPRESS, SET_NOBLANKPRESS,
1015 | 	    SET_MINORPRESS, SET_NOMINORPRESS,
1016 | 	    SET_MACH2, SET_MACH2, SET_MACH2, SET_MACH2, SET_NOMACH2,
1017 | 	    SET_NOMACH2, SET_NOMACH2, SET_NOMACH2,
1018 | 	    SET_AIRLIFT, SET_AIRLIFT,
1019 | 	    SET_NOAIRLIFT, SET_NOAIRLIFT, SET_BLANKBOARD,
1020 | 	    SET_BLANKBOARD, SET_FORT, SET_FORT, SET_FORT,
1021 | 	    SET_FORT, SET_NOFORT, SET_NOFORT,
1022 | 	    SET_NOFORT, SET_NOFORT, SET_RESUME,
1023 | 	    SET_NORESUME, SET_AUTODISBAND,
1024 | 	    SET_NOAUTODISBAND,
1025 | 	    SET_ANYDISBAND, SET_NORMALDISBAND,
1026 | 	    SET_ATTACKTRANS, SET_ATTACKTRANS, SET_NOATTACKTRANS,
1027 | 	    SET_NOATTACKTRANS, SET_COASTALCONVOY,
1028 | 	    SET_COASTALCONVOY, SET_NOCOASTALCONVOY,
1029 | 	    SET_NOCOASTALCONVOY,
1030 | 	    SET_MONEY, SET_NOMONEY, SET_MOVEDISBAND,
1031 | 	    SET_NOMOVEDISBAND, SET_BASIC, SET_ADVANCED,
1032 | 	    SET_DUALITY, SET_NODUALITY, SET_HONGKONG,
1033 | 	    SET_NOHONGKONG, SET_GATEWAY,
1034 | 	    SET_GATEWAY, SET_NOGATEWAY, SET_NOGATEWAY,
1035 | 	    SET_RAILWAY, SET_RAILWAY,
1036 | 	    SET_NORAILWAY, SET_NORAILWAY,
1037 | 	    SET_STORM, SET_STORM, SET_NOSTORM,
1038 | 	    SET_NOSTORM, SET_PREFLIST, SET_PREFBOTH, SET_PREFRAND,
1039 | 	    SET_MUSTORDER, SET_NOMUSTORDER, SET_SECRET, SET_NOSECRET,
1040 | 	    SET_NOTVARIANT, SET_POSTALPRESS,
1041 | 	    SET_NOPOSTALPRESS, SET_BLIND_CENTRES, SET_BLIND_CENTRES,
1042 | 	    SET_BLIND_NOCENTRES, SET_BLIND_NOCENTRES,
1043 | 	    SET_SUMMER, SET_NOSUMMER, SET_GARRISONS, SET_NOGARRISONS,
1044 | 	    SET_NEUTRALS, SET_NONEUTRALS,
1045 | 	    SET_CAPTUREWIN,
1046 | 	    SET_NOCAPTUREWIN ,
1047 | 	    SET_AUTOCREATE, SET_NOAUTOCREATE,
1048 | 	    SET_TOUCHPRESS, SET_NOTOUCHPRESS
1049 | 	};
1050 | 
1051 | 	static char privs[] = {
1052 | 	    'x', PRV_NOOP, PRV_NOOP, PRV_ADD, PRV_ADD, PRV_PW, PRV_PW, PRV_PW,
1053 | 	    PRV_WAIT, PRV_WAIT, PRV_NOWAIT, PRV_NOWAIT, PRV_PREF, PRV_PREF,
1054 | 	    PRV_MOVES, PRV_BUILD, PRV_BUILD, PRV_RETREAT, PRV_MOVES, PRV_BUILD,
1055 | 	    PRV_BUILD, PRV_RETREAT, PRV_DEADLINE, PRV_START, PRV_GRACE,
1056 | 	    PRV_NONMR, PRV_NONMR, PRV_NMR, PRV_NMR, PRV_MODERATE,
1057 | 	    PRV_UNMODERATE, PRV_MODERATE, PRV_UNMODERATE, PRV_REVEAL,
1058 | 	    PRV_NOREVEAL, PRV_NOLIST, PRV_NOLIST, PRV_NOLIST, PRV_LIST,
1059 | 	    PRV_LIST, PRV_WHTGRY, PRV_GRYWHT, PRV_WHITE, PRV_GREY, PRV_GREY,
1060 | 	    PRV_WHITE, PRV_NOPRESS, PRV_NOPRESS, PRV_GREY, PRV_WHTGRY,
1061 | 	    PRV_GRYWHT, PRV_WHITE, PRV_NOFAKEB, PRV_NOFAKEB, PRV_PARTMAY,
1062 | 	    PRV_PARTMAY, PRV_PARTFBD, PRV_PARTFBD, PRV_PARTFBD, PRV_FAKEB,
1063 | 	    PRV_FAKEB, PRV_NOPART, PRV_PART, PRV_OBANY, PRV_OBANY, PRV_OBNONE,
1064 | 	    PRV_OBNONE, PRV_OBNONE, PRV_OBWHITE, PRV_OBWHITE, PRV_PROXY,
1065 | 	    PRV_NOPROXY, PRV_DICE, PRV_NODICE, PRV_FAMINE, PRV_NOFAMINE,
1066 | 	    PRV_PLAGUE, PRV_NOPLAGUE, PRV_LOANS, PRV_LOANS, PRV_NOLOANS,
1067 | 	    PRV_NOLOANS, PRV_LOANS, PRV_NOLOANS, PRV_ASSASS, PRV_ASSASS,
1068 | 	    PRV_ASSASS, PRV_NOASSASS, PRV_NOASSASS, PRV_NOASSASS, PRV_ADJ,
1069 | 	    PRV_ADJ, PRV_ADJ, PRV_NOADJ, PRV_NOADJ, PRV_NOADJ, PRV_SPECIAL,
1070 | 	    PRV_NOSPECIAL, PRV_ALLPRESS, PRV_NOALLPRESS, PRV_COMMENT,
1071 | 	    PRV_COMMENT, PRV_COMMENT, PRV_QUIET, PRV_NOQUIET, PRV_RATE,
1072 | 	    PRV_NORATE, PRV_ACCESS, PRV_LEVEL, PRV_VARIANT, PRV_DEDICATE,
1073 | 	    PRV_ONTIMERAT, PRV_RESRAT, PRV_SHOW, PRV_NOSHOW, PRV_DIAS,
1074 | 	    PRV_NODIAS, PRV_CONCESSIONS, 
1075 | 	    PRV_NOCONCESSIONS, PRV_CONC, PRV_CONC, PRV_NOCONC, PRV_NOCONC,
1076 | 	    PRV_DRAW, PRV_NODRAW, PRV_EPNUM, PRV_EPNUM,
1077 | 	    PRV_EPNUM, PRV_CENTERS, PRV_CENTERS,
1078 | 	    PRV_BN_MN, PRV_BN_MN, PRV_BN_MN, 
1079 | 	    PRV_BN_MN, PRV_BN_MN, PRV_BN_MN, 
1080 | 	    PRV_BN_MN, PRV_BN_MN, PRV_BN_MN,
1081 | 	    PRV_BN_MN, PRV_BN_MN, PRV_BN_MN,
1082 | 	    PRV_GRACEDAYS, PRV_NOGRACEDAYS,
1083 | 	    PRV_NO_PLAYERS, PRV_PLAYERALLOW, PRV_PLAYERALLOW, PRV_PLAYERALLOW,
1084 | 	    PRV_PLAYERALLOW, PRV_PLAYERDENY, PRV_PLAYERDENY, PRV_PLAYERDENY,
1085 | 	    PRV_PLAYERDENY, PRV_MASTERALLOW, PRV_MASTERALLOW, PRV_MASTERALLOW,
1086 | 	    PRV_MASTERALLOW, PRV_MASTERDENY, PRV_MASTERDENY, PRV_MASTERDENY,
1087 | 	    PRV_MASTERDENY, PRV_STRWAIT, PRV_NOSTRWAIT,
1088 | 	    PRV_LATECOUNT, PRV_NOLATECOUNT, PRV_STRCONVOY, PRV_NOSTRCONVOY,
1089 | 	    PRV_LATEPRESS, PRV_NOLATEPRESS, PRV_MANPROC,
1090 | 	    PRV_MANPROC, PRV_NOMANPROC,
1091 | 	    PRV_NOMANPROC, PRV_NOMANPROC,
1092 | 	    PRV_NOMANPROC, PRV_MANSTART, PRV_MANSTART,
1093 | 	    PRV_NOMANSTART, PRV_NOMANSTART,
1094 | 	    PRV_NOMANSTART, PRV_TRANSFORM, PRV_TRANSFORM, PRV_NOTRANSFORM,
1095 | 	    PRV_NOTRANSFORM, PRV_XFLAG, PRV_XFLAG, PRV_ANYCENTRE, PRV_ANYCENTRE,
1096 | 	    PRV_ANYCENTRE, PRV_ANYCENTRE,
1097 | 	    PRV_HOMECENTRE, PRV_HOMECENTRE, PRV_HOMECENTRE, PRV_HOMECENTRE,
1098 | 	    PRV_WATCHALL, PRV_NOWATCHALL,
1099 | 	    PRV_ABSENCE, PRV_ABSENCE, PRV_ABSENCE, PRV_ABSENCE, PRV_ABSENCE,
1100 | 	    PRV_NOABSENCE, PRV_NOABSENCE,
1101 | 	    PRV_NOABSENCE, PRV_NOABSENCE, PRV_NOABSENCE,
1102 | 	    PRV_MAXABSENCE, PRV_MAXABSENCE,
1103 | 	    PRV_MAXABSENCE, PRV_ONECENTRE,
1104 | 	    PRV_ONECENTRE, PRV_NORMBROAD, PRV_NORMBROAD,
1105 | 	    PRV_NORMBROAD, PRV_NONORMBROAD, PRV_NONORMBROAD, PRV_NONORMBROAD,
1106 | 	    PRV_BLANKPRESS, PRV_NOBLANKPRESS,
1107 | 	    PRV_MINORPRESS, PRV_NOMINORPRESS,
1108 | 	    PRV_MACH2, PRV_MACH2, PRV_MACH2, PRV_MACH2, PRV_NOMACH2,
1109 | 	    PRV_NOMACH2, PRV_NOMACH2, PRV_NOMACH2,
1110 | 	    PRV_AIRLIFT, PRV_AIRLIFT,
1111 | 	    PRV_NOAIRLIFT, PRV_NOAIRLIFT, PRV_BLANKBOARD,
1112 | 	    PRV_BLANKBOARD, PRV_FORT, PRV_FORT, PRV_FORT,
1113 | 	    PRV_FORT, PRV_NOFORT, PRV_NOFORT,
1114 | 	    PRV_NOFORT, PRV_NOFORT, PRV_RESUME,
1115 | 	    PRV_NORESUME, PRV_AUTODISBAND, PRV_NOAUTODISBAND,
1116 | 	    PRV_ANYDISBAND, PRV_NORMALDISBAND,
1117 | 	    PRV_ATTACKTRANS, PRV_ATTACKTRANS, PRV_NOATTACKTRANS,
1118 | 	    PRV_NOATTACKTRANS, PRV_COASTALCONVOY,
1119 | 	    PRV_COASTALCONVOY, PRV_NOCOASTALCONVOY,
1120 | 	    PRV_NOCOASTALCONVOY,
1121 | 	    PRV_MONEY, PRV_NOMONEY, PRV_MOVEDISBAND,
1122 | 	    PRV_NOMOVEDISBAND, PRV_BASIC, PRV_ADVANCED,
1123 | 	    PRV_DUALITY, PRV_NODUALITY, PRV_HONGKONG,
1124 | 	    PRV_NOHONGKONG, PRV_GATEWAY,
1125 | 	    PRV_GATEWAY, PRV_NOGATEWAY, PRV_NOGATEWAY,
1126 | 	    PRV_RAILWAY, PRV_RAILWAY, PRV_NORAILWAY, PRV_NORAILWAY,
1127 | 	    PRV_STORM, PRV_STORM, PRV_NOSTORM,
1128 | 	    PRV_NOSTORM, PRV_PREFLIST, PRV_PREFBOTH, PRV_PREFRAND,
1129 | 	    PRV_MUSTORDER,
1130 | 	    PRV_NOMUSTORDER, PRV_SECRET, PRV_NOSECRET,
1131 | 	    PRV_NOTVARIANT, PRV_POSTALPRESS,
1132 | 	    PRV_NOPOSTALPRESS, PRV_BLIND_CENTRES, PRV_BLIND_CENTRES,
1133 | 	    PRV_BLIND_NOCENTRES, PRV_BLIND_NOCENTRES,
1134 | 	    PRV_SUMMER, PRV_NOSUMMER, PRV_GARRISONS, PRV_NOGARRISONS,
1135 | 	    PRV_NEUTRALS, PRV_NONEUTRALS, PRV_CAPTUREWIN, PRV_NOCAPTUREWIN,
1136 | 	    PRV_AUTOCREATE, PRV_NOAUTOCREATE,
1137 | 	    PRV_TOUCHPRESS, PRV_NOTOUCHPRESS
1138 | 	};
1139 | 
1140 | 	chk24nmr = 0;
1141 | 	while (*s) {
1142 | 		if (subjectline[0] == '\0')
1143 | 			sprintf(subjectline, "%s:%s - %s Parameter Change", JUDGE_CODE, dipent.name, dipent.phase);
1144 | 
1145 | 		s = lookfor(t = s, keys, nentry(keys), &i);
1146 | 		sprintf(stat_text, "%3.3d %s", action[i], dipent.name);
1147 | 		DIPDEBUG(stat_text);
1148 | 
1149 | 		if (privs[i] == 'm' && !PRIVOK) {
1150 | 			fprintf(rfp, "> set %s\n", t);
1151 | 			fprintf(rfp, "Sorry, game '%s' is moderated.  ", dipent.name);
1152 | 			fprintf(rfp, "Only the master can submit that command.\n\n");
1153 | 			return;
1154 | 		}
1155 | 		switch (action[i]) {
1156 | 		case SET_NOOP:
1157 | 			break;
1158 | 
1159 | 		case SET_ADD:
1160 | 			if (mail_getaddr(s, dipent.players[player].address)) {
1161 | 				if (*s)
1162 | 					fprintf(rfp, "Invalid return address specified: %s", s);
1163 | 				for (t = raddr, s = dipent.players[player].address; (*s++ = *t++););
1164 | 			}
1165 | 			fprintf(rfp, "Setting return address to %s.\n\n",
1166 | 				dipent.players[player].address);
1167 | 			if (!(dipent.flags & F_GUNBOAT) ||
1168 | 			    dipent.players[player].power == MASTER) {
1169 | 				sprintf(subjectline, "%s:%s - %s Player Address Change: %c", JUDGE_CODE, dipent.name, dipent.phase, dipent.pl[dipent.players[player].power]);
1170 | 
1171 | 				mfprintf(bfp,
1172 | 					 "The return address for %s in game '%s' has been changed\nto %s.\n\n",
1173 | 					 powers[dipent.players[player].power], dipent.name,
1174 | 					 dipent.players[player].address);
1175 | 				pprintf(cfp,
1176 | 					"%sThe return address for %s in game '%s' has been changed\nto %s.\n\n",
1177 | 					NowString(),
1178 | 					powers[dipent.players[player].power], dipent.name,
1179 | 					dipent.players[player].address);
1180 | 				broadcast = 1;
1181 | 			}
1182 | 			s = "";
1183 | 			break;
1184 | 
1185 | 		case SET_BUILD:
1186 | 			memcpy(&seq, &dipent.builds, sizeof(seq));
1187 | 			if (getseq(rfp, t, &seq))
1188 | 				break;
1189 | 			memcpy(&dipent.builds, &seq, sizeof(seq));
1190 | 			broad_params = 1;
1191 | 			chk24nmr++;
1192 | 			s = "";
1193 | 			break;
1194 | 
1195 | 		case SET_DEADLINE:
1196 | 			if (mail_date(&s, &dates, 0, rfp))
1197 | 				fprintf(rfp, "%sInvalid deadline date specified.\n\n", t);
1198 | 			else {
1199 | 				sequence *seq;
1200 | 				dipent.deadline = dates;
1201 | 				sprintf(subjectline, "%s:%s - %s Deadline Adjustment to: %s", JUDGE_CODE, dipent.name, dipent.phase, ptime(&dates));
1202 | 				fprintf(rfp, "Deadline set to %s.\n", ptime(&dates));
1203 | 				/* WAS mfprintf  1/95 BLR */
1204 | 				fprintf(bfp, "%s as %s set the deadline\n", xaddr, PRINT_POWER);
1205 | 				fprintf(mbfp, "%s as %s set the deadline\n", raddr, PRINT_POWER);
1206 | 				mfprintf(bfp, "for game '%s' to %s.\n", dipent.name, ptime(&dates));
1207 | 				broadcast = 1;
1208 | 				seq = dipent.phase[5] == 'M' ? &dipent.movement :
1209 | 				    dipent.phase[5] == 'R' ? &dipent.retreat :
1210 | 				    dipent.phase[5] == 'B' ? &dipent.builds :
1211 | 				    &dipent.movement;
1212 | 				if (dipent.grace < dipent.deadline + (seq->grace * HRS2SECS)) {
1213 | 					dipent.grace = dipent.deadline + (seq->grace * HRS2SECS);
1214 | 					if (dipent.flags & F_GRACEDAYS) {
1215 | 						for (k = 0; k < 8; k++) {
1216 | 							tm = localtime(&dipent.grace);
1217 | 							if (seq->days[tm->tm_wday] == '-')
1218 | 								dipent.grace += 24 * 60 * 60;
1219 | 							else if (islower(seq->days[tm->tm_wday]) && tm->tm_hour < 12)
1220 | 								dipent.grace += (12 - tm->tm_hour) * 60 * 60 - tm->tm_min * 60 - tm->tm_sec;
1221 | 							else
1222 | 								break;
1223 | 						}
1224 | 					}
1225 | 					fprintf(rfp, "Grace period deadline advanced to %s.\n",
1226 | 						ptime(&dipent.grace));
1227 | 					mfprintf(bfp, "Grace period deadline advanced to %s.\n",
1228 | 						 ptime(&dipent.grace));
1229 | 				}
1230 | 				if (dipent.start > dipent.deadline) {
1231 | 					dipent.start = dipent.deadline;
1232 | 				}
1233 | 				fprintf(rfp, "\n");
1234 | 				mfprintf(bfp, "\n");
1235 | 				/* Reset the SF_REMINDER flags for all players */
1236 | 				for ( i = 0; i < dipent.n; i++)
1237 | 				    dipent.players[i].status &= ~SF_REMIND;	
1238 | 			}
1239 | 			s = "";
1240 | 			break;
1241 | 
1242 | 		case SET_GRACE:
1243 | 			if (mail_date(&s, &dates, 0, rfp))
1244 | 				fprintf(rfp, "%sInvalid grace date specified.\n\n", t);
1245 | 			else if (dates < dipent.deadline) {
1246 | 				fprintf(rfp, "%sGrace date cannot be earlier than deadline.\n\n", t);
1247 | 			} else {
1248 | 				dipent.grace = dates;
1249 | 				sprintf(subjectline, "%s:%s - %s Grace Adjustment to: %s", JUDGE_CODE, dipent.name, dipent.phase, ptime(&dates));
1250 | 				fprintf(rfp, "Grace period set to %s.\n\n", ptime(&dates));
1251 | 				/* WAS mfprintf  1/95 BLR */
1252 | 				fprintf(bfp, "%s as %s set the grace period\n", xaddr, PRINT_POWER);
1253 | 				fprintf(mbfp, "%s as %s set the grace period\n", raddr, PRINT_POWER);
1254 | 				mfprintf(bfp, "for game '%s' to %s.\n\n", dipent.name, ptime(&dates));
1255 | 				broadcast = 1;
1256 | 			}
1257 | 			s = "";
1258 | 			break;
1259 | 
1260 | 		case SET_MOVES:
1261 | 			memcpy(&seq, &dipent.movement, sizeof(seq));
1262 | 			if (getseq(rfp, t, &seq))
1263 | 				break;
1264 | 			memcpy(&dipent.movement, &seq, sizeof(seq));
1265 | 			broad_params = 1;
1266 | 			chk24nmr++;
1267 | 			s = "";
1268 | 			break;
1269 | 
1270 | 		case SET_NOWAIT:
1271 | 			if (signedon > 0 && read_phase > 0)
1272 | 				fprintf(pfp, "%c: set nowait\n", name[0]);
1273 | 			else {
1274 | 				if (!(dipent.players[player].status & SF_WAIT))
1275 | 					fprintf(rfp, "Set nowait: no point!\n\n");
1276 | 				else {
1277 | 					fprintf(rfp, "Wait status cleared.  Orders may now be processed\n");
1278 | 					fprintf(rfp, "before %s.\n\n", ptime(&dipent.deadline));
1279 | 					dipent.players[player].status &= ~SF_WAIT;
1280 | 				}
1281 | 			}
1282 | 			break;
1283 | 
1284 | 		case SET_PW:
1285 | 			/* Get a pointer to the players password */
1286 | 			t = dipent.players[player].password;
1287 | 			s1 = s;
1288 | 			/* Copy the password from the input line */
1289 |                         passOK = 1;
1290 | 			while (*s1 && !isspace(*s1) ) {
1291 |                                if (!isalnum(*s1)) passOK =0; /*alphanum passwords only! */ 
1292 | 				s1++;
1293 | 			}
1294 | 
1295 | 			/* If no characters have been copied */
1296 | 			if (s1 == s ) { 
1297 | 				/* Insult player */
1298 | 				fprintf(rfp, "Try to put in a non-blank password.\n\n");
1299 | 			} else if (passOK == 0)
1300 |                         {
1301 | 				fprintf(rfp, "Password can only be alpha-numeric characters.\n\n");
1302 | 				s = s1; /* to skip whole password line */
1303 | 			} else {
1304 | 				/* Terminate the player and confirm change */
1305 | 				while (*s && !isspace(*s)) {
1306 |                                    *t++ = isupper(c = *s++) ? tolower(c) : c;
1307 | 				 }
1308 | 				*t++ = '\0';
1309 | 				fprintf(rfp, "Password set.\n\n");
1310 | 			}
1311 | 
1312 | 			/* Break out of the case statement */
1313 | 			break;
1314 | 
1315 | 		case SET_PREF:
1316 | 			if ((dipent.seq[0] != 'x') && !starting) {
1317 | 				fprintf(rfp, "You may not change the preference list after the game %s",
1318 | 					"begins.\n");
1319 | 			} else {
1320 | 				if ((strstr(subjectline, "New Player Signon") == NULL) && (strstr(subjectline, "Ready to Start") == NULL)) {
1321 | 					sprintf(subjectline, "%s:%s - %s Preference Change", JUDGE_CODE, dipent.name, dipent.phase);
1322 | 				}
1323 | 
1324 | 				for (t = s; *s && !isspace(*s) && *s != ','; s++);
1325 | 				if (*s)
1326 | 					*s++ = '\0';
1327 | 				while (isspace(*s))
1328 | 					s++;
1329 | 				if (!*t || *t == '\n') {
1330 | 					fprintf(rfp, "Preference list cleared.\n");
1331 | 					*dipent.players[player].pref = '\0';
1332 | 				} else {
1333 | 					u = t;
1334 | 
1335 | 					if (dipent.x2flags & X2F_PREFRANDONLY) {
1336 | 						if (*u++ == '*' && (!*u || *u == '\0' || *u == '\n')) {
1337 | 							fprintf(rfp, "Preference list '%s' set.\n", t);
1338 | 							strcpy(dipent.players[player].pref, t);
1339 | 							fprintf(mbfp,"Player %s changed preference list.\n\n",raddr);
1340 | 
1341 | 							ShowPreferences(mbfp);
1342 | 							broadcast_master_only = 1;  /* Only master(s) are told of this */
1343 | 						} else {
1344 | 							fprintf(rfp, "Preference list '%s' not set.\n", t);
1345 | 							if (*dipent.players[player].pref) {
1346 | 								fprintf(rfp, "Preference list remains '%s'.\n",
1347 | 									dipent.players[player].pref);
1348 | 							}
1349 | 						}
1350 | 					} else {
1351 | 						if (dipent.x2flags & X2F_PREFRANDALLOW) {
1352 | 							if ((*u++ == '*' && (!*u || *u == '\0' || *u == '\n')) || !(chkpref(t, NULL, NULL))) {
1353 | 								fprintf(rfp, "Preference list '%s' set.\n", t);
1354 | 								strcpy(dipent.players[player].pref, t);
1355 | 								fprintf(mbfp,"Player %s changed preference list.\n\n",raddr);
1356 | 
1357 | 								ShowPreferences(mbfp);
1358 | 								broadcast_master_only = 1;  /* Only master(s) are told of this */
1359 | 							} else {
1360 | 								fprintf(rfp, "Preference list '%s' not set.\n", t);
1361 | 								if (*dipent.players[player].pref) {
1362 | 									fprintf(rfp, "Preference list remains '%s'.\n",
1363 | 										dipent.players[player].pref);
1364 | 								}
1365 | 							}
1366 | 						} else {
1367 | 							if (!chkpref(t, NULL, NULL)) {
1368 | 								fprintf(rfp, "Preference list '%s' set.\n", t);
1369 | 								strcpy(dipent.players[player].pref, t);
1370 | 								fprintf(mbfp,"Player %s changed preference list.\n\n",raddr);
1371 | 
1372 | 								ShowPreferences(mbfp);
1373 | 								broadcast_master_only = 1;  /* Only master(s) are told of this */
1374 | 							} else {
1375 | 								fprintf(rfp, "Preference list '%s' not set.\n", t);
1376 | 								if (*dipent.players[player].pref) {
1377 | 									fprintf(rfp, "Preference list remains '%s'.\n",
1378 | 										dipent.players[player].pref);
1379 | 								}
1380 | 							}
1381 | 						}
1382 | 					}
1383 | 				}
1384 | 			}
1385 | 			break;
1386 | 
1387 | 		case SET_RETREAT:
1388 | 			memcpy(&seq, &dipent.retreat, sizeof(seq));
1389 | 			if (getseq(rfp, t, &seq))
1390 | 				break;
1391 | 			memcpy(&dipent.retreat, &seq, sizeof(seq));
1392 | 			broad_params = 1;
1393 | 			chk24nmr++;
1394 | 			s = "";
1395 | 			break;
1396 | 
1397 | 		case SET_START:
1398 | 			if (mail_date(&s, &dates, 0, rfp))
1399 | 				fprintf(rfp, "%sInvalid start date specified.\n\n", t);
1400 | 			else {
1401 | 				sequence *seq;	/* Local scope variable because of cut&paste. */
1402 | 				/*  To be redone right in judge reorg. */
1403 | 
1404 | 				seq = dipent.phase[5] == 'M' ? &dipent.movement :
1405 | 				    dipent.phase[5] == 'R' ? &dipent.retreat :
1406 | 				    dipent.phase[5] == 'B' ? &dipent.builds :
1407 | 				    &dipent.movement;
1408 | 				dipent.start = dates;
1409 | 				fprintf(rfp, "Earliest start date set to %s.\n", ptime(&dates));
1410 | 				/* WAS mfprintf  1/95 BLR */
1411 | 				fprintf(bfp, "%s as %s set the earliest start date\n",
1412 | 					xaddr, PRINT_POWER);
1413 | 				fprintf(mbfp, "%s as %s set the earliest start date\n",
1414 | 					raddr, PRINT_POWER);
1415 | 				mfprintf(bfp, "for game '%s' to %s.\n", dipent.name, ptime(&dates));
1416 | 				if (dipent.deadline < dipent.start) {
1417 | 					dipent.deadline = dipent.start;
1418 | 					fprintf(rfp, "Deadline set to %s.\n", ptime(&dates));
1419 | 					mfprintf(bfp, "Deadline set to %s.\n", ptime(&dates));
1420 | 				}
1421 | 				if (dipent.grace < dipent.deadline) {
1422 | 					dipent.grace = dipent.deadline + 48 * 60 * 60;
1423 | 					if (dipent.flags & F_GRACEDAYS) {
1424 | 						for (k = 0; k < 8; k++) {
1425 | 							tm = localtime(&dipent.grace);
1426 | 							if (seq->days[tm->tm_wday] == '-')
1427 | 								dipent.grace += 24 * 60 * 60;
1428 | 							else if (islower(seq->days[tm->tm_wday]) && tm->tm_hour < 12)
1429 | 								dipent.grace += (12 - tm->tm_hour) * 60 * 60 - tm->tm_min * 60 - tm->tm_sec;
1430 | 							else
1431 | 								break;
1432 | 						}
1433 | 					}
1434 | 					fprintf(rfp, "Grace period deadline set to %s.\n",
1435 | 						ptime(&dipent.grace));
1436 | 					mfprintf(bfp, "Grace period deadline set to %s.\n",
1437 | 						 ptime(&dipent.grace));
1438 | 				}
1439 | 				fprintf(rfp, "\n");
1440 | 				fprintf(rfp, "\n");
1441 | 				broadcast = 1;
1442 | 			}
1443 | 			s = "";
1444 | 			break;
1445 | 
1446 | 		case SET_WAIT:
1447 | 			if (signedon < 0)
1448 | 				fprintf(rfp, "Set wait: no point!\n\n");
1449 | 			else {
1450 | 				if (read_phase > 0)
1451 | 					fprintf(pfp, "%c: set wait\n", name[0]);
1452 | 				else {
1453 | 					if (dipent.flags & F_STRWAIT) {
1454 | 						if ((dipent.players[player].status & SF_MOVE) ||
1455 | 						    (dipent.players[player].power == MASTER)) {
1456 | 							fprintf(rfp, "'Wait' status set.\n\n");
1457 | 							dipent.players[player].status |= SF_WAIT;
1458 | 						} else
1459 | 							fprintf(rfp, "You are not allowed to set wait!\n\n");
1460 | 					} else {
1461 | 						fprintf(rfp, "'Wait' status set.\n\n");
1462 | 						dipent.players[player].status |= SF_WAIT;
1463 | 					}
1464 | 				}
1465 | 			}
1466 | 			break;
1467 | 
1468 | 		case SET_ACCESS:
1469 | 			s = lookfor(s, accesses, naccess, &i);
1470 | 			if (!i) {
1471 | 				fprintf(rfp, "Invalid access: %s", s);
1472 | 			} else {
1473 | 				if (!strncasecmp(s, "-site", 5))
1474 | 					s += 5;
1475 | 				dipent.access = avalue[i];
1476 | 				fprintf(rfp, "Access for game '%s' set to %s-site.\n", dipent.name,
1477 | 					accesses[avalue[i]]);
1478 | 				pprintf(cfp, "%s%s as %s in '%s' set the\naccess mode to '%s-site'.\n",
1479 | 					NowString(),
1480 | 					xaddr, powers[dipent.players[player].power],
1481 | 				   dipent.name, accesses[dipent.access]);
1482 | 				/* WAS mfprintf  1/95 BLR */
1483 | 				fprintf(bfp, "%s as %s in '%s' set the\naccess mode to '%s-site'.\n",
1484 | 					xaddr, PRINT_POWER, dipent.name, accesses[dipent.access]);
1485 | 				fprintf(mbfp, "%s as %s in '%s' set the\naccess mode to '%s-site'.\n",
1486 | 					raddr, PRINT_POWER, dipent.name, accesses[dipent.access]);
1487 | 				broadcast = 1;
1488 | 			}
1489 | 			break;
1490 | 
1491 | 		case SET_DEDICATE:
1492 | 			i = atoi(s);
1493 | 			while (isdigit(*s) || *s == '-' || *s == '+')
1494 | 				s++;
1495 | 			if (i == dipent.dedicate) {
1496 | 				fprintf(rfp, "Set Dedication %d: It already was!\n", i);
1497 | 			} else if (i > ded[dipent.players[player].userid].r) {
1498 | 				fprintf(rfp, "You cannot set dedication to %d which is above your ", i);
1499 | 				fprintf(rfp, "own of %d.\n", ded[dipent.players[player].userid].r);
1500 | 			} else {
1501 | 				dipent.dedicate = i;
1502 | 				fprintf(rfp, "Dedication level for game '%s' set to %d.\n", dipent.name,
1503 | 					dipent.dedicate);
1504 | 				pprintf(cfp, "%s%s as %s in '%s' set the\ndedication level to %d.\n",
1505 | 					NowString(),
1506 | 					xaddr, powers[dipent.players[player].power],
1507 | 					dipent.name, dipent.dedicate);
1508 | 				/* WAS mfprintf  1/95 BLR */
1509 | 				fprintf(bfp, "%s as %s in '%s' set the\ndedication level to %d.\n",
1510 | 					xaddr, PRINT_POWER, dipent.name, dipent.dedicate);
1511 | 				fprintf(mbfp, "%s as %s in '%s' set the\ndedication level to %d.\n",
1512 | 					raddr, PRINT_POWER, dipent.name, dipent.dedicate);
1513 | 				broadcast = 1;
1514 | 			}
1515 | 			break;
1516 | 
1517 | 		case SET_ONTIMERAT:
1518 | 		f = (float)atof(s);
1519 | 			while (isdigit(*s) || *s == '.' || *s == '+')
1520 | 						s++;
1521 | 			if(get_data(dipent.players[player].userid,total) != 0)  
1522 | 			{
1523 | 				temprat = 1.0 * get_data(dipent.players[player].userid,ontime) / get_data(dipent.players[player].userid,total);
1524 | 			} else temprat = 1;
1525 | 			if(f > 1 || f < 0)
1526 | 			{
1527 | 				fprintf(rfp,"set ontimerat %.3f\n",f);
1528 | 				fprintf(rfp,"Ontime ratio must be between 0 an 1.\n");
1529 | 			} else if(f == dipent.orded) {
1530 | 				fprintf(rfp,"The ontime ratio already is %.3f!\n",dipent.orded);	
1531 | 			} else if(f > temprat) {
1532 | 				fprintf(rfp,"set ontimerat %.3f\n",f);
1533 | 				fprintf(rfp,"You may not set an ontime ratio higher than your own.\n");
1534 | 				fprintf(rfp,"Use 'get dedication' to check your ratio.\n");
1535 | 			} else {
1536 | 				dipent.orded = f;
1537 | 				fprintf(rfp,"Ontime ratio in game '%s' set to %.3f.\n",dipent.name,dipent.orded);
1538 | 				pprintf(cfp,"%s%s as %s in '%s' set the\nontime ratio to %.3f.\n",
1539 | 					NowString(),
1540 | 					xaddr,powers[dipent.players[player].power],
1541 | 					dipent.name,dipent.orded);
1542 | 				fprintf(bfp,"%s as %s in '%s' set the\nontime ratio to %.3f.\n",
1543 | 					xaddr,PRINT_POWER,dipent.name,dipent.orded);
1544 | 				fprintf(mbfp,"%s as %s in '%s' set the\nontime ratio to %.3f.\n",
1545 | 					xaddr,PRINT_POWER,dipent.name,dipent.orded);
1546 | 				broadcast = 1;
1547 | 				}
1548 | 				break;
1549 | 
1550 | 		case SET_RESRAT:
1551 | 			f = (float)atof(s);
1552 | 			while (isdigit(*s) || *s == '.' || *s == '+')
1553 | 				s++;
1554 | 			if(get_data(dipent.players[player].userid,started) == 0 && get_data(dipent.players[player].userid,tookover) == 0)
1555 | 			{
1556 | 				temprat = 0;
1557 | 			}
1558 | 			else
1559 | 			{
1560 | 				temprat = 1.0 * get_data(dipent.players[player].userid,resigned) / (get_data(dipent.players[player].userid,started) + get_data(dipent.players[player].userid,total));
1561 | 			}
1562 | 			if(f > 1 || f < 0)
1563 | 			{
1564 | 				fprintf(rfp,"set resrat %.3f\n",f);
1565 | 				fprintf(rfp,"Ratio value must be between 0 and 1.\n");
1566 | 			} else if(f == dipent.rrded) {
1567 | 				fprintf(rfp,"The CD ratio is already %.3f.\n", dipent.rrded);
1568 | 			} else if(f < temprat) {
1569 | 				fprintf(rfp,"set resrat %.3f\n",f);
1570 | 				fprintf(rfp,"You may not set a maximum CD ratio lower than your own.\n");
1571 | 				fprintf(rfp,"Use 'get dedication' to check your record.\n");
1572 | 			} else {
1573 | 				dipent.rrded = f;
1574 | 				fprintf(rfp,"CD ratio in game '%s' set to %.3f.\n",dipent.name,dipent.rrded);
1575 | 				pprintf(cfp,"%s%s as %s in '%s' set the\nCD ratio to %.3f.\n",
1576 | 					NowString(),
1577 | 					xaddr,powers[dipent.players[player].power],
1578 | 					dipent.name,dipent.rrded);
1579 | 				fprintf(bfp,"%s as %s in '%s' set the\nCD ratio to %.3f.\n",
1580 | 					xaddr,PRINT_POWER,dipent.name,dipent.rrded);
1581 | 				fprintf(mbfp,"%s as %s in '%s' set the\nCD ratio to %.3f.\n",
1582 | 					xaddr,PRINT_POWER,dipent.name,dipent.rrded);
1583 | 				broadcast = 1;
1584 | 				}
1585 | 				break;
1586 | 
1587 | 		case SET_LEVEL:
1588 | 			s = lookfor(s, levels, nlevel, &i);
1589 | 			if (!i) {
1590 | 				fprintf(rfp, "Invalid level: %s", s);
1591 | 			} else {
1592 | 				dipent.level = lvalue[i];
1593 | 				fprintf(rfp, "Level for game '%s' set to %s.\n", dipent.name,
1594 | 				      (temp = printlevel(dipent.level)));
1595 | 				pprintf(cfp, "%s%s as %s in '%s' set the\nlevel to %s.\n",
1596 | 					NowString(),
1597 | 					xaddr, powers[dipent.players[player].power],
1598 | 					dipent.name, temp);
1599 | 				/* WAS mfprintf  1/95 BLR */
1600 | 				fprintf(bfp, "%s as %s in '%s' set the\nlevel to %s.\n",
1601 | 				  xaddr, PRINT_POWER, dipent.name, temp);
1602 | 				fprintf(mbfp, "%s as %s in '%s' set the\nlevel to %s.\n",
1603 | 				  raddr, PRINT_POWER, dipent.name, temp);
1604 | 				free(temp);
1605 | 				broadcast = 1;
1606 | 			}
1607 | 			break;
1608 | 
1609 | 		case SET_NMR:
1610 | 			if (dipent.flags & F_NONMR) {
1611 | 				dipent.flags ^= F_NONMR;
1612 | 				fprintf(rfp, "Game '%s' is no longer NoNMR.\n", dipent.name);
1613 | 				pprintf(cfp, "%s%s as %s in '%s' cleared the NoNMR flag.\n",
1614 | 					NowString(),
1615 | 					xaddr, powers[dipent.players[player].power], dipent.name);
1616 | 				/* WAS mfprintf  1/95 BLR */
1617 | 				fprintf(bfp, "%s as %s in '%s' cleared the NoNMR flag.\n",
1618 | 					xaddr, PRINT_POWER, dipent.name);
1619 | 				fprintf(mbfp, "%s as %s in '%s' cleared the NoNMR flag.\n",
1620 | 					raddr, PRINT_POWER, dipent.name);
1621 | 			} else {
1622 | 				fprintf(rfp, "Game '%s' is already set NMR.\n", dipent.name);
1623 | 			}
1624 | 			chk24nmr++;
1625 | 			break;
1626 | 
1627 | 		case SET_NONMR:
1628 | 			if (dipent.flags & F_NONMR) {
1629 | 				fprintf(rfp, "Game '%s' is already set NoNMR.\n", dipent.name);
1630 | 			} else {
1631 | 				dipent.flags |= F_NONMR;
1632 | 				fprintf(rfp, "Game '%s' is now NoNMR.\n", dipent.name);
1633 | 				pprintf(cfp, "%s%s as %s in '%s' set the NoNMR flag.\n",
1634 | 					NowString(),
1635 | 					xaddr, powers[dipent.players[player].power], dipent.name);
1636 | 				/* WAS mfprintf  1/95 BLR */
1637 | 				fprintf(bfp, "%s as %s in '%s' set the NoNMR flag.\n",
1638 | 					xaddr, PRINT_POWER, dipent.name);
1639 | 				fprintf(mbfp, "%s as %s in '%s' set the NoNMR flag.\n",
1640 | 					raddr, PRINT_POWER, dipent.name);
1641 | 				mfprintf(bfp, "Orders will not be processed until all powers ");
1642 | 				mfprintf(bfp, "have submitted complete orders.\n\n");
1643 | 			}
1644 | 			break;
1645 | 
1646 | 		case SET_LIST:
1647 | 			if (dipent.flags & F_NOLIST) {
1648 | 				dipent.flags ^= F_NOLIST;
1649 | 				fprintf(rfp, "Game '%s' is no longer NoList.\n", dipent.name);
1650 | 				/* WAS mfprintf  1/95 BLR */
1651 | 				fprintf(bfp, "%s as %s in '%s' cleared the NoList flag.\n",
1652 | 					xaddr, PRINT_POWER, dipent.name);
1653 | 				fprintf(mbfp, "%s as %s in '%s' cleared the NoList flag.\n",
1654 | 					raddr, PRINT_POWER, dipent.name);
1655 | 				broadcast = 1;
1656 | 			} else {
1657 | 				fprintf(rfp, "Game '%s' is already set List.\n", dipent.name);
1658 | 			}
1659 | 			break;
1660 | 
1661 | 		case SET_NOLIST:
1662 | 			if (dipent.flags & F_NOLIST) {
1663 | 				fprintf(rfp, "Game '%s' is already set NoList.\n", dipent.name);
1664 | 			} else {
1665 | 				dipent.flags |= F_NOLIST;
1666 | 				fprintf(rfp, "Game '%s' is now NoList.\n", dipent.name);
1667 | 				/* WAS mfprintf  1/95 BLR */
1668 | 				fprintf(bfp, "%s as %s in '%s' set the NoList flag.\n",
1669 | 					xaddr, PRINT_POWER, dipent.name);
1670 | 				fprintf(mbfp, "%s as %s in '%s' set the NoList flag.\n",
1671 | 					raddr, PRINT_POWER, dipent.name);
1672 | 				mfprintf(bfp, "The game will not be listed in the standard catalogue ");
1673 | 				mfprintf(bfp, "of available games.\n\n");
1674 | 				broadcast = 1;
1675 | 			}
1676 | 			break;
1677 | 
1678 | 		case SET_MODERATE:
1679 | 			if (dipent.flags & F_MODERATE) {
1680 | 				fprintf(rfp, "Game '%s' is already set moderated.\n", dipent.name);
1681 | 			} else {
1682 | 				dipent.flags |= F_MODERATE;
1683 | 				fprintf(rfp, "Game '%s' is now moderated.\n", dipent.name);
1684 | 				pprintf(cfp, "%s%s as %s in '%s' set the moderated flag.\n",
1685 | 					NowString(),
1686 | 					xaddr, powers[dipent.players[player].power], dipent.name);
1687 | 				/* WAS mfprintf  1/95 BLR */
1688 | 				fprintf(bfp, "%s as %s in '%s' set the moderated flag.\n",
1689 | 					xaddr, PRINT_POWER, dipent.name);
1690 | 				fprintf(mbfp, "%s as %s in '%s' set the moderated flag.\n",
1691 | 					raddr, PRINT_POWER, dipent.name);
1692 | 				broadcast = 1;
1693 | 			}
1694 | 			break;
1695 | 
1696 | 		case SET_UNMODERATE:
1697 | 			if (dipent.flags & F_MODERATE) {
1698 | 				dipent.flags ^= F_MODERATE;
1699 | 				fprintf(rfp, "Game '%s' is no longer moderated.\n", dipent.name);
1700 | 				pprintf(cfp, "%s%s as %s in '%s' cleared the moderated flag.\n",
1701 | 					NowString(),
1702 | 					xaddr, powers[dipent.players[player].power], dipent.name);
1703 | 				/* WAS mfprintf  1/95 BLR */
1704 | 				fprintf(bfp, "%s as %s in '%s' cleared the moderated flag.\n",
1705 | 					xaddr, PRINT_POWER, dipent.name);
1706 | 				fprintf(mbfp, "%s as %s in '%s' cleared the moderated flag.\n",
1707 | 					raddr, PRINT_POWER, dipent.name);
1708 | 				broadcast = 1;
1709 | 			} else {
1710 | 				fprintf(rfp, "Game '%s' is already set unmoderated.\n", dipent.name);
1711 | 			}
1712 | 			break;
1713 | 
1714 | 		case SET_NOSHOW:
1715 | 			if (dipent.flags & F_NOSHOW) {
1716 | 				fprintf(rfp, "Game '%s' is already set no show.\n", dipent.name);
1717 | 			} else {
1718 | 				dipent.flags |= F_NOSHOW;
1719 | 				fprintf(rfp, "Game '%s' will not reveal powers in broadcasts.\n",
1720 | 					dipent.name);
1721 | 				pprintf(cfp, "%s%s as %s in '%s' set the no show flag.\n",
1722 | 					NowString(),
1723 | 					xaddr, powers[dipent.players[player].power], dipent.name);
1724 | 				/* WAS mfprintf  1/95 BLR */
1725 | 				fprintf(bfp, "%s as %s in '%s' set the no show flag.\n",
1726 | 					xaddr, PRINT_POWER, dipent.name);
1727 | 				fprintf(mbfp, "%s as %s in '%s' set the no show flag.\n",
1728 | 					raddr, PRINT_POWER, dipent.name);
1729 | 				broadcast = 1;
1730 | 			}
1731 | 			break;
1732 | 
1733 | 		case SET_SHOW:
1734 | 			if (dipent.flags & F_NOSHOW) {
1735 | 				dipent.flags ^= F_NOSHOW;
1736 | 				fprintf(rfp, "Game '%s' is no longer set no show.\n", dipent.name);
1737 | 				pprintf(cfp, "%s%s as %s in '%s' cleared the no show flag.\n",
1738 | 					NowString(),
1739 | 					xaddr, powers[dipent.players[player].power], dipent.name);
1740 | 				/* WAS mfprintf  1/95 BLR */
1741 | 				fprintf(bfp, "%s as %s in '%s' cleared the no show flag.\n",
1742 | 					xaddr, PRINT_POWER, dipent.name);
1743 | 				fprintf(mbfp, "%s as %s in '%s' cleared the no show flag.\n",
1744 | 					raddr, PRINT_POWER, dipent.name);
1745 | 				broadcast = 1;
1746 | 			} else {
1747 | 				fprintf(rfp, "Game '%s' is already set to show powers in broadcasts.\n",
1748 | 					dipent.name);
1749 | 			}
1750 | 			break;
1751 | 
1752 | 		case SET_DRAW:
1753 | 			if (check_can_vote(player, DRAW_VOTE))
1754 | 				break;
1755 | 			if (dipent.flags & F_NODIAS) {
1756 | 
1757 | 				for (t = s; *s && !isspace(*s) && *s != ','; s++);
1758 | 				if (*s)
1759 | 					*s++ = '\0';
1760 | 				while (isspace(*s))
1761 | 					s++;
1762 | 				if (!*t || *t == '\n') {
1763 | 					fprintf(rfp, "This game is set NoDIAS. You must specify a power%s",
1764 | 					   " list to vote on a draw.\n");
1765 | 				} else if (chkdraw(t)) {
1766 | 					fprintf(rfp, "Draw list '%s' not set.\n", t);
1767 | 					if (dipent.players[player].status & SF_DRAW) {
1768 | 						fprintf(rfp, "Draw list remains '%s'.\n",
1769 | 							dipent.players[player].pref);
1770 | 					}
1771 | 				} else {
1772 | 					fprintf(rfp, "Draw list '%s' set.\n", t);
1773 | 					strcpy(dipent.players[player].pref, t);
1774 | 					dipent.players[player].status |= SF_DRAW;
1775 | 					process_draw();
1776 | 				}
1777 | 			} else {
1778 | 				fprintf(rfp, "You will now accept a DIAS draw.\n");
1779 | 				dipent.players[player].status |= SF_DRAW;
1780 | 				process_draw();
1781 | 			}
1782 | 			break;
1783 | 		case SET_NODRAW:
1784 | 			if (check_can_vote(player,DRAW_VOTE))
1785 | 				break;
1786 | 			if (dipent.flags & F_NODIAS)
1787 | 				fprintf(rfp, "You will now only accept a concession.\n");
1788 | 			else
1789 | 				fprintf(rfp, "You will now not accept a DIAS draw.\n");
1790 | 			dipent.players[player].status &= ~SF_DRAW;
1791 | 			break;
1792 | 
1793 | 		case SET_CONC:
1794 | 			if(check_can_vote(player, CONC_VOTE))
1795 | 				break;
1796 | 			if(dipent.flags & F_NODIAS)
1797 | 			{
1798 | 				fprintf(rfp,"It is pointless to vote for a concession in a NoDIAS game\n");
1799 | 				fprintf(rfp,"Simply vote for a one player draw!\n\n");
1800 | 				fprintf(rfp, "Send 'get draws' for more details.\n");
1801 | 				break;
1802 | 			}
1803 | 			for (t = s; *s && !isspace(*s) && *s != ','; s++);
1804 |                                 if (*s)
1805 |                                         *s++ = '\0';
1806 |                                 while (isspace(*s))
1807 |                                         s++;
1808 |                                 if (!*t || *t == '\n') {
1809 |                                         fprintf(rfp, "You must specify the largest power on the board as the power\nyou are proposing the concession to.\n");
1810 |                                 } else if (chkconc(t)) {
1811 |                                         fprintf(rfp, "Concession not set.\n");
1812 |                                 } else {
1813 | 					fprintf(rfp, "Concession to '%s' set.\n", t);
1814 | 					dipent.players[player].status |= SF_CONC;
1815 | 					process_conc();
1816 | 			}
1817 | 			break;
1818 | 
1819 | 		case SET_NOCONC:
1820 | 			if (check_can_vote(player, CONC_VOTE))
1821 |                                 break;
1822 | 			fprintf(rfp,"You will no longer accept a concession to the largest power on the board.\n");
1823 |                         dipent.players[player].status &= ~SF_CONC;
1824 |                         break;
1825 | 		
1826 | 		case SET_DIAS:
1827 | 			if (dipent.flags & F_NODIAS) {
1828 | 				dipent.flags ^= F_NODIAS;
1829 | 				fprintf(rfp, "Draws must now include all survivors. All draw%s",
1830 | 					" flags cleared.\n");
1831 | 				pprintf(cfp, "%s%s as %s in '%s' set the DIAS flag.\n",
1832 | 					NowString(),
1833 | 					xaddr, powers[dipent.players[player].power], dipent.name);
1834 | 				/* WAS mfprintf  1/95 BLR */
1835 | 				fprintf(bfp, "%s as %s in '%s' set the DIAS flag.\nDraws must now %s %s",
1836 | 					xaddr, PRINT_POWER, dipent.name,
1837 | 					"include all survivors.\nReminder: all draw flags",
1838 | 					"are cleared when the DIAS flag changes.\n");
1839 | 				fprintf(mbfp, "%s as %s in '%s' set the DIAS flag.\nDraws must now %s %s",
1840 | 					raddr, PRINT_POWER, dipent.name,
1841 | 					"include all survivors.\nReminder: all draw flags",
1842 | 					"are cleared when the DIAS flag changes.\n");
1843 | 				broadcast = 1;
1844 | 				for (i = 0; i < dipent.n; i++)
1845 | 					dipent.players[i].status &= ~SF_DRAW;
1846 | 			} else {
1847 | 				fprintf(rfp, "Game '%s' is already DIAS.\n", dipent.name);
1848 | 			}
1849 | 			break;
1850 | 		case SET_NODIAS:
1851 | 			if (dipent.flags & F_NODIAS) {
1852 | 				fprintf(rfp, "Game '%s' is already no-DIAS.\n", dipent.name);
1853 | 			} else {
1854 | 				dipent.flags ^= F_NODIAS;
1855 | 				fprintf(rfp, "Draws need not now include all survivors.\n%s",
1856 | 					"All draw flags cleared.\n");
1857 | 				pprintf(cfp, "%s%s as %s in '%s' cleared the DIAS flag.\n",
1858 | 					NowString(),
1859 | 					xaddr, powers[dipent.players[player].power], dipent.name);
1860 | 				/* WAS mfprintf  1/95 BLR */
1861 | 				fprintf(bfp, "%s as %s in '%s' cleared the DIAS flag.\nDraws need %s %s",
1862 | 					xaddr, PRINT_POWER, dipent.name,
1863 | 					"not now include all survivors.\nReminder: all draw",
1864 | 					"flags are cleared when the DIAS flag changes.\n");
1865 | 				fprintf(mbfp, "%s as %s in '%s' cleared the DIAS flag.\nDraws need %s %s",
1866 | 					raddr, PRINT_POWER, dipent.name,
1867 | 					"not now include all survivors.\nReminder: all draw",
1868 | 					"flags are cleared when the DIAS flag changes.\n");
1869 | 				broadcast = 1;
1870 | 				for (i = 0; i < dipent.n; i++)
1871 | 					dipent.players[i].status &= ~SF_DRAW;
1872 | 			}
1873 | 			break;
1874 | 
1875 | 		case SET_CONCESSIONS:
1876 | 			if(dipent.flags & F_NODIAS)
1877 | 			{
1878 | 				fprintf(rfp,"NODIAS game already allow concessions!\n");
1879 | 				break;
1880 | 			}
1881 | 			if(dipent.xflags & XF_NOCONCESSIONS)
1882 | 			{
1883 | 				dipent.xflags ^= XF_NOCONCESSIONS;
1884 | 				fprintf(rfp,"Concessions are now permitted in %s.\n",dipent.name);
1885 | 				pprintf(cfp,"%s%s as %s in '%s' set the concessions flag.\nPowers may concede the game to the largest power on the board.\n",
1886 | 					NowString(),xaddr,
1887 | 					powers[dipent.players[player].power],dipent.name);
1888 | 				fprintf(bfp,"%s as %s in '%s' set the concessions flag.\nPowers may now concede to the largest power on the board.\n",
1889 | 					xaddr,PRINT_POWER,dipent.name);
1890 | 				fprintf(mbfp,"%s as %s in '%s' set the concession flag.\nPowers may now concede to the largest power on the board.\n",
1891 | 					xaddr,PRINT_POWER,dipent.name);
1892 |                                 broadcast = 1;
1893 | 			}
1894 | 			else
1895 | 			{
1896 | 				fprintf(rfp,"Game %s already allows concessions.\n",dipent.name);
1897 | 			}
1898 | 			break;
1899 | 
1900 | 		case SET_NOCONCESSIONS:
1901 | 			if(dipent.xflags & XF_NOCONCESSIONS)
1902 | 			{
1903 | 				fprintf(rfp,"Game %s is already set to disallow concessions!\n", dipent.name);
1904 | 			} else {
1905 | 				dipent.xflags ^= XF_NOCONCESSIONS;
1906 | 				fprintf(rfp,"Concessions are now disallowed.\n");
1907 | 				pprintf(cfp,"%s%s as %s in '%s' disallowed concessions.\n",
1908 | 					NowString(),xaddr,powers[dipent.players[player].power],dipent.name);
1909 | 				fprintf(bfp,"%s as %s in '%s' disallowed concessions.\n",
1910 | 					xaddr,PRINT_POWER,dipent.name);
1911 | 				fprintf(mbfp,"%s as %s in '%s' disallowed concessions.\n",
1912 | 				xaddr,PRINT_POWER,dipent.name);
1913 | 				broadcast = 1;
1914 | 			}
1915 | 			break;
1916 | 
1917 | 
1918 | 		case SET_NOREVEAL:
1919 | 			if (dipent.flags & F_NOREVEAL) {
1920 | 				fprintf(rfp, "Game '%s' is already set no reveal.\n", dipent.name);
1921 | 			} else {
1922 | 				dipent.flags |= F_NOREVEAL;
1923 | 				fprintf(rfp, "Game '%s' will not reveal players on termination.\n",
1924 | 					dipent.name);
1925 | 				pprintf(cfp, "%s%s as %s in '%s' set the no reveal flag.\n",
1926 | 					NowString(),
1927 | 					xaddr, powers[dipent.players[player].power], dipent.name);
1928 | 				/* WAS mfprintf  1/95 BLR */
1929 | 				fprintf(bfp, "%s as %s in '%s' set the no reveal flag.\n",
1930 | 					xaddr, PRINT_POWER, dipent.name);
1931 | 				fprintf(mbfp, "%s as %s in '%s' set the no reveal flag.\n",
1932 | 					raddr, PRINT_POWER, dipent.name);
1933 | 				broadcast = 1;
1934 | 			}
1935 | 			break;
1936 | 
1937 | 		case SET_REVEAL:
1938 | 			if (dipent.flags & F_NOREVEAL) {
1939 | 				dipent.flags ^= F_NOREVEAL;
1940 | 				fprintf(rfp, "Game '%s' is no longer no reveal.\n", dipent.name);
1941 | 				pprintf(cfp, "%s%s as %s in '%s' cleared the no reveal flag.\n",
1942 | 					NowString(),
1943 | 					xaddr, powers[dipent.players[player].power], dipent.name);
1944 | 				/* WAS mfprintf  1/95 BLR */
1945 | 				fprintf(bfp, "%s as %s in '%s' cleared the no reveal flag.\n",
1946 | 					xaddr, PRINT_POWER, dipent.name);
1947 | 				fprintf(mbfp, "%s as %s in '%s' cleared the no reveal flag.\n",
1948 | 					raddr, PRINT_POWER, dipent.name);
1949 | 				broadcast = 1;
1950 | 			} else {
1951 | 				fprintf(rfp, "Game '%s' is already set to reveal players.\n",
1952 | 					dipent.name);
1953 | 			}
1954 | 			break;
1955 | 
1956 | 		case SET_VARIANT:
1957 | 			s = lookforv(s, variants, NVARIANT + NVAROPTS,&i,1);
1958 | 			if (!i) {
1959 | 				fprintf(rfp, "Invalid variant: %s", s);
1960 | 				fputs("Valid variants are:\n", rfp);
1961 | 				for (i = 1; i < NVARIANT; i++)
1962 | 					fprintf(rfp, "   %s\n", variants[i]);
1963 | 				fputs("Options on these variants are:\n", rfp);
1964 | 				while (i < NVARIANT + NVAROPTS)
1965 | 					fprintf(rfp, "   %s\n", variants[i++]);
1966 | 			} else if (dipent.seq[0] != 'x') {
1967 | 				fprintf(rfp,
1968 | 					"The variant cannot be changed after the game has started.\n");
1969 | 			} else {
1970 | 				if (i >= NVARIANT)
1971 | 					dipent.flags |= vvalue[i];
1972 | 				else
1973 | 					dipent.variant = vvalue[i];
1974 | 				SETNP(dipent.variant);
1975 | 				dipent.has_natives = GetNativeIndex();
1976 | 				if (dipent.flags & F_GUNBOAT &&
1977 | 				dipent.players[player].power != MASTER) {
1978 | 					xaddr = someone;
1979 | 				}
1980 | 				broad_params = 1;
1981 | 				dipent.no_of_players = dipent.np; /* reset no of players */
1982 | 				CheckForGameStart(); /*see if we have quorum */
1983 | 			}
1984 | 			break;
1985 | 
1986 |                case SET_NOTVARIANT:
1987 |                         s = lookforv(s, variants, NVARIANT + NVAROPTS,&i,1);
1988 |                         if (!i) {
1989 |                                 fprintf(rfp, "Invalid variant: %s", s);
1990 |                                 fputs("Valid variants flags are:\n", rfp);
1991 |                                 while (i < NVARIANT + NVAROPTS)
1992 |                                         fprintf(rfp, "   %s\n", variants[i++]);
1993 |                         } else if (dipent.seq[0] != 'x') {
1994 |                                 fprintf(rfp,
1995 |                                         "The variant setting cannot be changed after the game has started.\n");
1996 |                         } else {
1997 |                                 if (i >= NVARIANT) {
1998 |                                         dipent.flags &= ~vvalue[i];
1999 |                                         if (dipent.flags & F_GUNBOAT &&
2000 |                                      dipent.players[player].power != MASTER) {
2001 |                                         xaddr = someone;
2002 |                                     }
2003 |                                     broad_para