#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();
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
{
char *buf, *directive, *value;
-#define numdirectives 40
+#define numdirectives 41
unload_config_file();
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;
}
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;
}
else if (stricmp(directive, "SAVEDNOTICE") == 0)
{
- value = strtok(NULL, "");
+ value = strtok(NULL, " ");
if (stricmp(value, "TRUE") == 0)
setSavedNotice();
directives[10].done = true;
}
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;
}
else if (stricmp(directive, "MAXITEMS") == 0)
{
- value = strtok(NULL, "");
+ value = strtok(NULL, " ");
maxitems = stringtoint(value);
directives[32].done = true;
}
}
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;
}
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;
}
}
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