Change allow_new_nicks to accept either "yes" or "no", not a number.

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@412 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
Pasi Kallinen 2008-01-13 10:38:45 +00:00
parent eba56654bd
commit e266a3bf7d
3 changed files with 16 additions and 6 deletions

View File

@ -79,6 +79,8 @@ WHITE [\t ]*
"game_args" { return TYPE_GAME_ARGS; }
"rc_fmt" { return TYPE_RC_FMT; }
commands { return TYPE_CMDQUEUE; }
yes { yylval.i = 1; return TYPE_BOOL; }
no { yylval.i = 0; return TYPE_BOOL; }
dglstart { yylval.i = DGLTIME_DGLSTART; return TYPE_CMDQUEUENAME; }
login { yylval.i = DGLTIME_LOGIN; return TYPE_CMDQUEUENAME; }
register { yylval.i = DGLTIME_REGISTER; return TYPE_CMDQUEUENAME; }

View File

@ -45,6 +45,7 @@ static const char* lookup_token (int t);
%type <kt> KeyType
%token <i> TYPE_DGLCMD1 TYPE_DGLCMD2
%token TYPE_DEFINE_GAME
%token <i> TYPE_BOOL
%%
@ -180,6 +181,17 @@ KeyPair: TYPE_CMDQUEUE '[' TYPE_CMDQUEUENAME ']'
free($3);
}
| KeyType '=' TYPE_MALSTRING {}
| KeyType '=' TYPE_BOOL {
switch ($1) {
case TYPE_ALLOW_REGISTRATION:
globalconfig.allow_registration = $<i>3;
break;
default:
fprintf(stderr, "%s:%d: token %s does not take a boolean, bailing out\n",
config, line, lookup_token($1));
exit(1);
}
}
| KeyType '=' TYPE_NUMBER {
globalconfig.shed_uid = (uid_t)-1;
@ -210,10 +222,6 @@ KeyPair: TYPE_CMDQUEUE '[' TYPE_CMDQUEUENAME ']'
globalconfig.shed_gid = $3;
break;
case TYPE_ALLOW_REGISTRATION:
globalconfig.allow_registration = $3;
break;
case TYPE_MAX:
globalconfig.max = $3;
break;

View File

@ -11,8 +11,8 @@
# compiled with SQLite
maxusers = 64000
# Allow registration of new nicks? (0 or 1)
allow_new_nicks = 1
# Allow registration of new nicks? (yes or no)
allow_new_nicks = yes
# Max length for newly registered nicks. Must be less than 20.
# By default, NetHack only stores the first 10 chars of a name into