]> skyeroc.xyz Git - dgamelaunch/commitdiff
Change allow_new_nicks to accept either "yes" or "no", not a number.
authorPasi Kallinen <paxed@alt.org>
Sun, 13 Jan 2008 10:38:45 +0000 (10:38 +0000)
committerPasi Kallinen <paxed@alt.org>
Sun, 13 Jan 2008 10:38:45 +0000 (10:38 +0000)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@412 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

config.l
config.y
examples/dgamelaunch.conf

index d826480b4b350bb88451f1b1ab44939705aed8d4..82ed757ab7be2e0c97be1d93214cbea8059ac90c 100644 (file)
--- a/config.l
+++ b/config.l
@@ -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; }
index e75e734950ef2b66072256fe014b27f3c7642208..1a356618e66b22b792ee9862fba3d3d9e1b04d5b 100644 (file)
--- a/config.y
+++ b/config.y
@@ -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;
index cea5787c487bc6315f664aa86217092b9472f546..dd2c09265077e55612b05be36fd432294f659182 100644 (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