using std::endl;
char *PACKAGE = "GameServ";
-char *VERSION = "1.1.8";
+char *VERSION = "1.2.0 +devel";
int sock;
int day;
// Close all file descriptors from >= fd
void closeall(int fd);
-int main()
+int main(int argc, char *argv[])
{
char buffer[1024], buf[1024];
int connected = 1;
- char *cmd, *source = NULL;
+ char *cmd, *source = NULL, *conf = "gameserv.conf";
srand(time(NULL));
-
+
+ /*
+ * This needs to be fixed to work for any number of arguments in any
+ * order
+ *
+ */
+ if (argc > 1)
+ {
+ if ( argc > 2 || stricmp(argv[1], "--help") == 0)
+ {
+ cout << "Usage: gameserv [options] [configfile]" << endl;
+ cout << "Options:" << endl;
+ cout << "--help Displays this help dialogue" << endl;
+ return 1;
+ }
+ conf = new char[strlen(argv[1])];
+ strcpy(conf, argv[1]);
+ }
+
prettyIntro();
- load_config_file(); // default = gameserv.conf
+
+ if (load_config_file(conf))
+ {
+ cout << "Config file loaded ok...\n"
+ << "Turning into a daemon" << endl;
+ }
+ else
+ exit(2);
// Turn into a daemon
if (daemon(1,0) < 0)
log("Server: %s",buffer);
#endif
+ strcpy(boss.name, "Red Dragon");
+ strcpy(boss.weapon, "Breath of Unholy Fire");
+ boss.strength = 6667;
+ boss.gold = 2000000000;
+ boss.exp = 2000000000;
+ strcpy(boss.death, "You finally snuff out the deadly murderous "\
+ "dragon's dark flames. You have freed the land of its terror "\
+ "filled reign from above!");
+
init_masters();
load_gs_dbase();
load_day();
clients.remove(quitter);
if ((quitter = findIRCplayer(source)))
{
+ if (player_fight(quitter))
+ {
+ // Stop the fight on the other client
+ aClient *otherplayer = quitter->stats->battle;
+ otherplayer->stats->battle = NULL;
+ notice(s_GameServ, otherplayer->getNick(), "%s "\
+ "has quit IRC. The fight stops here.",
+ quitter->stats->name);
+ }
+ quitter->stats->battle = NULL;
+ quitter->stats->fight = NULL;
+ quitter->stats->master = NULL;
+
quitter->setNick("!NULL!");
+ #ifdef P10
+ quitter->setRealNick("!NULL!");
+ #endif
quitter->stats->user = NULL; // Unidentify them
}
case -1: return -1;
default:
ofstream outfile;
- outfile.open("gameserv.pid");
+ outfile.open(pidfile);
if (outfile.fail())
- cerr << "Unable to open gameserv.pid" << endl;
+ cerr << "Unable to open " << pidfile << endl;
outfile << pid << endl;
outfile.close();