]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/config.cpp
updated the Change log w/ new additions
[irc/gameservirc.git] / gameserv / config.cpp
index 7fce944b4c894675b9d424c0a5e1730d02200f9f..7e86f143e5b426957649437b4d194ddf3544cd37 100644 (file)
@@ -1,13 +1,12 @@
 #include <fstream>
+#include <iostream>
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include "extern.h"
 #include "flags.h"
 
-using std::ifstream;
-using std::cerr;
-using std::endl;
+using namespace std;
 
 int load_config_file(char *config);
 void unload_config_file();
@@ -35,15 +34,23 @@ int maxidletime;            // Max time (in seconds) a player can be idle for
 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 configflags;              // Holds the bit representation of some boolean values
+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
-char *remoteport;              // Port to connect to on remoteserver
+char *localhost;                // Hostname of the local address to bind to
+int  remoteport;               // Port to connect to on remoteserver
 char *remotepass;              // Password for the server link
 
+char *storeitemdata;            // File to store the items available in the store
 char *tavernitemdata;           // File to store the items available in the tavern
 char *itemdata;                 // File to store the items in
 char *playerdata;              // File to store player data in
@@ -53,423 +60,502 @@ char *newsdata;                   // File to store news data in
 char *pidfile;                 // Process ID file
 
 #if defined(P10)
-       char *gsnum = "[]AAA";          // GameServ Numeric
+char *gsnum = "[]AAA";         // GameServ Numeric
 #endif
 
 void unload_config_file()
 {
-    if (s_GameServ)
-       delete [] s_GameServ;
-    if (gshost)
-       delete [] gshost;
-    if (gsident)
-       delete [] gsident;
-    if (servername)
-       delete [] servername;
-    if (c_Forest)
-       delete [] c_Forest;
-    if (c_ForestTopic)
-       delete [] c_ForestTopic;
-    if (remoteserver)
-       delete [] remoteserver;
-    if (remoteport)
-       delete [] remoteport;
-    if (remotepass)
-       delete [] remotepass;
-    if (playerdata)
-       delete [] playerdata;
-    if (tavernitemdata)
-        delete [] tavernitemdata;
-    if (itemdata)
-        delete [] itemdata;
-    if (dragondata)
-       delete [] dragondata;
-    if (masterdata)
-       delete [] masterdata;
-    if (adminpass)
-       delete [] adminpass;
-    if (welcomemsg)
-       delete [] welcomemsg;
-    if (pidfile)
-       delete [] pidfile;
-    if (ignoreserverslist)
-       delete [] ignoreserverslist;
-    if (newsdata)
-       delete [] newsdata;
-    if (nsname)
-       delete [] nsname;
-    if (nspass)
-       delete [] nspass;
-
-    configflags = 0;
+  if (s_GameServ)
+    delete [] s_GameServ;
+  if (gshost)
+    delete [] gshost;
+  if (gsident)
+    delete [] gsident;
+  if (servername)
+    delete [] servername;
+  if (c_Forest)
+    delete [] c_Forest;
+  if (c_ForestTopic)
+    delete [] c_ForestTopic;
+  if (remoteserver)
+    delete [] remoteserver;
+  if (localhost)
+    delete [] localhost;
+  if (remotepass)
+    delete [] remotepass;
+  if (playerdata)
+    delete [] playerdata;
+  if (storeitemdata)
+    delete [] storeitemdata;
+  if (tavernitemdata)
+    delete [] tavernitemdata;
+  if (itemdata)
+    delete [] itemdata;
+  if (dragondata)
+    delete [] dragondata;
+  if (masterdata)
+    delete [] masterdata;
+  if (adminpass)
+    delete [] adminpass;
+  if (welcomemsg)
+    delete [] welcomemsg;
+  if (pidfile)
+    delete [] pidfile;
+  if (ignoreserverslist)
+    delete [] ignoreserverslist;
+  if (newsdata)
+    delete [] newsdata;
+  if (nsname)
+    delete [] nsname;
+  if (nspass)
+    delete [] nspass;
+  
+  configflags = 0;
 }
 
 int load_config_file(char *config)
 {
-    char *buf, *directive, *value;
-
-    #define numdirectives 32
-
-    unload_config_file();
-
-    struct DIRECTIVE {
+  char *buf, *directive, *value;
+  
+#define numdirectives 41
+  
+  unload_config_file();
+  
+  struct DIRECTIVE {
        bool done;
        char *desc;
-    };
-
-    DIRECTIVE directives[numdirectives];
-
-     directives[0].desc = "s_GameServ - GameServ Nickname";
-     directives[1].desc = "GSHOST - GameServ Hostname";
-     directives[2].desc = "GSIDENT - GameServ Ident";
-     directives[3].desc = "SERVERNAME - Pseudo Server's Name";
-     directives[4].desc = "C_FOREST - Forest Channel";
-     directives[5].desc = "C_FORESTTOPIC - Topic for the Forest Channel";
-     directives[6].desc = "REMOTESERVER - Server for gameserv to connect to (ip or hostname)";
-     directives[7].desc = "REMOTEPORT - Port on the remote server to connect to";
-     directives[8].desc = "REMOTEPASS - Password on the remote server";
-     directives[9].desc = "PLAYERDATA - File to store the player saves in";
-    directives[10].desc = "SAVEDNOTICE - True/False as to wether or not to tell the forest "\
-                               "channel that the player database has been saved";
-    directives[11].desc = "ADMINPASS - Password to identify as an admin with";
-    directives[12].desc = "WELCOMEDELAY - Delay (in seconds) to wait before welcoming new users to the network";
-    directives[13].desc = "FORESTFIGHTS - Number of forest fights players get every day";
-    directives[14].desc = "UPDATEPERIOD - Number of seconds between every player data save";
-    directives[15].desc = "PIDFILE - Filename to store the gameserv process ID in";
-    directives[16].desc = "MAXAFIGHTDISTANCE - The maximum number of levels above you "\
-                               "that you can fight player->player";
-    directives[17].desc = "MAXBFIGHTDISTANCE - The maximum number of levels below you "\
-                               "that you can fight player->player";
-    directives[18].desc = "MAXIDLETIME - The maximum amount of time (in seconds) "\
-                               "that a player can be idle before something happens";
-    directives[19].desc = "IDLECHECKPERIOD - The period (in seconds) in which the entire "\
-                               "players list will be checked for idlers. See also: "\
-                               "MAXIDLETIME";
-    directives[20].desc = "LISTENONC_FOREST - True/False as to "\
-                               "whether or not to listen for forest "\
-                               "commands on the forest channel";
-    directives[21].desc = "NEWSDATA - File to store daily news in";
-    directives[22].desc = "REFRESHPERIOD - Period (in seconds) to "\
-                               "refresh players";
-    directives[23].desc = "LEVEL1EXPIRE - Amount of days until a "\
-                       "level 1 player's account is deleted due to "\
-                       "inactivity.";
-    directives[24].desc = "DEFAULTEXPIRE - Amount of days until a "\
-                       "level 2 and above player's account is "\
-                       "deleted due to inactivity";
-    directives[25].desc = "USENICKSERV - True/False as to wether or not "\
-                       "GameServ should identify with NickServ";
-    directives[26].desc = "NSNAME - Your network's NickServ nickname";
-    directives[27].desc = "NSPASS - GameServ's NickServ Password";
-    directives[28].desc = "DRAGONDATA - File to store the current "\
-                       "dragon's stats in";
-    directives[29].desc = "MASTERDATA - File to store the level master stats in";
-    directives[30].desc = "ITEMDATA - File to store the items in";
-    directives[31].desc = "TAVERNITEMDATA - File in which to store the items that are available in the tavern";
-
-    configflags = 0;
-
-    for (int count = 0; count < numdirectives; count++)
+  };
+  
+  DIRECTIVE directives[numdirectives];
+  
+  directives[0].desc = "s_GameServ - GameServ Nickname";
+  directives[1].desc = "GSHOST - GameServ Hostname";
+  directives[2].desc = "GSIDENT - GameServ Ident";
+  directives[3].desc = "SERVERNAME - Pseudo Server's Name";
+  directives[4].desc = "C_FOREST - Forest Channel";
+  directives[5].desc = "C_FORESTTOPIC - Topic for the Forest Channel";
+  directives[6].desc = "REMOTESERVER - Server for gameserv to connect to (ip or hostname)";
+  directives[7].desc = "REMOTEPORT - Port on the remote server to connect to";
+  directives[8].desc = "REMOTEPASS - Password on the remote server";
+  directives[9].desc = "PLAYERDATA - File to store the player saves in";
+  directives[10].desc = "SAVEDNOTICE - True/False as to wether or not to tell the forest "\
+       "channel that the player database has been saved";
+  directives[11].desc = "ADMINPASS - Password to identify as an admin with";
+  directives[12].desc = "WELCOMEDELAY - Delay (in seconds) to wait before welcoming new users to the network";
+  directives[13].desc = "FORESTFIGHTS - Number of forest fights players get every day";
+  directives[14].desc = "UPDATEPERIOD - Number of seconds between every player data save";
+  directives[15].desc = "PIDFILE - Filename to store the gameserv process ID in";
+  directives[16].desc = "MAXAFIGHTDISTANCE - The maximum number of levels above you "\
+       "that you can fight player->player";
+  directives[17].desc = "MAXBFIGHTDISTANCE - The maximum number of levels below you "\
+       "that you can fight player->player";
+  directives[18].desc = "MAXIDLETIME - The maximum amount of time (in seconds) "\
+       "that a player can be idle before something happens";
+  directives[19].desc = "IDLECHECKPERIOD - The period (in seconds) in which the entire "\
+       "players list will be checked for idlers. See also: "\
+       "MAXIDLETIME";
+  directives[20].desc = "LISTENONC_FOREST - True/False as to "\
+       "whether or not to listen for forest "\
+       "commands on the forest channel";
+  directives[21].desc = "NEWSDATA - File to store daily news in";
+  directives[22].desc = "REFRESHPERIOD - Period (in seconds) to "\
+       "refresh players";
+  directives[23].desc = "LEVEL1EXPIRE - Amount of days until a "\
+       "level 1 player's account is deleted due to "\
+       "inactivity.";
+  directives[24].desc = "DEFAULTEXPIRE - Amount of days until a "\
+       "level 2 and above player's account is "\
+       "deleted due to inactivity";
+  directives[25].desc = "USENICKSERV - True/False as to wether or not "\
+       "GameServ should identify with NickServ";
+  directives[26].desc = "NSNAME - Your network's NickServ nickname";
+  directives[27].desc = "NSPASS - GameServ's NickServ Password";
+  directives[28].desc = "DRAGONDATA - File to store the current "\
+       "dragon's stats in";
+  directives[29].desc = "MASTERDATA - File to store the level master stats in";
+  directives[30].desc = "ITEMDATA - File to store the items in";
+  directives[31].desc = "TAVERNITEMDATA - File in which to store the items that are available in the tavern";
+  directives[32].desc = "MAXITEMS - Maximum number of items a player can carry";
+  directives[33].desc = "STOREITEMDATA - File in which to store the items that are available in the store";
+  directives[34].desc = "LOCALHOST - Local hostname or IP to bind to when connecting to the remote server";
+  directives[35].desc = "ROLLOVERFORESTFIGHTS - True/False as to wether or not to roll over forest fights "\
+       "into the next day";
+  directives[36].desc = "MAXFORESTFIGHTS - Maximum amount of forest fights to roll over";
+  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;
+  
+  for (int count = 0; count < numdirectives; count++)
     {
-       directives[count].done = false;
+         directives[count].done = false;
     }
-
-    ifstream infile;
-    infile.open(config);
-    if (infile.fail())
+  
+  ifstream infile;
+  infile.open(config);
+  if (infile.fail())
     {
-       log("Error opening %s", config);
-       cerr << "Error opening " << config << endl;
-       return 0;
+         log("Error opening %s", config);
+         cerr << "Error opening " << config << endl;
+         return 0;
     }
-
-    buf = new char[1024];
-
-    while (infile.getline(buf, 1024, '\n'))
+  
+  buf = new char[1024];
+  
+  while (infile.getline(buf, 1024, '\n'))
     {
-       #ifdef DEBUGMODE
-           log("Config file entry buf: %s", buf);
-       #endif
-
-       if (buf[0] == '#' || buf[0] == ' ' || buf[0] == '\0' || buf[0] == '\n' || buf[0] == '\r')
-           continue;
-       
-       directive = strtok(buf, " ");
-
-        if (stricmp(directive, "DIE") == 0)
-       {
-           value = strtok(NULL, "");
-           log("You should read the entire %s file!", config);
-           cerr << "You should read the entire " << config << " file!" 
-                << endl;
-           delete []buf;
-           exit(0);
-       }
-       if (stricmp(directive, "S_GAMESERV") == 0)
-       {
-           value = strtok(NULL, " ");
-           s_GameServ = new char[strlen(value) + 1];
-           strcpy(s_GameServ, value);
-           directives[0].done = true;
-       }
-       else if (stricmp(directive, "GSHOST") == 0)
-       {
-           value = strtok(NULL, " ");
-           gshost = new char[strlen(value) + 1];
-           strcpy(gshost, value);
-           directives[1].done = true;
-       }
-       else if (stricmp(directive, "GSIDENT") == 0)
-       {
-           value = strtok(NULL, " ");
-           gsident = new char[strlen(value) + 1];
-           strcpy(gsident, value);
-           directives[2].done = true;
-       }
-       else if (stricmp(directive, "SERVERNAME") == 0)
-       {
-           value = strtok(NULL, " ");
-           servername = new char[strlen(value) + 1];
-           strcpy(servername, value);
-           directives[3].done = true;
-       }
-       else if (stricmp(directive, "C_FOREST") == 0)
-       {
-           value = strtok(NULL, " ");
-           c_Forest = new char[strlen(value) + 1];
-           strcpy(c_Forest, value);
-           directives[4].done = true;
-       }
-       else if (stricmp(directive, "C_FORESTTOPIC") == 0)
-       {
-           value = strtok(NULL, "");
-           c_ForestTopic = new char[strlen(value) + 1];
-           strcpy(c_ForestTopic, value);
-           directives[5].done = true;
-       }
-       else if (stricmp(directive, "REMOTESERVER") == 0)
-       {
-           value = strtok(NULL, " ");
-           remoteserver = new char[strlen(value) + 1];
-           strcpy(remoteserver, value);
-           directives[6].done = true;
-       }
-       else if (stricmp(directive, "REMOTEPORT") == 0)
-       {
-           value = strtok(NULL, " ");
-           remoteport = new char[strlen(value) + 1];
-           strcpy(remoteport, value);
-           directives[7].done = true;
-       }
-       else if (stricmp(directive, "REMOTEPASS") == 0)
-       {
-           value = strtok(NULL, "");
-           remotepass = new char[strlen(value) + 1];
-           strcpy(remotepass, value);
-           directives[8].done = true;
-       }
-       else if (stricmp(directive, "PLAYERDATA") == 0)
-       {
-           value = strtok(NULL, "");
-           playerdata = new char[strlen(value) + 1];
-           strcpy(playerdata, value);
-           directives[9].done = true;
-       }
-       else if (stricmp(directive, "SAVEDNOTICE") == 0)
-       {
-           value = strtok(NULL, "");
-           if (stricmp(value, "TRUE") == 0)
-               setSavedNotice();
-           directives[10].done = true;
-       }
-       else if (stricmp(directive, "ADMINPASS") == 0)
-       {
-           value = strtok(NULL, "");
-           adminpass = new char[strlen(value) + 1];
-           strcpy(adminpass, value);
-           directives[11].done = true;
-       }
-       else if (stricmp(directive, "WELCOMEDELAY") == 0)
-       {
-           value = strtok(NULL, " ");
-           welcomedelay = stringtoint(value);
-           directives[12].done = true;
-       }
-       else if (stricmp(directive, "FORESTFIGHTS") == 0)
-       {
-           value = strtok(NULL, " ");
-           forestfights = stringtoint(value);
-           directives[13].done = true;
-       }
-       else if (stricmp(directive, "UPDATEPERIOD") == 0)
-       {
-           value = strtok(NULL, " ");
-           updateperiod = stringtoint(value);
-           directives[14].done = true;
-       }
-       else if (stricmp(directive, "PIDFILE") == 0)
-       {
-           value = strtok(NULL, " ");
-           pidfile = new char[strlen(value) + 1];
-           strcpy(pidfile, value);
-           directives[15].done = true;
-       }
-       else if (stricmp(directive, "MAXAFIGHTDISTANCE") == 0)
-       {
-           value = strtok(NULL, " ");
-           maxafightdistance = stringtoint(value);
-           directives[16].done = true;;
-       }
-       else if (stricmp(directive, "MAXBFIGHTDISTANCE") == 0)
-       {
-           value = strtok(NULL, " ");
-           maxbfightdistance = stringtoint(value);
-           directives[17].done = true;
-       }
-       else if (stricmp(directive, "MAXIDLETIME") == 0)
-       {
-           value = strtok(NULL, " ");
-           maxidletime = stringtoint(value);
-           directives[18].done = true;
-       }
-       else if (stricmp(directive, "IDLECHECKPERIOD") == 0)
-       {
-           value = strtok(NULL, " ");
-           idlecheckperiod = stringtoint(value);
-           directives[19].done = true;
-       }
-       else if (stricmp(directive, "LISTENONC_FOREST") == 0)
-       {
-           value = strtok(NULL, " ");
-           if (stricmp(value, "TRUE") == 0)
-               setListenOnCF();
-
-           directives[20].done = true;
-       }
-       else if (stricmp(directive, "NEWSDATA") == 0)
-       {
-           value = strtok(NULL, " ");
-           newsdata = new char [strlen(value) + 1];
-           strcpy(newsdata, value);
-           directives[21].done = true;
-       }
-       else if (stricmp(directive, "REFRESHPERIOD") == 0)
-       {
-           value = strtok(NULL, " ");
-           refreshperiod = stringtoint(value);
-           directives[22].done = true;
-       }
-       else if (stricmp(directive, "LEVEL1EXPIRE") == 0)
-       {
-           value = strtok(NULL, " ");
-           level1expire = stringtoint(value);
-           directives[23].done = true;
-       }
-       else if (stricmp(directive, "DEFAULTEXPIRE") == 0)
-       {
-           value = strtok(NULL, " ");
-           defaultexpire = stringtoint(value);
-           directives[24].done = true;
-       }
-       else if (stricmp(directive, "USENICKSERV") == 0)
-       {
-           value = strtok(NULL, " ");
-           if (stricmp(value, "TRUE") == 0)
-           {
-               setUseNickServ();
-           }
-
-           directives[25].done = true;
-       }
-       else if (stricmp(directive, "NSNAME") == 0)
-       {
-           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, "");
-           nspass = new char[strlen(value) + 1];
-           strcpy(nspass, value);
-           directives[27].done = true;
-       }
-       else if (stricmp(directive, "DRAGONDATA") == 0)
-       {
-           value = strtok(NULL, "");
-           dragondata = new char[strlen(value) + 1];
-           strcpy(dragondata, value);
-           directives[28].done = true;
-       }
-       else if (stricmp(directive, "MASTERDATA") == 0)
-       {
-           value = strtok(NULL, "");
-           masterdata = new char[strlen(value) + 1];
-           strcpy(masterdata, value);
-           directives[29].done = true;
-       }
-       else if (stricmp(directive, "ITEMDATA") == 0)
-       {
-         value = strtok(NULL, "");
-         itemdata = new char[strlen(value) + 1];
-         strcpy(itemdata, value);
-         directives[30].done = true;
-       }
-       else if (stricmp(directive, "TAVERNITEMDATA") == 0)
-         {
-           value = strtok(NULL, "");
-           itemdata = new char[strlen(value) + 1];
-           strcpy(itemdata, value);
-           directives[31].done = true;
-         }
-       else if (stricmp(directive, "WELCOMEMSG") == 0)
-       {
-           // This directive is optional
-           value = strtok(NULL, "");
-           welcomemsg = new char[strlen(value) + 1];
-           strcpy(welcomemsg, value);
-           setWelcome();
-       }
-       else if (stricmp(directive, "USEPRIVMSG") == 0)
-       {
-           // This directive is optional
-           setUsePrivmsg();
-       }
-       else if (stricmp(directive, "BOPER") == 0)
-       {
-           // This directive is optional
-           setBOper();
-       }
-       else if (stricmp(directive, "IGNORESERVERS") == 0)
-       {
-           // This directive is optional
-           value = strtok(NULL, "");
-           ignoreserverslist = new char[strlen(value) + 1];
-           strcpy(ignoreserverslist, value);
-       }
-       else
-       {
-           #ifdef DEBUGMODE
-               log("Unknown Directive. Buffer: %s", buf);
-               cerr << "Unknown " << config << " directive. Buffer: " 
-                    << buf << endl;
-           #endif
+#ifdef DEBUGMODE
+         log("Config file entry buf: %s", buf);
+#endif
+         
+         if (buf[0] == '#' || buf[0] == ' ' || buf[0] == '\0' || buf[0] == '\n' || buf[0] == '\r')
            continue;
-       }
-    }
-delete [] buf;
-infile.close();
-
-    int nonemissing = 1;
-    for (int count2 = 0; count2 < numdirectives; count2++)
-    {
-       if (!directives[count2].done)
-       {
-           cerr << "Missing config directive: " << directives[count2].desc << endl;
-           nonemissing = 0;
-       }
+         
+         directive = strtok(buf, " ");
+         
+         if (stricmp(directive, "DIE") == 0)
+               {
+                 value = strtok(NULL, "");
+                 log("You should read the entire %s file!", config);
+                 cerr << "You should read the entire " << config << " file!" 
+                          << endl;
+                 delete []buf;
+                 exit(0);
+               }
+         if (stricmp(directive, "S_GAMESERV") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 s_GameServ = new char[strlen(value) + 1];
+                 strcpy(s_GameServ, value);
+                 directives[0].done = true;
+               }
+         else if (stricmp(directive, "GSHOST") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 gshost = new char[strlen(value) + 1];
+                 strcpy(gshost, value);
+                 directives[1].done = true;
+               }
+         else if (stricmp(directive, "GSIDENT") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 gsident = new char[strlen(value) + 1];
+                 strcpy(gsident, value);
+                 directives[2].done = true;
+               }
+         else if (stricmp(directive, "SERVERNAME") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 servername = new char[strlen(value) + 1];
+                 strcpy(servername, value);
+                 directives[3].done = true;
+               }
+         else if (stricmp(directive, "C_FOREST") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 c_Forest = new char[strlen(value) + 1];
+                 strcpy(c_Forest, value);
+                 directives[4].done = true;
+               }
+         else if (stricmp(directive, "C_FORESTTOPIC") == 0)
+               {
+                 value = strtok(NULL, "");
+                 c_ForestTopic = new char[strlen(value) + 1];
+                 strcpy(c_ForestTopic, value);
+                 directives[5].done = true;
+               }
+         else if (stricmp(directive, "REMOTESERVER") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 remoteserver = new char[strlen(value) + 1];
+                 strcpy(remoteserver, value);
+                 directives[6].done = true;
+               }
+         else if (stricmp(directive, "REMOTEPORT") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 remoteport = stringtoint(value);
+                 directives[7].done = true;
+               }
+         else if (stricmp(directive, "REMOTEPASS") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 remotepass = new char[strlen(value) + 1];
+                 strcpy(remotepass, value);
+                 directives[8].done = true;
+               }
+         else if (stricmp(directive, "PLAYERDATA") == 0)
+               {
+                 value = strtok(NULL, "");
+                 playerdata = new char[strlen(value) + 1];
+                 strcpy(playerdata, value);
+                 directives[9].done = true;
+               }
+         else if (stricmp(directive, "SAVEDNOTICE") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 if (stricmp(value, "TRUE") == 0)
+                       setSavedNotice();
+                 directives[10].done = true;
+               }
+         else if (stricmp(directive, "ADMINPASS") == 0)
+               {
+                 value = strtok(NULL, "");
+                 adminpass = new char[strlen(value) + 1];
+                 strcpy(adminpass, value);
+                 directives[11].done = true;
+               }
+         else if (stricmp(directive, "WELCOMEDELAY") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 welcomedelay = stringtoint(value);
+                 directives[12].done = true;
+               }
+         else if (stricmp(directive, "FORESTFIGHTS") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 forestfights = stringtoint(value);
+                 directives[13].done = true;
+               }
+         else if (stricmp(directive, "UPDATEPERIOD") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 updateperiod = stringtoint(value);
+                 directives[14].done = true;
+               }
+         else if (stricmp(directive, "PIDFILE") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 pidfile = new char[strlen(value) + 1];
+                 strcpy(pidfile, value);
+                 directives[15].done = true;
+               }
+         else if (stricmp(directive, "MAXAFIGHTDISTANCE") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 maxafightdistance = stringtoint(value);
+                 directives[16].done = true;;
+               }
+         else if (stricmp(directive, "MAXBFIGHTDISTANCE") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 maxbfightdistance = stringtoint(value);
+                 directives[17].done = true;
+               }
+         else if (stricmp(directive, "MAXIDLETIME") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 maxidletime = stringtoint(value);
+                 directives[18].done = true;
+               }
+         else if (stricmp(directive, "IDLECHECKPERIOD") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 idlecheckperiod = stringtoint(value);
+                 directives[19].done = true;
+               }
+         else if (stricmp(directive, "LISTENONC_FOREST") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 if(stricmp(value, "TRUE") == 0)
+                       {
+                         setListenOnCF();
+                       }
+                 
+                 directives[20].done = true;
+               }
+         else if (stricmp(directive, "NEWSDATA") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 newsdata = new char [strlen(value) + 1];
+                 strcpy(newsdata, value);
+                 directives[21].done = true;
+               }
+         else if (stricmp(directive, "REFRESHPERIOD") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 refreshperiod = stringtoint(value);
+                 directives[22].done = true;
+               }
+         else if (stricmp(directive, "LEVEL1EXPIRE") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 level1expire = stringtoint(value);
+                 directives[23].done = true;
+               }
+         else if (stricmp(directive, "DEFAULTEXPIRE") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 defaultexpire = stringtoint(value);
+                 directives[24].done = true;
+               }
+         else if (stricmp(directive, "USENICKSERV") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 if (stricmp(value, "TRUE") == 0)
+                       {
+                         setUseNickServ();
+                       }
+                 
+                 directives[25].done = true;
+               }
+         else if (stricmp(directive, "NSNAME") == 0)
+               {
+                 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, " ");
+                 nspass = new char[strlen(value) + 1];
+                 strcpy(nspass, value);
+                 directives[27].done = true;
+               }
+         else if (stricmp(directive, "DRAGONDATA") == 0)
+               {
+                 value = strtok(NULL, "");
+                 dragondata = new char[strlen(value) + 1];
+                 strcpy(dragondata, value);
+                 directives[28].done = true;
+               }
+         else if (stricmp(directive, "MASTERDATA") == 0)
+               {
+                 value = strtok(NULL, "");
+                 masterdata = new char[strlen(value) + 1];
+                 strcpy(masterdata, value);
+                 directives[29].done = true;
+               }
+         else if (stricmp(directive, "ITEMDATA") == 0)
+               {
+                 value = strtok(NULL, "");
+                 itemdata = new char[strlen(value) + 1];
+                 strcpy(itemdata, value);
+                 directives[30].done = true;
+               }
+         else if (stricmp(directive, "TAVERNITEMDATA") == 0)
+               {
+                 value = strtok(NULL, "");
+                 tavernitemdata = new char[strlen(value) + 1];
+                 strcpy(tavernitemdata, value);
+                 directives[31].done = true;
+               }
+         else if (stricmp(directive, "MAXITEMS") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 maxitems = stringtoint(value);
+                 directives[32].done = true;
+               }
+         else if (stricmp(directive, "STOREITEMDATA") == 0)
+               {
+                 value = strtok(NULL, "");
+                 storeitemdata = new char[strlen(value) + 1];
+                 strcpy(storeitemdata, value);
+                 directives[33].done = true;
+               }
+         else if (stricmp(directive, "LOCALHOST") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 localhost = new char[strlen(value) + 1];
+                 strcpy(localhost, value);
+                 directives[34].done = true;
+               }
+         else if (stricmp(directive, "ROLLOVERFORESTFIGHTS") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 if (stricmp(value, "TRUE") == 0)
+                       {
+                         setRolloverForestFights();
+                       }
+                 else
+                       {
+                         directives[36].done = true;
+                         directives[37].done = true;
+                         directives[38].done = true;
+                       }
+                 directives[35].done = true;
+               }
+         else if (stricmp(directive, "MAXFORESTFIGHTS") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 maxforestfights = stringtoint(value);
+                 directives[36].done = true;
+               }
+         else if (stricmp(directive, "ROLLOVERPERIOD") == 0)
+               {
+                 value = strtok(NULL, " ");
+                 rolloverperiod = stringtoint(value);
+                 directives[37].done = true;
+               }
+         else if (stricmp(directive, "NUMROLLOVERFIGHTS") == 0)
+               {
+                 value = strtok(NULL, "");
+                 numrolloverfights = stringtoint(value);
+                 directives[38].done = true;
+               }
+         else if (stricmp(directive, "FAIRFIGHTS") == 0)
+               {
+                 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
+                 value = strtok(NULL, "");
+                 welcomemsg = new char[strlen(value) + 1];
+                 strcpy(welcomemsg, value);
+                 setWelcome();
+               }
+         else if (stricmp(directive, "USEPRIVMSG") == 0)
+               {
+                 // This directive is optional
+                 setUsePrivmsg();
+               }
+         else if (stricmp(directive, "BOPER") == 0)
+               {
+                 // This directive is optional
+                 setBOper();
+               }
+         else if (stricmp(directive, "IGNORESERVERS") == 0)
+               {
+                 // This directive is optional
+                 value = strtok(NULL, "");
+                 ignoreserverslist = new char[strlen(value) + 1];
+                 strcpy(ignoreserverslist, value);
+               }
+         else
+               {
+#ifdef DEBUGMODE
+                 log("Unknown Directive. Buffer: %s", buf);
+                 cerr << "Unknown " << config << " directive. Buffer: " 
+                          << buf << endl;
+#endif
+                 continue;
+               }
     }
-
-    return nonemissing;
+  delete [] buf;
+  infile.close();
+  
+  int nonemissing = 1;
+  for (int count2 = 0; count2 < numdirectives; count2++)
+       {
+         if (!directives[count2].done)
+               {
+                 cerr << "Missing config directive: " << directives[count2].desc << endl;
+                 nonemissing = 0;
+               }
+       }
+  
+  return nonemissing;
 }