Date: Wednesday November 15, 2000 @ 0:47
Author: ahn
Update of /home/netrek/cvsroot/Vanilla/ntserv
In directory swashbuckler.fortress.real-time.com:/var/tmp/cvs-serv14988/ntserv
Modified Files:
daemonII.c enter.c
Log Message:
Fix no-quit bug.
****************************************
Index: Vanilla/ntserv/daemonII.c
diff -u Vanilla/ntserv/daemonII.c:1.34 Vanilla/ntserv/daemonII.c:1.35
--- Vanilla/ntserv/daemonII.c:1.34 Sun Jul 2 22:03:35 2000
+++ Vanilla/ntserv/daemonII.c Wed Nov 15 00:47:01 2000
@@ -54,6 +54,7 @@
static void move(int ignored);
static void udplayersight(void);
static void udplayers(void);
+static void udplayerpause(void);
static void changedir(struct player *sp);
static void udcloak(void);
static void torp_track_target(struct torp *t);
@@ -456,6 +457,9 @@
}
if (status->gameup & GU_PAUSED){ /* Game is paused */
+ if (fuse(PLAYERFUSE))
+ udplayerpause();
+
signal_servers();
(void) SIGNAL(SIGALRM, move);
return;
@@ -708,6 +712,70 @@
}
}
+
+/* update players during pause */
+static void udplayerpause(void) {
+ int i;
+ struct player *j;
+
+ for (i=0; i<MAXPLAYER; i++) {
+ int kill_player = 0; /* 1 = QUIT during pause */
+ /* 2 = ghostbust during pause */
+ j = &players[i];
+
+ switch(j->p_status) {
+ case PFREE: /* reset ghostbuster and continue */
+ j->p_ghostbuster = 0;
+ continue;
+ break;
+ case PEXPLODE:
+ if (j->p_whydead == KQUIT)
+ j->p_status = PDEAD;
+ break;
+ case PDEAD:
+ if (j->p_whydead == KQUIT)
+ kill_player = 1;
+ break;
+ }
+
+ if (++(j->p_ghostbuster) > GHOSTTIME) {
+ ERROR(4,("daemonII/udplayerpause: %s: ship ghostbusted (wd=%d)\n",
+ j->p_mapchars, j->p_whydead));
+
+#ifdef OBSERVERS
+ /* observer hack */
+ if (j->p_status == POBSERV)
+ j->p_armies = 0;
+#endif
+
+ ghostmess(j);
+
+ /* temporary */
+ fflush(stdout);
+
+ j->p_status = PDEAD;
+ j->p_whydead = KGHOST;
+ j->p_whodead = i;
+
+ /* Force the player out of the game */
+ kill_player = 2;
+ }
+
+ if (kill_player && (j->p_process > 1)) {
+ j->p_ghostbuster = 0;
+
+ saveplayer(j);
+ ERROR(8,("daemonII/udplayerpause: %s: sending SIGTERM to %d\n",
+ j->p_mapchars, j->p_process));
+
+ if (kill (j->p_process, SIGTERM) < 0)
+ ERROR(1,("daemonII/udplayerpause: kill failed!\n"));
+
+ /* let's be safe */
+ freeslot(j);
+ }
+ }
+}
static void udplayers(void)
Index: Vanilla/ntserv/enter.c
diff -u Vanilla/ntserv/enter.c:1.7 Vanilla/ntserv/enter.c:1.8
--- Vanilla/ntserv/enter.c:1.7 Fri Feb 25 21:44:00 2000
+++ Vanilla/ntserv/enter.c Wed Nov 15 00:47:01 2000
@@ -129,7 +129,7 @@
me->p_ship.s_plasmacost = -1;
}
me->p_updates = 0;
- me->p_flags = PFSHIELD;
+ me->p_flags = PFSHIELD|PFGREEN;
if (s_type==STARBASE) me->p_flags |= PFDOCKOK;
me->p_dir = 0;
me->p_desdir = 0;