2 Copyright (C) Andrew Tridgell 2002
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 static int iset_bool(int p, unsigned *v, const char *var, const char *value)
27 if (strcmp(value, "1") == 0) {
29 pprintf(p, "%s set\n", var);
30 } else if (strcmp(value, "0") == 0) {
32 pprintf(p, "%s unset\n", var);
34 pprintf(p, "Bad value '%s' given for ivariable '%s'.\n", value, var);
40 support the iset command
42 int com_iset(int p, param_list param)
44 struct player *pp = &player_globals.parray[p];
45 char *var = param[0].val.word;
46 char *value = param[1].val.string;
47 struct ivariables *iv;
52 pprintf(p,"Cannot alter: Interface setting locked.\n");
56 if (strcasecmp(var,"ms") == 0) {
57 return iset_bool(p, &iv->ms, var, value);
58 } else if (strcasecmp(var,"lock") == 0) {
59 return iset_bool(p, &iv->lock, var, value);
60 } else if (strcasecmp(var,"startpos") == 0) {
61 return iset_bool(p, &iv->startpos, var, value);
63 pprintf(p,"No such ivariable \"%s\".\n", var);