-#include <fstream.h>
+#include <fstream>
#include <string.h>
+#include <stdlib.h>
#include <stdio.h>
#include "extern.h"
+using std::ifstream;
+
void load_config_file(char *config);
void unload_config_file();
char *welcomemsg; // Welcome Message
int welcomedelay; // Welcome Message Delay
int updateperiod; // Seconds until another player database update
+int forestfights; // Forest fights per day
// Remote server stuff. This is used for the outgoing connection gameserv needs to make
// to a real ircd.
char *playerdata; // File to store player data in
char *monsterdata; // File to load monster data from
+#if defined(P10)
+ char *gsnum = "[]AAA"; // GameServ Numeric
+#endif
+
void unload_config_file()
{
if (s_GameServ)
infile.open(config);
if (infile.fail())
{
- cout << "Error opening " << config << endl;
+ log("Error opening %s", config);
return;
}
while (infile.getline(buf, 1024, '\n'))
{
- cout << "Buf: " << buf << endl;
+ #ifdef DEBUGMODE
+ log("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);
+ exit(0);
+ }
if (stricmp(directive, "S_GAMESERV") == 0)
{
value = strtok(NULL, " ");
value = strtok(NULL, " ");
welcomedelay = stringtoint(value);
}
+ else if (stricmp(directive, "FORESTFIGHTS") == 0)
+ {
+ value = strtok(NULL, " ");
+ forestfights = stringtoint(value);
+ }
else if (stricmp(directive, "UPDATEPERIOD") == 0)
{
value = strtok(NULL, " ");
}
else
{
- cout << "Unknown Directive. Buffer: " << buf << endl;
+ #ifdef DEBUGMODE
+ log("Unknown Directive. Buffer: %s", buf);
+ #endif
continue;
}
}