Update of /cvsroot/netrek/server/Vanilla/ntserv
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15815/ntserv

Modified Files:
	daemonII.c death.c detonate.c getentry.c phaser.c torp.c 
Log Message:
conquer gloating

Index: getentry.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ntserv/getentry.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- getentry.c	21 Mar 2005 10:17:17 -0000	1.2
+++ getentry.c	23 Apr 2006 13:30:41 -0000	1.3
@@ -144,6 +144,7 @@
 		(me->p_team != ALLTEAM) && 
 		(switching != teamPick) && 
 		(me->p_whydead != KGENOCIDE) && 
+		(me->p_whydead != KWINNER) && 
 		(me->p_whydead != KPROVIDENCE) ) {
 		    switching = teamPick;
                     new_warning(10,"Please confirm change of teams.  Select the new team again.");
@@ -277,7 +278,7 @@
     /* Is the server closed, or did the daemond die. */
     if ((!time_access()) || !(status->gameup & GU_GAMEOK)) return 0;
     /* You must leave */
-    if (mustexit) return (0);
+    if (mustexit) return 0;
     /* Special modes */
     if (chaos || topgun) return (allteams);
     /* Only continue if the queue has mask restrictions */

Index: phaser.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ntserv/phaser.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- phaser.c	21 Mar 2005 05:23:44 -0000	1.1
+++ phaser.c	23 Apr 2006 13:30:41 -0000	1.2
@@ -29,6 +29,8 @@
   U_LONG range_sq, this_range_sq;
   struct phaser *mine = &phasers[me->p_no];
 
+  if (status->gameup & GU_GLOAT_CONQUER) return;
+
   if (mine->ph_status != PHFREE) {
     new_warning(32, "Phasers have not recharged.");
     return;

Index: death.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ntserv/death.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- death.c	21 Mar 2005 05:23:43 -0000	1.1
+++ death.c	23 Apr 2006 13:30:41 -0000	1.2
@@ -42,9 +42,14 @@
     case TOURNEND:
     case TOURNSTART:
 	break;
+    case KWINNER:
+        if ((queues[QU_PICKUP].q_flags & QU_OPEN) &&
+	    (queues[QU_PICKUP].count > 0)){
+	  mustexit = 1;
+	}
+	break;
     case KQUIT:
     case KDAEMON:
-    case KWINNER:
     case KOVER:
     case KBADBIN:
 	mustexit = 1;

Index: torp.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ntserv/torp.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- torp.c	21 Mar 2005 05:23:44 -0000	1.1
+++ torp.c	23 Apr 2006 13:30:41 -0000	1.2
@@ -53,6 +53,8 @@
   static LONG last_torp_fired_update = 0;
   struct torp *k;
 
+  if (status->gameup & GU_GLOAT_CONQUER) return;
+
   /*
    * Prevent player from firing more than one torp per update.  */
   if (me->p_updates == last_torp_fired_update)

Index: detonate.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ntserv/detonate.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- detonate.c	21 Mar 2005 05:23:43 -0000	1.1
+++ detonate.c	23 Apr 2006 13:30:41 -0000	1.2
@@ -20,6 +20,8 @@
   struct player *j;
   struct torp *t;
 
+  if (status->gameup & GU_GLOAT_CONQUER) return;
+
   if (me->p_fuel < myship->s_detcost) {
     new_warning(UNDEF, "Not enough fuel to detonate");
     return;

Index: daemonII.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/ntserv/daemonII.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- daemonII.c	23 Apr 2006 10:39:10 -0000	1.9
+++ daemonII.c	23 Apr 2006 13:30:41 -0000	1.10
@@ -101,6 +101,7 @@
 static void exitDaemon(int sig);
 static void save_planets(void);
 static void checkgen(int loser, struct player *winner);
+static void gloat_conquer_timer();
 static int checkwin(struct player *winner);
 static void ghostmess(struct player *victim);
 static void saveplayer(struct player *victim);
@@ -568,7 +569,7 @@
     if (status->gameup & GU_PAUSED){ /* Game is paused */
       if (fuse(PLAYERFUSE))
         udplayerpause();
-
+      if (status->gameup & GU_GLOAT_CONQUER) gloat_conquer_timer();
       signal_servers();
       (void) SIGNAL(SIGALRM, move);
       return;
@@ -3709,6 +3710,105 @@
     /* constants (now in defs.h).  30-60 min for a coup.  4/15/92 TC */
 }
 
+#define GLOAT_TIMER_BEGIN 100
+#define GLOAT_TIMER_DECLOAK 90
+#define GLOAT_TIMER_PARADE 40
+#define GLOAT_TIMER_GOODBYE 10
+
+int gloat_player;
+int gloat_planet;
+int gloat_timer;
+
+static void gloat_conquer_decloak()
+{
+	int h;
+	struct player *j;
+
+	for (h = 0, j = &players[0]; h < MAXPLAYER; h++, j++) {
+                if (j->p_status == PFREE) continue;
+		if (j->p_flags & PFCLOAK) {
+			j->p_flags &= ~PFCLOAK;
+			// players[i].p_cloakphase--;
+		}
+	}
+}
+
+static void gloat_conquer_parade()
+{
+	int i, h;
+	struct player *j;
+
+	for (i = 0, h = 0, j = &players[0]; h < MAXPLAYER; h++, j++) {
+                if (j->p_status == PFREE) continue;
+		if (j->p_no == gloat_player) continue;
+		i++;
+	}
+	for (h = 0, j = &players[0]; h < MAXPLAYER; h++, j++) {
+                if (j->p_status == PFREE) continue;
+		if (j->p_no == gloat_player) continue;
+		j->p_dir = h*256/i;
+		j->p_desdir = j->p_dir;
+		j->p_x = planets[gloat_planet].pl_x + (ORBDIST * 5)
+                        * Cos[(u_char) (j->p_dir - (u_char) 64)];
+		j->p_y = planets[gloat_planet].pl_y + (ORBDIST * 5)
+                        * Sin[(u_char) (j->p_dir - (u_char) 64)];
+	}
+}
+
+static void gloat_conquer_kill()
+{
+	int h;
+	struct player *j;
+
+	for (h = 0, j = &players[0]; h < MAXPLAYER; h++, j++) {
+                if (j->p_status == PFREE) continue;
+#ifdef NEWBIESERVER
+                /* Don't kill newbie robot. */
+                if (status->gameup & GU_NEWBIE && j->p_flags & PFROBOT) continue;
+#endif
+#ifdef PRETSERVER
+                /* Don't kill pre-T robot. */
+                if (status->gameup & GU_PRET && j->p_flags & PFROBOT) continue;
+#endif
+                j->p_status = PEXPLODE;
+                j->p_whydead = KWINNER;
+                j->p_whodead = gloat_player;
+                if (j->p_ship.s_type == STARBASE)
+			j->p_explode = 2*SBEXPVIEWS/PLAYERFUSE;
+                else
+			j->p_explode = 10/PLAYERFUSE;
+                j->p_ntorp = 0;
+                j->p_nplasmatorp = 0;
+	}
+}
+
+static void gloat_conquer_reset()
+{
+	int i;
+
+	doResources();
+	ERROR(2,("Resetting galaxy after Conquer.\n"));
+	for (i = 0; i <= MAXTEAM; i++) {
+                teams[i].s_turns = 0;
+                teams[i].s_surrender = 0;
+	}
+}
+
+static void gloat_conquer_timer()
+{
+	gloat_timer--;
+	if (gloat_timer == GLOAT_TIMER_DECLOAK)
+		gloat_conquer_decloak();
+	if (gloat_timer == GLOAT_TIMER_PARADE)
+		gloat_conquer_parade();
+	if (gloat_timer == GLOAT_TIMER_GOODBYE)
+		pmessage(0, MALL, "GOD->ALL", "Goodbye.");
+	if (gloat_timer > 0) return;
+	
+	status->gameup &= ~(GU_PAUSED|GU_GLOAT_CONQUER);
+	gloat_conquer_kill();
+	gloat_conquer_reset();
+}
 
 /* This function is called when a planet has been taken over.
    It checks all the planets to see if the victory conditions
@@ -3768,35 +3868,12 @@
 
     for (i = 0; i < 4; i++) {
         if (team[1<<i] >= VICTORY) {
-            /* We have a winning team */
             conquerMessage(winner->p_team);
-            for (h = 0, j = &players[0]; h < MAXPLAYER; h++, j++) {
-                if (j->p_status == PFREE) continue;
-#ifdef NEWBIESERVER
-                /* Don't kill newbie robot. */
-                if (status->gameup & GU_NEWBIE && j->p_flags & PFROBOT) continue;
-#endif
-#ifdef PRETSERVER
-                /* Don't kill pre-T robot. */
-                if (status->gameup & GU_PRET && j->p_flags & PFROBOT) continue;
-#endif
-                j->p_status = PEXPLODE;
-                j->p_whydead = KWINNER;
-                j->p_whodead = winner->p_no;
-                if (j->p_ship.s_type == STARBASE)
-                    j->p_explode = 2*SBEXPVIEWS/PLAYERFUSE;
-                else
-                    j->p_explode = 10/PLAYERFUSE;
-                j->p_ntorp = 0;
-                j->p_nplasmatorp = 0;
-            }
-            doResources();
-            ERROR(2,("Resetting galaxy after Conquer.\n"));
-            for (i = 0; i <= MAXTEAM; i++) {
-                teams[i].s_turns = 0;
-                teams[i].s_surrender = 0;
-            }
-            return 1;
+	    status->gameup |= GU_GLOAT_CONQUER|GU_PAUSED;
+	    gloat_player = winner->p_no;
+	    gloat_planet = winner->p_planet;
+	    gloat_timer = GLOAT_TIMER_BEGIN;
+	    return 1;
         }
     }
     return 0;
@@ -4213,7 +4290,7 @@
     for (i = 0, j = &players[0]; i < MAXPLAYER; i++, j++) {
         if (j->p_team != team || j->p_status == PFREE) continue;
 #ifdef GENO_COUNT
-        if (type==KWINNER) j->p_stats.st_genos++;
+        if (type == KWINNER) j->p_stats.st_genos++;
 #endif
         if (type == KGENOCIDE) {
             planets=j->p_genoplanets;