]> jfr.im git - irc/gameservirc.git/blobdiff - gameserv/config.cpp
Fixed a major bug that had player fights core dumping the server
[irc/gameservirc.git] / gameserv / config.cpp
index 21088cdc6f9b959d4165268b71f152c7becc2148..d377ebd69da774afdfe0f5d14213c3e20ae75aee 100644 (file)
@@ -24,6 +24,8 @@ char *welcomemsg;             // Welcome Message
 int welcomedelay;              // Welcome Message Delay
 int updateperiod;              // Seconds until another player database update
 int forestfights;              // Forest fights per day
+int maxafightdistance;         // Max levels above a player they can fight player->player
+int maxbfightdistance;         // Max levels below a player they can fight player->player
 
 // Remote server stuff. This is used for the outgoing connection gameserv needs to make
 // to a real ircd.
@@ -33,6 +35,7 @@ char *remotepass;             // Password for the server link
 
 char *playerdata;              // File to store player data in
 char *monsterdata;             // File to load monster data from
+char *pidfile;                 // Process ID file
 
 #if defined(P10)
        char *gsnum = "[]AAA";          // GameServ Numeric
@@ -66,12 +69,15 @@ void unload_config_file()
        delete [] adminpass;
     if (welcomemsg)
        delete [] welcomemsg;
+    if (pidfile)
+       delete [] pidfile;
 }
 
 int load_config_file(char *config)
 {
     char *buf, *directive, *value;
-    #define numdirectives 15
+
+    #define numdirectives 19
 
     unload_config_file();
 
@@ -98,6 +104,11 @@ int load_config_file(char *config)
     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 = "WELCOMEMSG - Message to send to new users on the network";
+    directives[16].desc = "PIDFILE - Filename to store the gameserv process ID in";
+    directives[17].desc = "MAXAFIGHTDISTANCE - The maximum number of levels above you "\
+                               "that you can fight player->player";
+    directives[18].desc = "MAXBFIGHTDISTANCE - The maximum number of levels below you "\
+                               "that you can fight player->player";
 
     for (int count = 0; count < numdirectives; count++)
     {
@@ -244,6 +255,25 @@ int load_config_file(char *config)
            strcpy(welcomemsg, value);
            directives[15].done = true;
        }
+       else if (stricmp(directive, "PIDFILE") == 0)
+       {
+           value = strtok(NULL, " ");
+           pidfile = new char[strlen(value) + 1];
+           strcpy(pidfile, value);
+           directives[16].done = true;
+       }
+       else if (stricmp(directive, "MAXAFIGHTDISTANCE") == 0)
+       {
+           value = strtok(NULL, " ");
+           maxafightdistance = stringtoint(value);
+           directives[17].done = true;;
+       }
+       else if (stricmp(directive, "MAXBFIGHTDISTANCE") == 0)
+       {
+           value = strtok(NULL, " ");
+           maxbfightdistance = stringtoint(value);
+           directives[18].done = true;
+       }
        else
        {
            #ifdef DEBUGMODE