]> git.pond.sub.org Git - empserver/blobdiff - src/lib/player/player.c
License upgrade to GPL version 3 or later
[empserver] / src / lib / player / player.c
index 3852c1161e3c74cc75a79f9c86081fa81b243e72..5ff9396fa0ae0ddd4303f6c9b038ca99d4510f91 100644 (file)
@@ -1,11 +1,11 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2009, Dave Pare, Jeff Bailey, Thomas Ruschak,
- *                           Ken Stevens, Steve McClure
+ *  Copyright (C) 1986-2011, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *                Ken Stevens, Steve McClure, Markus Armbruster
  *
- *  This program is free software; you can redistribute it and/or modify
+ *  Empire is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
+ *  the Free Software Foundation, either version 3 of the License, or
  *  (at your option) any later version.
  *
  *  This program is distributed in the hope that it will be useful,
@@ -14,8 +14,7 @@
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  *  ---
  *
  *
  *  Known contributors to this file:
  *     Steve McClure, 2000
- *     Markus Armbruster, 2004-2008
- *     Ron Koenderink, 2004-2007
+ *     Markus Armbruster, 2004-2009
+ *     Ron Koenderink, 2004-2009
  */
 
 #include <config.h>
 
-#include <errno.h>
-#include <stdio.h>
 #include "com.h"
 #include "empio.h"
 #include "empthread.h"
@@ -53,7 +50,6 @@
 
 static int command(void);
 static int status(void);
-static int print_sink(char *, size_t, void *);
 
 struct player *player;
 
@@ -73,7 +69,7 @@ player_main(struct player *p)
        return;
     }
     natp = getnatp(player->cnum);
-    if (!may_play_now(natp, player->curup, 0))
+    if (!may_play_now(natp, player->curup))
        return;
     if (natp->nat_stat != STAT_VIS
        && natp->nat_last_login
@@ -124,11 +120,11 @@ command(void)
     time_t now;
 
     if (getcommand(player->combuf) < 0)
-       return 0;
+       return player->aborted;
 
     now = time(NULL);
     update_timeused(now);
-    if (!may_play_now(getnatp(player->cnum), now, 1))
+    if (!player->god && !may_play_now(getnatp(player->cnum), now))
        return 0;
 
     if (parse(player->combuf, scanspace, player->argp, player->comtail,
@@ -176,7 +172,7 @@ status(void)
 
     time(&player->curup);
     update_timeused(player->curup);
-    if (!may_play_now(natp, player->curup, 0))
+    if (!may_play_now(natp, player->curup))
        return 0;
     if (player->btused) {
        natp->nat_btu -= player->btused;
@@ -262,38 +258,6 @@ show_motd(void)
     return RET_OK;
 }
 
-/*
- * Print first telegram in file FNAME.
- */
-int
-show_first_tel(char *fname)
-{
-    FILE *fp;
-    struct telstr tgm;
-
-    if ((fp = fopen(fname, "rb")) == NULL) {
-       if (errno == ENOENT)
-           return 0;
-       else {
-           logerror("Could not open %s.\n", fname);
-           return -1;
-       }
-    }
-    if (tel_read_header(fp, fname, &tgm) < 0)
-       return -1;
-    if (tel_read_body(fp, fname, &tgm, print_sink, NULL) < 0)
-       return -1;
-    fclose(fp);
-    return 0;
-}
-
-static int
-print_sink(char *chunk, size_t sz, void *arg)
-{
-    uprnf(chunk);
-    return 0;
-}
-
 int
 quit(void)
 {