Date:	Monday July 7, 2003 @ 17:19
Author:	ahn

Update of /home/netrek/cvsroot/Vanilla/ntserv
In directory swashbuckler.real-time.com:/var/tmp/cvs-serv701/ntserv

Modified Files:
	daemonII.c data.c getentry.c getpath.c interface.c queue.c 
	socket.c solicit.c 
Log Message:
* Pre-T mode enhancement from Nick Slager, enabled by default.  See
  RGN for details.



****************************************

Index: Vanilla/ntserv/daemonII.c
diff -u Vanilla/ntserv/daemonII.c:1.38 Vanilla/ntserv/daemonII.c:1.39
--- Vanilla/ntserv/daemonII.c:1.38	Mon Nov 25 00:05:03 2002
+++ Vanilla/ntserv/daemonII.c	Mon Jul  7 17:19:55 2003
@@ -328,6 +328,10 @@
 
     if (practice_mode) return(0);     /* No t-mode in practice mode 
                                          06/19/94 [007] */
+#ifdef PRETSERVER    
+    if(bot_in_game) return(0);
+#endif
+    
     MZERO((int *) teams, sizeof(int) * (MAXTEAM + 1));
     for (i=0, p=players; i<MAXPLAYER; i++, p++) {
         if (((p->p_status != PFREE) && 
@@ -2858,6 +2862,9 @@
     if (!(status->gameup & GU_INROBOT)) {
       if (((tcount[l->pl_owner] == 0) || (NotTmode(ticks))) && 
 	(l->pl_flags & l->pl_owner) &&
+#ifdef PRETSERVER
+    !bot_in_game &&
+#endif
 	tm_robots[l->pl_owner] == 0) {
 
 	rescue(l->pl_owner, NotTmode(ticks));
@@ -3048,7 +3055,11 @@
 
                             /* out of Tmode?  Terminate.  8/2/91 TC */
 
-                            if (NotTmode(ticks)) {
+                            if (NotTmode(ticks)
+#ifdef PRETSERVER
+                                && !bot_in_game
+#endif
+                                ) {
                                 if ((l->pl_flags & (FED|ROM|KLI|ORI)) !=
                                     j->p_team) /* not in home quad, give them an extra one 8/26/91 TC */
                                     rescue(STERMINATOR, j->p_no);
@@ -3683,6 +3694,10 @@
                 /* 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;
@@ -4178,6 +4193,12 @@
         case NEWBIE_ROBOT:
                 execl(Newbie, "newbie", 0);
                 perror(Newbie);
+                break;
+#endif
+#ifdef PRETSERVER
+        case PRET_ROBOT:
+                execl(PreT, "pret", 0);
+                perror(PreT);
                 break;
 #endif
 #ifdef DOGFIGHT
Index: Vanilla/ntserv/data.c
diff -u Vanilla/ntserv/data.c:1.18 Vanilla/ntserv/data.c:1.19
--- Vanilla/ntserv/data.c:1.18	Thu May 10 05:37:11 2001
+++ Vanilla/ntserv/data.c	Mon Jul  7 17:19:55 2003
@@ -1,4 +1,4 @@
-/* $Id: data.c,v 1.18 2001/05/10 10:37:11 quisar Exp $
+/* $Id: data.c,v 1.19 2003/07/07 22:19:55 ahn Exp $
  */
 
 #include "copyright.h"
@@ -267,7 +267,10 @@
 #ifdef NEWBIESERVER
 char Newbie[FNAMESIZE];
 #endif
-#if defined(BASEPRACTICE) || defined(NEWBIESERVER)
+#ifdef PRETSERVER
+char PreT[FNAMESIZE];
+#endif
+#if defined(BASEPRACTICE) || defined(NEWBIESERVER)  || defined(PRETSERVER)
 char Robodir[FNAMESIZE];
 char robofile[FNAMESIZE];
 char robot_host[FNAMESIZE];
Index: Vanilla/ntserv/getentry.c
diff -u Vanilla/ntserv/getentry.c:1.8 Vanilla/ntserv/getentry.c:1.9
--- Vanilla/ntserv/getentry.c:1.8	Thu Oct 26 05:06:14 2000
+++ Vanilla/ntserv/getentry.c	Mon Jul  7 17:19:55 2003
@@ -299,7 +299,7 @@
             nextlargest = np[i];
             inl = 1 << i;
         }
-        if (deadTeam(1 << i) || (np[i] >= 8))
+        if (deadTeam(1 << i) || (np[i] >= 8) || (bot_in_game && np[i] >=  4))
             allteams &= ~ (1 <<i);
     }
     if (nodiag) {
@@ -308,7 +308,7 @@
                rem >>= 4;
       allteams &= ~rem; 
       }
-    if (! status -> tourn)
+    if((pre_t_mode && inl == 0) || (!pre_t_mode && !status->tourn))
       return allteams;
     /*
      * We think we are in t-mode and go for re-entry.  
Index: Vanilla/ntserv/getpath.c
diff -u Vanilla/ntserv/getpath.c:1.5 Vanilla/ntserv/getpath.c:1.6
--- Vanilla/ntserv/getpath.c:1.5	Tue May  1 21:00:19 2001
+++ Vanilla/ntserv/getpath.c	Mon Jul  7 17:19:55 2003
@@ -86,7 +86,11 @@
    sprintf(Newbie,"%s/%s",path,N_NEWBIE);
 #endif
 
-#if defined(BASEPRACTICE) || defined(NEWBIESERVER)
+#ifdef PRETSERVER
+   sprintf(PreT,"%s/%s",path,N_PRET);
+#endif
+
+#if defined(BASEPRACTICE) || defined(NEWBIESERVER) || defined(PRETSERVER)
    sprintf(Robodir,"%s/%s",path,N_ROBODIR);
 #endif
 
Index: Vanilla/ntserv/interface.c
diff -u Vanilla/ntserv/interface.c:1.11 Vanilla/ntserv/interface.c:1.12
--- Vanilla/ntserv/interface.c:1.11	Thu Feb  7 04:48:35 2002
+++ Vanilla/ntserv/interface.c	Mon Jul  7 17:19:55 2003
@@ -86,19 +86,36 @@
 	return;
     }
 
-    if(restrict_bomb) {
+    if(restrict_bomb
+#ifdef PRETSERVER
+            /* if this is the pre-T entertainment we don't require confirmation */
+            && !bot_in_game 
+#endif
+        ) {
         if (!status->tourn){
             new_warning(UNDEF,"You may not bomb out of T-mode.");
           return;
         }
     }
 
-    if ((!status->tourn) && (bombsOutOfTmode == 0)) {
+    if ((!status->tourn) && (bombsOutOfTmode == 0)
+#ifdef PRETSERVER
+            /* if this is the pre-T entertainment we don't require confirmation */
+            && !bot_in_game 
+#endif
+        ) {
         new_warning(42,"Bomb out of T-mode?  Please verify your order to bomb.");
         bombsOutOfTmode++;
         return;
     }
 
+#ifdef PRETSERVER
+    if(bot_in_game && realNumShips(owner) == 0) {
+        new_warning(UNDEF,"You may not bomb 3rd and 4th space planets.");
+        return;
+    }
+#endif
+
     if(no_unwarring_bombing) {
 /* Added ability to take back your own planets from 3rd team 11-15-93 ATH */
         if ((status->tourn && realNumShips(owner) < tournplayers) 
@@ -108,12 +125,17 @@
          }
     }
 
-    if(! restrict_bomb)
+    if(! restrict_bomb
+#ifdef PRETSERVER
+            /* if this is the pre-T entertainment we don't require confirmation */
+            && !bot_in_game 
+#endif
+        )
     {
         if ((!status->tourn) && (bombsOutOfTmode == 1)) {
             new_warning(43,"Hoser!");
-	    bombsOutOfTmode++;
-	}
+            bombsOutOfTmode++;
+        }
     }
 
     if (status->tourn) bombsOutOfTmode = 0;
@@ -145,15 +167,28 @@
 
 void beam_down(void)
 {
+    int owner;
+
     if (!(me->p_flags & (PFORBIT | PFDOCK))) {
         new_warning(47, "Must be orbiting or docked to beam down.");
-	return;
+        return;
     }
+
+#ifdef PRETSERVER
+    if(pre_t_mode && me->p_flags & PFORBIT) {
+        owner = planets[me->p_planet].pl_owner;
+        if(bot_in_game && realNumShips(owner) == 0 && owner != NOBODY) {
+            new_warning(UNDEF,"You may not drop on 3rd and 4th space planets. Sorry Bill.");
+            return;
+        }
+    }
+#endif
+
     if (me->p_flags & PFDOCK) {
-	if (me->p_team != players[me->p_docked].p_team) {
+        if (me->p_team != players[me->p_docked].p_team) {
             new_warning(48,"Comm Officer: Starbase refuses permission to beam our troops over.");
 	    return;
-	}
+        }
     }
     me->p_flags |= PFBEAMDOWN;
     me->p_flags &= ~(PFSHIELD | PFREPAIR | PFBOMB | PFBEAMUP);
Index: Vanilla/ntserv/queue.c
diff -u Vanilla/ntserv/queue.c:1.8 Vanilla/ntserv/queue.c:1.9
--- Vanilla/ntserv/queue.c:1.8	Mon Dec  9 01:08:39 2002
+++ Vanilla/ntserv/queue.c	Mon Jul  7 17:19:55 2003
@@ -169,6 +169,39 @@
     queues[QU_NEWBIE_DMN].q_flags = QU_OPEN;
     queue_setname(QU_NEWBIE_DMN, "newbie daemon");
 #endif
+#ifdef PRETSERVER
+    queues[QU_PRET_PLR].free_slots = MAXPLAYER - TESTERS;
+    queues[QU_PRET_PLR].max_slots = MAXPLAYER - TESTERS;
+    queues[QU_PRET_PLR].tournmask = ALLTEAM;
+    queues[QU_PRET_PLR].low_slot = 0;
+    queues[QU_PRET_PLR].high_slot = MAXPLAYER - TESTERS;
+    queues[QU_PRET_PLR].q_flags = QU_OPEN|QU_RESTRICT;
+    queue_setname(QU_PRET_PLR, "preT player");
+
+    queues[QU_PRET_BOT].free_slots = MAXPLAYER - TESTERS;
+    queues[QU_PRET_BOT].max_slots = MAXPLAYER - TESTERS;
+    queues[QU_PRET_BOT].tournmask = ALLTEAM;
+    queues[QU_PRET_BOT].low_slot = (MAXPLAYER - TESTERS) / 2;
+    queues[QU_PRET_BOT].high_slot = MAXPLAYER - (TESTERS / 2);
+    queues[QU_PRET_BOT].q_flags = QU_OPEN;
+    queue_setname(QU_PRET_BOT, "preT robot");
+
+    queues[QU_PRET_OBS].free_slots = (MAXPLAYER - TESTERS) / 2 - 1;
+    queues[QU_PRET_OBS].max_slots = (MAXPLAYER - TESTERS) / 2 - 1;
+    queues[QU_PRET_OBS].tournmask = ALLTEAM;
+    queues[QU_PRET_OBS].low_slot = MAXPLAYER - (TESTERS / 2);
+    queues[QU_PRET_OBS].high_slot = MAXPLAYER - 1;
+    queues[QU_PRET_OBS].q_flags = QU_OPEN|QU_RESTRICT|QU_OBSERVER;
+    queue_setname(QU_PRET_OBS, "preT observer");
+
+    queues[QU_PRET_DMN].free_slots = 1;
+    queues[QU_PRET_DMN].max_slots = 1;
+    queues[QU_PRET_DMN].tournmask = ALLTEAM;
+    queues[QU_PRET_DMN].low_slot = MAXPLAYER - 1;
+    queues[QU_PRET_DMN].high_slot = MAXPLAYER;
+    queues[QU_PRET_DMN].q_flags = QU_OPEN;
+    queue_setname(QU_PRET_DMN, "preT daemon");
+#endif
 
     return 1;
 }
Index: Vanilla/ntserv/socket.c
diff -u Vanilla/ntserv/socket.c:1.33 Vanilla/ntserv/socket.c:1.34
--- Vanilla/ntserv/socket.c:1.33	Fri Feb 21 02:33:36 2003
+++ Vanilla/ntserv/socket.c	Mon Jul  7 17:19:55 2003
@@ -1,4 +1,4 @@
-/* $Id: socket.c,v 1.33 2003/02/21 08:33:36 cameron Exp $
+/* $Id: socket.c,v 1.34 2003/07/07 22:19:55 ahn Exp $
  */
 
 /*
@@ -100,7 +100,7 @@
 static void handleThresh(struct threshold_cpacket *packet);
 static void handleSMessageReq(struct mesg_s_cpacket *packet);
 
-#if defined(BASEPRACTICE) || defined(NEWBIESERVER)
+#if defined(BASEPRACTICE) || defined(NEWBIESERVER) || defined(PRETSERVER)
 static void handleOggV(struct oggv_cpacket *packet);
 #endif
 #ifdef FEATURE_PACKETS
@@ -200,7 +200,7 @@
     { 0, NULL },					   /* 47 */
     { 0, NULL },					   /* 48 */
     { 0, NULL },					   /* 49 */
-#if defined(BASEPRACTICE) || defined(NEWBIESERVER)
+#if defined(BASEPRACTICE) || defined(NEWBIESERVER) || defined(PRETSERVER)
     { sizeof(struct oggv_cpacket), handleOggV },           /* CP_OGGV */
 #else
     { 0, NULL },					   /* 50 */
@@ -2029,7 +2029,7 @@
 }
 #endif /*PING*/
 
-#if defined(BASEPRACTICE) || defined(NEWBIESERVER)
+#if defined(BASEPRACTICE) || defined(NEWBIESERVER) || defined(PRETSERVER)
 /* these are sent by the robots when a parameter changes */
 static void handleOggV(struct oggv_cpacket *packet)
 {
Index: Vanilla/ntserv/solicit.c
diff -u Vanilla/ntserv/solicit.c:1.18 Vanilla/ntserv/solicit.c:1.19
--- Vanilla/ntserv/solicit.c:1.18	Tue Jul 11 08:49:12 2000
+++ Vanilla/ntserv/solicit.c	Mon Jul  7 17:19:55 2003
@@ -224,6 +224,14 @@
                 else
                     nplayers++;
             }
+	else if (status->gameup & GU_PRET)
+            for (j = 0; j < queues[QU_PRET_PLR].high_slot; j++)
+            {
+                if (players[j].p_status == PFREE)
+                    nfree++;
+                else
+                    nplayers++;
+            }
         else
             for (j = 0; j < queues[QU_PICKUP].high_slot; j++)
             {
@@ -239,6 +247,8 @@
 	{
       if (status->gameup & GU_NEWBIE)
           nfree = -queues[QU_NEWBIE_PLR].count;
+      else if (status->gameup & GU_PRET)
+          nfree = -queues[QU_PRET_PLR].count;
       else
           nfree = -queues[QU_PICKUP].count;
 	  gamefull++;

_______________________________________________
vanilla-devel mailing list
vanilla-devel at us.netrek.org
https://mailman.real-time.com/mailman/listinfo/vanilla-devel