-#include <fstream.h>
+#include <fstream>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "extern.h"
-void load_config_file(char *config);
+using std::ifstream;
+using std::cerr;
+using std::endl;
+
+int load_config_file(char *config);
void unload_config_file();
/* Random Configuration Stuff Goes Here until I code it to load from a .conf file :)*/
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)
delete [] welcomemsg;
}
-void load_config_file(char *config)
+int load_config_file(char *config)
{
char *buf, *directive, *value;
buf = new char[1024];
infile.open(config);
if (infile.fail())
{
+ log("Error opening %s", config);
cerr << "Error opening " << config << endl;
- return;
+ return 0;
}
while (infile.getline(buf, 1024, '\n'))
{
#ifdef DEBUGMODE
- log("Buf: %s", buf);
+ log("Config file entry buf: %s", buf);
#endif
if (buf[0] == '#' || buf[0] == ' ' || buf[0] == '\0' || buf[0] == '\n' || buf[0] == '\r')
if (stricmp(directive, "DIE") == 0)
{
value = strtok(NULL, "");
- cerr << value << endl;
+ log("You should read the entire %s file!", config);
+ cerr << "You should read the entire " << config << " file!"
+ << endl;
exit(0);
}
if (stricmp(directive, "S_GAMESERV") == 0)
{
#ifdef DEBUGMODE
log("Unknown Directive. Buffer: %s", buf);
+ cerr << "Unknown " << config << " directive. Buffer: "
+ << buf << endl;
#endif
continue;
}
}
delete [] buf;
infile.close();
+return 1;
}