]> git.pond.sub.org Git - empserver/blobdiff - src/lib/player/player.c
Update copyright notice.
[empserver] / src / lib / player / player.c
index 52eaefaf8e69dda0a879622cdf5a7f4bdc537c2b..309ab4f3fc842c6cb993a9a24cf6479a82f9769b 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2007, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
  * 
  *  Known contributors to this file:
  *     Steve McClure, 2000
- *     
  */
 
 #include <config.h>
+#if !defined(_WIN32)
+#include <unistd.h>
+#endif
+#include <stdio.h>
+#include <errno.h>
+#include <fcntl.h>
 
-#include "prototypes.h"
-#include <string.h>
+#include "com.h"
+#include "empio.h"
+#include "empthread.h"
+#include "file.h"
+#include "journal.h"
 #include "misc.h"
+#include "nat.h"
+#include "optlist.h"
 #include "player.h"
 #include "proto.h"
-#include "com.h"
-#include "nat.h"
-#include "sect.h"
-#include "file.h"
 #include "proto.h"
-#include "empio.h"
-#include "empthread.h"
+#include "prototypes.h"
+#include "sect.h"
 #include "tel.h"
-#include "gen.h"
-#include "subs.h"
-#include "common.h"
-#include "optlist.h"
 
-#if !defined(_WIN32)
-#include <unistd.h>
-#include <sys/time.h>
-#endif
-#include <stdio.h>
-#include <errno.h>
-#include <fcntl.h>
 
+static int command(void);
 static int status(void);
 
 struct player *player;
@@ -76,8 +72,10 @@ player_main(struct player *p)
     time(&player->lasttime);
     time(&player->curup);
     show_motd();
-    if (init_nats() < 0)
+    if (init_nats() < 0) {
+       pr("Server confused, try again later\n");
        return;
+    }
     natp = getnatp(player->cnum);
     if (!gamehours(player->curup)) {
        pr("Empire hours restriction in force\n");
@@ -107,6 +105,7 @@ player_main(struct player *p)
 
     time(&natp->nat_last_login);
     putnat(natp);
+    journal_login();
     if (natp->nat_flags & NF_INFORM && natp->nat_tgms > 0) {
        if (natp->nat_tgms == 1)
            pr("You have a new telegram waiting ...\n");
@@ -136,12 +135,12 @@ player_main(struct player *p)
        natp->nat_minused += 1;
     putnat(natp);
     pr("Bye-bye\n");
+    journal_logout();
 }
 
-int
+static int
 command(void)
 {
-    unsigned int x;
     char *redir;               /* UTF-8 */
     char scanspace[1024];
 
@@ -151,15 +150,6 @@ command(void)
              scanspace, &redir) < 0) {
        pr("See \"info Syntax\"?\n");
     } else {
-       /* XXX don't use alarm; use a scavenger thread */
-       /* DONT USE IT!!!! alarm and sleep may and dont work
-          together -- Sasha */
-       /* alarm((unsigned int)60*60); 1 hour */
-       if (player->condarg != NULL)
-           for (x = 0; x < strlen(player->condarg); x++)
-               if (isupper(*(player->condarg + x)))
-                   *(player->condarg + x) =
-                       tolower(*(player->condarg + x));
        if (dispatch(player->combuf, redir) < 0)
            pr("Try \"list of commands\" or \"info\"\n");
     }