2 Copyright (c) 1993 Richard V. Nash.
3 Copyright (c) 2000 Dan Papasian
4 Copyright (C) Andrew Tridgell 2002
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 static int set_boolean_flag(int p, char *val, unsigned long flag)
29 v = BoolCheckPFlag(p, flag);
32 if (sscanf(val, "%d", &v) != 1) {
34 if (!strcmp(val, "off") || !strcmp(val, "false"))
36 else if (!strcmp(val, "on") || !strcmp(val, "true"))
43 static int set_availinfo(int p, char *var, char *val)
45 int v = set_boolean_flag(p, val, PFLAG_AVAIL);
49 pprintf(p, "availinfo set to %d.\n", BoolCheckPFlag(p, PFLAG_AVAIL));
52 pprintf(p, "You will receive info on who is available to play.\n");
54 pprintf(p, "You are no longer receiving info on who is available to play.\n");
58 static int set_availmax(int p, char *var, char *val)
60 struct player *pp = &player_globals.parray[p];
65 if (sscanf(val, "%d", &v) != 1)
67 if ((v < 0) || (v > 9999))
70 if (v < pp->availmin) {
71 pprintf(p, "You can't set availmax to less than availmin.\n");
75 if ((pp->availmax = v)) {
76 pprintf(p, "You will be notified of availability with blitz ratings %d - %d.\n",pp->availmin,v);
78 pprintf(p, "You will be notified of all available players.\n");
82 static int set_availmin(int p, char *var, char *val)
84 struct player *pp = &player_globals.parray[p];
89 if (sscanf(val, "%d", &v) != 1)
91 if ((v < 0) || (v > 9999))
94 if (v > pp->availmax) {
95 pprintf(p, "You can't set availmin to more than availmax.\n");
100 pprintf(p, "You will be notified of availability with blitz ratings %d - %d.\n",v,pp->availmax);
104 static int set_open(int p, char *var, char *val)
106 struct player *pp = &player_globals.parray[p];
107 int v = set_boolean_flag(p, val, PFLAG_OPEN);
112 pprintf(p, "You are now open to receive match requests.\n");
115 decline_withdraw_offers(p, -1, PEND_MATCH,DO_DECLINE | DO_WITHDRAW);
116 pprintf(p, "You are no longer receiving match requests.\n");
118 announce_notavail (p);
123 static int set_tourney(int p, char *var, char *val)
125 struct player *pp = &player_globals.parray[p];
126 int v = set_boolean_flag(p, val, PFLAG_TOURNEY);
131 decline_withdraw_offers(p, -1, PEND_MATCH,DO_DECLINE | DO_WITHDRAW);
132 pprintf(p, "Your tournament variable is now set.\n");
133 announce_notavail (p);
135 pprintf(p, "Your tournament variable is no longer set.\n");
142 static int set_sopen(int p, char *var, char *val)
144 int v = set_boolean_flag(p, val, PFLAG_SIMOPEN);
148 pprintf(p, "sopen set to %d.\n", v);
151 pprintf(p, "You are now open to receive simul requests.\n");
153 pprintf(p, "You are no longer receiving simul requests.\n");
154 decline_withdraw_offers(p, -1, PEND_SIMUL,DO_DECLINE);
158 static int set_ropen(int p, char *var, char *val)
160 if (set_boolean_flag(p, val, PFLAG_ROPEN) < 0)
162 pprintf(p, "ropen set to %d.\n", BoolCheckPFlag(p, PFLAG_ROPEN));
166 static int set_rated(int p, char *var, char *val)
168 if (!CheckPFlag(p, PFLAG_REG)) {
169 pprintf(p, "You cannot change your rated status.\n");
172 if (set_boolean_flag(p, val, PFLAG_RATED) < 0)
174 pprintf(p, "rated set to %d.\n", BoolCheckPFlag(p, PFLAG_RATED));
178 static int set_shout(int p, char *var, char *val)
180 if (set_boolean_flag(p, val, PFLAG_SHOUT) < 0)
182 if (CheckPFlag(p, PFLAG_SHOUT))
183 pprintf(p, "You will now hear shouts.\n");
185 pprintf(p, "You will not hear shouts.\n");
189 static int set_ads(int p, char *var, char *val)
191 if (set_boolean_flag(p, val, PFLAG_ADS) < 0)
193 if (CheckPFlag(p, PFLAG_ADS))
194 pprintf(p, "You will now hear ads.\n");
196 pprintf(p, "You will not hear ads.\n");
200 static int set_cshout(int p, char *var, char *val)
202 if (set_boolean_flag(p, val, PFLAG_CSHOUT) < 0)
204 if (CheckPFlag(p, PFLAG_CSHOUT))
205 pprintf(p, "You will now hear cshouts.\n");
207 pprintf(p, "You will not hear cshouts.\n");
211 static int set_kibitz(int p, char *var, char *val)
213 if (set_boolean_flag(p, val, PFLAG_KIBITZ) < 0)
215 if (CheckPFlag(p, PFLAG_KIBITZ))
216 pprintf(p, "You will now hear kibitzes.\n");
218 pprintf(p, "You will not hear kibitzes.\n");
221 static int set_kiblevel(int p, char *var, char *val)
223 struct player *pp = &player_globals.parray[p];
228 if (sscanf(val, "%d", &v) != 1)
230 if ((v < 0) || (v > 9999))
233 pprintf(p, "Kibitz level now set to: %d.\n", v);
237 static int set_tell(int p, char *var, char *val)
239 if (set_boolean_flag(p, val, PFLAG_TELL) < 0)
241 if (CheckPFlag(p, PFLAG_TELL))
242 pprintf(p, "You will now hear tells from unregistered users.\n");
244 pprintf(p, "You will not hear tells from unregistered users.\n");
248 static int set_notifiedby(int p, char *var, char *val)
250 if (set_boolean_flag(p, val, PFLAG_NOTIFYBY) < 0)
252 if (CheckPFlag(p, PFLAG_NOTIFYBY))
253 pprintf(p, "You will now hear if people notify you, but you don't notify them.\n");
255 pprintf(p, "You will not hear if people notify you, but you don't notify them.\n");
259 static int set_pinform(int p, char *var, char *val)
261 if (set_boolean_flag(p, val, PFLAG_PIN) < 0)
263 if (CheckPFlag(p, PFLAG_PIN))
264 pprintf(p, "You will now hear logins/logouts.\n");
266 pprintf(p, "You will not hear logins/logouts.\n");
270 static int set_ginform(int p, char *var, char *val)
272 if (set_boolean_flag(p, val, PFLAG_GIN) < 0)
274 if (CheckPFlag(p, PFLAG_GIN))
275 pprintf(p, "You will now hear game results.\n");
277 pprintf(p, "You will not hear game results.\n");
281 static int set_private(int p, char *var, char *val)
283 if (set_boolean_flag(p, val, PFLAG_PRIVATE) < 0)
285 if (CheckPFlag(p, PFLAG_PRIVATE))
286 pprintf(p, "Your games will be private.\n");
288 pprintf(p, "Your games may not be private.\n");
292 static int set_jprivate(int p, char *var, char *val)
294 if (!CheckPFlag(p, PFLAG_REG)) {
295 pprintf(p, "Unregistered players may not keep a journal.\n");
299 if (set_boolean_flag(p, val, PFLAG_JPRIVATE) < 0)
301 if (CheckPFlag(p, PFLAG_JPRIVATE))
302 pprintf(p, "Your journal will be private.\n");
304 pprintf(p, "Your journal will not be private.\n");
308 static int set_automail(int p, char *var, char *val)
310 if (set_boolean_flag(p, val, PFLAG_AUTOMAIL) < 0)
312 if (CheckPFlag(p, PFLAG_AUTOMAIL))
313 pprintf(p, "Your games will be mailed to you.\n");
315 pprintf(p, "Your games will not be mailed to you.\n");
319 static int set_mailmess(int p, char *var, char *val)
321 if (!CheckPFlag(p, PFLAG_REG)) {
322 pprintf(p, "Unregistered players may not receive messages.\n");
325 if (set_boolean_flag(p, val, PFLAG_MAILMESS) < 0)
327 if (CheckPFlag(p, PFLAG_MAILMESS))
328 pprintf(p, "Your messages will be mailed to you.\n");
330 pprintf(p, "Your messages will not be mailed to you.\n");
334 static int set_pgn(int p, char *var, char *val)
336 if (set_boolean_flag(p, val, PFLAG_PGN) < 0)
338 if (CheckPFlag(p, PFLAG_PGN))
339 pprintf(p, "Games will now be mailed to you in PGN.\n");
341 pprintf(p, "Games will now be mailed to you in FICS format.\n");
345 static int set_bell(int p, char *var, char *val)
347 if (set_boolean_flag(p, val, PFLAG_BELL) < 0)
349 if (CheckPFlag(p, PFLAG_BELL))
350 pprintf(p, "Bell on.\n");
352 pprintf(p, "Bell off.\n");
356 static int set_highlight(int p, char *var, char *val)
358 struct player *pp = &player_globals.parray[p];
363 if (sscanf(val, "%d", &v) != 1)
365 if ((v < 0) || (v > 15))
368 if ((pp->highlight = v)) {
369 pprintf(p, "Highlight is now style ");
370 pprintf_highlight(p, "%d", v);
373 pprintf(p, "Highlight is off.\n");
377 static int set_style(int p, char *var, char *val)
379 struct player *pp = &player_globals.parray[p];
384 if (sscanf(val, "%d", &v) != 1)
386 if ((v < 1) || (v > MAX_STYLES))
389 pprintf(p, "Style %d set.\n", v);
393 static int set_flip(int p, char *var, char *val)
395 if (set_boolean_flag(p, val, PFLAG_FLIP) < 0)
397 if (CheckPFlag(p, PFLAG_FLIP))
398 pprintf(p, "Flip on.\n");
400 pprintf(p, "Flip off.\n");
403 /* Was pointless as this is what notes are for
404 static int set_uscf(int p, char *var, char *val)
410 if (sscanf(val, "%d", &v) != 1)
412 if ((v < 0) || (v > 3000))
415 pprintf(p, "USCF Rating set to %d.\n", v);
419 static int set_time(int p, char *var, char *val)
421 struct player *pp = &player_globals.parray[p];
426 if (sscanf(val, "%d", &v) != 1)
428 if ((v < 0) || (v > 240))
431 pprintf(p, "Default time set to %d.\n", v);
435 static int set_inc(int p, char *var, char *val)
437 struct player *pp = &player_globals.parray[p];
442 if (sscanf(val, "%d", &v) != 1)
444 if ((v < 0) || (v > 300))
447 pprintf(p, "Default increment set to %d.\n", v);
451 static int set_height(int p, char *var, char *val)
453 struct player *pp = &player_globals.parray[p];
458 if (sscanf(val, "%d", &v) != 1)
460 if ((v < 5) || (v > 240))
463 pprintf(p, "Height set to %d.\n", v);
467 static int set_width(int p, char *var, char *val)
469 struct player *pp = &player_globals.parray[p];
474 if (sscanf(val, "%d", &v) != 1)
476 if ((v < 32) || (v > 10000))
479 pprintf(p, "Width set to %d.\n", v);
483 const char *Language(int i)
485 static const char *Lang[NUM_LANGS] = {"English", "Spanish", "French", "Danish"};
489 static int set_language (int p, char *var, char *val)
491 struct player *pp = &player_globals.parray[p];
492 int i, len, gotIt = -1;
497 for (i=0; i < NUM_LANGS; i++) {
498 if (strncasecmp(val, Language(i), len))
506 pp->language = gotIt;
507 pprintf(p, "Language set to %s.\n", Language(gotIt));
511 static int set_promote(int p, char *var, char *val)
513 struct player *pp = &player_globals.parray[p];
520 pprintf(p, "Promotion piece set to QUEEN.\n");
524 pprintf(p, "Promotion piece set to ROOK.\n");
527 pp->promote = BISHOP;
528 pprintf(p, "Promotion piece set to BISHOP.\n");
532 pp->promote = KNIGHT;
533 pprintf(p, "Promotion piece set to KNIGHT.\n");
542 static int set_interface(int p, char *var, char *val)
544 struct player *pp = &player_globals.parray[p];
549 if (!printablestring(val))
552 asprintf(&pp->interface, "%s", val);
556 static int set_prompt(int p, char *var, char *val)
558 struct player *pp = &player_globals.parray[p];
562 pp->prompt = config_get("DEFAULT_PROMPT");
565 if (!printablestring(val))
568 asprintf(&prompt, "%s", val);
573 static int RePartner (int p, int new)
575 struct player *pp = &player_globals.parray[p];
582 if (player_globals.parray[pOld].partner == p) {
584 pprintf_prompt (pOld, "Your partner has just chosen a new partner.\n");
586 pprintf (pOld, "Your partner has unset his/her partner variable.\n");
587 pprintf_prompt (pOld, "You are no longer %s's partner.\n",pp->name);
589 decline_withdraw_offers (pOld, -1, PEND_BUGHOUSE,DO_DECLINE | DO_WITHDRAW);
590 player_globals.parray[pOld].partner = -1;
593 decline_withdraw_offers(p, -1, PEND_BUGHOUSE,DO_DECLINE | DO_WITHDRAW);
594 decline_withdraw_offers(p, -1, PEND_PARTNER,DO_DECLINE | DO_WITHDRAW);
599 int com_partner(int p, param_list param)
601 struct player *pp = &player_globals.parray[p];
603 struct pending* pend;
605 if (param[0].type == TYPE_NULL) {
606 if (pp->partner >= 0)
607 pprintf (p, "You no longer have a bughouse partner.\n");
608 else pprintf (p, "You do not have a bughouse partner.\n");
612 /* OK, we're trying to set a new partner. */
613 pNew = player_find_part_login(param[0].val.word);
614 if (pNew < 0 || player_globals.parray[pNew].status == PLAYER_PASSWORD
615 || player_globals.parray[pNew].status == PLAYER_LOGIN) {
616 pprintf(p, "No user named \"%s\" is logged in.\n", param[0].val.word);
620 pprintf(p, "You can't be your own bughouse partner.\n");
623 /* Now we know a legit partner has been chosen. Is an offer pending? */
624 if ((pend = find_pend(pNew, p, PEND_PARTNER)) != NULL) {
625 pprintf (p, "You agree to be %s's partner.\n", player_globals.parray[pNew].name);
627 pprintf_prompt (pNew, "%s agrees to be your partner.\n", pp->name);
629 delete_pending (pend);
631 /* Make the switch. */
636 /* This is just an offer. Make sure a new partner is needed. */
637 if (player_globals.parray[pNew].partner >= 0) {
638 pprintf(p, "%s already has a partner.\n", player_globals.parray[pNew].name);
642 pprintf_highlight(pNew, "%s", pp->name);
644 pprintf(pNew, " offers to be your bughouse partner; ");
645 pprintf_prompt(pNew, "type \"partner %s\" to accept.\n", pp->name);
646 pprintf(p, "Making a partnership offer to %s.\n", player_globals.parray[pNew].name);
647 add_request(p, pNew, PEND_PARTNER);
652 static int set_busy(int p, char *var, char *val)
654 struct player *pp = &player_globals.parray[p];
656 if (pp->busy != NULL) {
660 pprintf(p, "Your \"busy\" string was cleared.\n");
663 if ((val) && (!printablestring(val)))
665 pp->busy = strdup(val);
666 pprintf(p, "Your \"busy\" string was set to \" %s\"\n", pp->busy);
670 /* this is really ugly */
671 static int set_plan(int p, char *var, char *val)
673 struct player *pp = &player_globals.parray[p];
677 if (val && !printablestring(val))
679 which = atoi(var); /* Must be an integer, no test needed */
681 if (which > MAX_PLAN)
684 if (which > pp->num_plan)
685 which = pp->num_plan + 1;
687 if (which == 0) { /* shove from top */
688 if (pp->num_plan >= MAX_PLAN) { /* free the bottom string */
689 if (pp->planLines[pp->num_plan - 1] != NULL)
690 free(pp->planLines[pp->num_plan - 1]);
693 for (i = (pp->num_plan >= MAX_PLAN) ? MAX_PLAN - 1 : pp->num_plan; i > 0; i--)
694 pp->planLines[i] = pp->planLines[i - 1];
696 if (pp->num_plan < MAX_PLAN)
698 /* kludged the next line: "" was NULL, but crashed on pprintf. fb 2.24.96 */
699 pp->planLines[0] = ((val == NULL) ? "": strdup(val));
700 pprintf(p, "\nPlan variable %d changed to '%s'.\n", which+1, pp->planLines[which]);
701 pprintf(p, "All other variables moved down.\n");
704 if (which > pp->num_plan) { /* new line at bottom */
705 if (pp->num_plan >= MAX_PLAN) { /* shove the old lines up */
706 if (pp->planLines[0] != NULL)
707 free(pp->planLines[0]);
708 for (i = 0; i < pp->num_plan; i++)
709 pp->planLines[i] = pp->planLines[i + 1];
713 /* kludged the next line: "" was NULL, but crashed on pprintf. fb2.24.96 */
714 pp->planLines[which - 1] = ((val == NULL) ? "": strdup(val));
715 pprintf(p, "\nPlan variable %d changed to '%s'.\n", which, pp->planLines[which-1]);
719 if (pp->planLines[which] != NULL) {
720 free(pp->planLines[which]);
723 pp->planLines[which] = strdup(val);
724 pprintf(p, "\nPlan variable %d changed to '%s'.\n", which+1, pp->planLines[which]);
726 pp->planLines[which] = NULL;
727 if (which == pp->num_plan - 1) { /* clear nulls from bottom */
728 while ((pp->num_plan > 0) && (pp->planLines[pp->num_plan - 1] == NULL)) {
730 pprintf(p, "\nPlan variable %d cleared.\n", which+1);
732 } else if (which == 0) { /* clear nulls from top */
733 while ((which < pp->num_plan) && (pp->planLines[which] == NULL)) {
736 if (which != pp->num_plan) {
737 for (i = which; i < pp->num_plan; i++)
738 pp->planLines[i - which] = pp->planLines[i];
740 pp->num_plan -= which;
746 static int set_formula(int p, char *var, char *val)
749 struct player *me = &player_globals.parray[p];
752 pprintf(p, "Sorry -- not available because of a bug\n");
756 which = var[1] - '1';
765 if (!SetValidFormula(p, which, val))
768 if (which < MAX_FORMULA) {
770 while (me->num_formula < which) {
771 me->formulaLines[me->num_formula] = NULL;
774 if (me->num_formula <= which)
775 me->num_formula = which + 1;
776 pprintf(p, "Formula variable f%d set to %s.\n",
777 which + 1, me->formulaLines[which]);
780 pprintf(p, "Formula variable f%d unset.\n", which + 1);
781 if (which + 1 >= me->num_formula) {
782 while (which >= 0 && me->formulaLines[which] == NULL)
784 me->num_formula = which + 1;
787 if (me->formula != NULL)
788 pprintf(p, "Formula set to %s.\n", me->formula);
790 pprintf(p, "Formula unset.\n");
796 var_list variables[] = {
798 {"availinfo", set_availinfo},
799 {"availmax", set_availmax},
800 {"availmin", set_availmin},
802 {"tourney", set_tourney},
803 {"simopen", set_sopen},
804 {"rated", set_rated},
805 {"ropen", set_ropen},
806 {"cshout", set_cshout},
807 {"shout", set_shout},
808 {"kibitz", set_kibitz},
809 {"kiblevel", set_kiblevel},
811 {"notifiedby", set_notifiedby},
812 {"pinform", set_pinform},
813 {"i_login", set_pinform},
814 {"ginform", set_ginform},
815 {"i_game", set_ginform},
816 {"automail", set_automail},
817 {"mailmess", set_mailmess},
820 {"private", set_private},
821 {"jprivate", set_jprivate},
822 {"highlight", set_highlight},
823 {"style", set_style},
825 {"prompt", set_prompt},
826 {"promote", set_promote},
829 {"height", set_height},
830 {"width", set_width},
831 {"language", set_language},
853 {"formula", set_formula},
854 {"interface", set_interface},
858 static int set_find(char *var)
862 int len = strlen(var);
864 while (variables[i].name) {
865 if (!strncmp(variables[i].name, var, len)) {
866 if (len == strlen(variables[i].name)) {
868 } else if (gotIt >= 0) {
869 return -VAR_AMBIGUOUS;
881 int var_set(int p, char *var, char *val, int *wh)
887 if ((which = set_find(var)) < 0) {
891 return variables[which].var_func(p, (isdigit(*variables[which].name) ? var : variables[which].name), val);
894 int com_variables(int p, param_list param)
899 if (param[0].type == TYPE_WORD) {
900 if (!FindPlayer(p, param[0].val.word, &p1, &connected))
907 pprintf(p, "Variable settings of %s:\n\n", player_globals.parray[p1].name);
909 pprintf(p, "time=%-3d private=%d shout=%d pin=%d style=%-3d\n",
910 player_globals.parray[p1].d_time, BoolCheckPFlag(p1, PFLAG_PRIVATE),
911 BoolCheckPFlag(p1, PFLAG_SHOUT), BoolCheckPFlag(p1, PFLAG_PIN),
912 player_globals.parray[p1].style + 1);
913 pprintf(p, "inc=%-3d jprivate=%d cshout=%d notifiedby=%d flip=%d\n",
914 player_globals.parray[p1].d_inc, BoolCheckPFlag(p1, PFLAG_JPRIVATE),
915 BoolCheckPFlag(p1, PFLAG_CSHOUT), BoolCheckPFlag(p1, PFLAG_NOTIFYBY),
916 BoolCheckPFlag(p1, PFLAG_FLIP));
917 pprintf(p, " kibitz=%d availinfo=%d highlight=%d\n",
918 BoolCheckPFlag(p1, PFLAG_KIBITZ), BoolCheckPFlag(p1, PFLAG_AVAIL),
919 player_globals.parray[p1].highlight);
920 pprintf(p, "rated=%d automail=%d kiblevel=%-4d availmin=%-4d bell=%d\n",
921 BoolCheckPFlag(p1, PFLAG_RATED), BoolCheckPFlag(p1, PFLAG_AUTOMAIL),
922 player_globals.parray[p1].kiblevel, player_globals.parray[p1].availmin,
923 BoolCheckPFlag(p1, PFLAG_BELL));
924 pprintf(p, "ropen=%d pgn=%d tell=%d availmax=%-4d width=%-3d\n",
925 BoolCheckPFlag(p1, PFLAG_ROPEN), BoolCheckPFlag(p1, PFLAG_PGN),
926 BoolCheckPFlag(p1, PFLAG_TELL), player_globals.parray[p1].availmax,
927 player_globals.parray[p1].d_width);
928 pprintf(p, "open=%d mailmess=%d gin=%d height=%-3d\n",
929 BoolCheckPFlag(p1, PFLAG_OPEN), BoolCheckPFlag(p1, PFLAG_MAILMESS),
930 BoolCheckPFlag(p1, PFLAG_GIN), player_globals.parray[p1].d_height);
931 pprintf(p, "simopen=%d tourney=%d Lang=%s",
932 BoolCheckPFlag(p1, PFLAG_SIMOPEN), BoolCheckPFlag(p1, PFLAG_TOURNEY),
933 Language(player_globals.parray[p1].language));
935 if (player_globals.parray[p1].prompt)
936 pprintf(p, " Prompt: %s\n", player_globals.parray[p1].prompt);
940 if (player_globals.parray[p1].partner >= 0)
941 pprintf(p, "\nBughouse partner: %s\n", player_globals.parray[player_globals.parray[p1].partner].name);
943 if (player_globals.parray[p1].num_formula) {
945 for (i = 0; i < player_globals.parray[p1].num_formula; i++) {
946 if (player_globals.parray[p1].formulaLines[i] != NULL)
947 pprintf(p, " f%d: %s\n", i + 1, player_globals.parray[p1].formulaLines[i]);
949 pprintf(p, " f%d:\n", i + 1);
952 if (player_globals.parray[p1].formula != NULL)
953 pprintf(p, "\nFormula: %s\n", player_globals.parray[p1].formula);
962 /* tournset (cause settourney is BAD for set)
963 * used by Tournament Director programs to set/unset the
964 * tourney variable of another registered player.
965 * fics usage: tournset playername int (int can be 0 or 1)
967 int com_tournset(int p, param_list param)
969 struct player *pp = &player_globals.parray[p];
972 if (!in_list(p, L_TD, pp->name)) {
973 pprintf(p, "Only TD programs are allowed to use this command.\n");
976 if (((p1 = player_find_bylogin(param[0].val.word)) < 0)
977 || (!CheckPFlag(p1, PFLAG_REG))) {
980 v = BoolCheckPFlag(p1, PFLAG_TOURNEY);
981 if (param[1].val.integer == 0) { /* set it to 0 */
983 SetPFlag(p1, PFLAG_TOURNEY, 0);
984 pprintf_prompt(p1, "\n%s has set your tourney variable to OFF.\n",
987 } else { /* set it to 1 */
989 SetPFlag(p1, PFLAG_TOURNEY, 1);
990 pprintf_prompt(p1, "\n%s has set your tourney variable to ON.\n",