]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/config.cpp
updated the Change log w/ new additions
[irc/gameservirc.git] / gameserv / config.cpp
index 4c72ecaedcca56d7296d03c4c084de16c618549a..7e86f143e5b426957649437b4d194ddf3544cd37 100644 (file)
@@ -35,12 +35,14 @@ int idlecheckperiod;                // Period for checking every player's idle time
 int level1expire;              // Days for level 1 players to expire
 int defaultexpire;             // Days for other levels to expire
 int maxitems;                   // Maximum amount of items a player can carry
+unsigned int maxnicklen;         // Maximum length a nickname can be
 long refreshperiod;            // Period for refreshing players
 long rolloverperiod;            // Period for rolling over forest fights
 long configflags;              // Holds the binary representation of some boolean values
 long maxforestfights;           // Maximum amount of forest fights to roll over
 long numrolloverfights;         // Number of forest fights to roll over
 
+
 // Remote server stuff. This is used for the outgoing connection gameserv needs to make
 // to a real ircd.
 char *remoteserver;            // Server to connect to
@@ -115,7 +117,7 @@ int load_config_file(char *config)
 {
   char *buf, *directive, *value;
   
-#define numdirectives 40
+#define numdirectives 41
   
   unload_config_file();
   
@@ -182,6 +184,7 @@ int load_config_file(char *config)
   directives[37].desc = "ROLLOVERPERIOD - Period (in seconds) to rollover forest fights";
   directives[38].desc = "NUMROLLOVERFIGHTS - Number of forest fights to roll over";
   directives[39].desc = "FAIRFIGHTS - True/False as to whether or not to check for fair fights";
+  directives[40].desc = "MAXNICKLEN - Maximum length a nickname can be";
   
   configflags = 0;
   
@@ -278,7 +281,7 @@ int load_config_file(char *config)
                }
          else if (stricmp(directive, "REMOTEPASS") == 0)
                {
-                 value = strtok(NULL, "");
+                 value = strtok(NULL, " ");
                  remotepass = new char[strlen(value) + 1];
                  strcpy(remotepass, value);
                  directives[8].done = true;
@@ -292,7 +295,7 @@ int load_config_file(char *config)
                }
          else if (stricmp(directive, "SAVEDNOTICE") == 0)
                {
-                 value = strtok(NULL, "");
+                 value = strtok(NULL, " ");
                  if (stricmp(value, "TRUE") == 0)
                        setSavedNotice();
                  directives[10].done = true;
@@ -400,14 +403,14 @@ int load_config_file(char *config)
                }
          else if (stricmp(directive, "NSNAME") == 0)
                {
-                 value = strtok(NULL, "");
+                 value = strtok(NULL, " ");
                  nsname = new char[strlen(value) + 1];
                  strcpy(nsname, value);
                  directives[26].done = true;
                }
          else if (stricmp(directive, "NSPASS") == 0)
                {
-                 value = strtok(NULL, "");
+                 value = strtok(NULL, " ");
                  nspass = new char[strlen(value) + 1];
                  strcpy(nspass, value);
                  directives[27].done = true;
@@ -442,7 +445,7 @@ int load_config_file(char *config)
                }
          else if (stricmp(directive, "MAXITEMS") == 0)
                {
-                 value = strtok(NULL, "");
+                 value = strtok(NULL, " ");
                  maxitems = stringtoint(value);
                  directives[32].done = true;
                }
@@ -455,7 +458,7 @@ int load_config_file(char *config)
                }
          else if (stricmp(directive, "LOCALHOST") == 0)
                {
-                 value = strtok(NULL, "");
+                 value = strtok(NULL, " ");
                  localhost = new char[strlen(value) + 1];
                  strcpy(localhost, value);
                  directives[34].done = true;
@@ -477,13 +480,13 @@ int load_config_file(char *config)
                }
          else if (stricmp(directive, "MAXFORESTFIGHTS") == 0)
                {
-                 value = strtok(NULL, "");
+                 value = strtok(NULL, " ");
                  maxforestfights = stringtoint(value);
                  directives[36].done = true;
                }
          else if (stricmp(directive, "ROLLOVERPERIOD") == 0)
                {
-                 value = strtok(NULL, "");
+                 value = strtok(NULL, " ");
                  rolloverperiod = stringtoint(value);
                  directives[37].done = true;
                }
@@ -495,11 +498,17 @@ int load_config_file(char *config)
                }
          else if (stricmp(directive, "FAIRFIGHTS") == 0)
                {
-                 value = strtok(NULL, "");
+                 value = strtok(NULL, " ");
                  if (stricmp(value, "TRUE") == 0)
                        setFairFights();
                  directives[39].done = true;
                }
+         else if (stricmp(directive, "MAXNICKLEN") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 maxnicklen = stringtoint(value);
+                 directives[40].done = true;
+               }
          else if (stricmp(directive, "WELCOMEMSG") == 0)
                {
                  // This directive is optional