+
+ 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, "SCRIPTDIR") == 0)
+ {
+ value = strtok(NULL, " ");
+ scriptdir = new char [strlen(value) + 1];
+ strcpy(scriptdir, value);
+ directives[41].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;
+ }