Date:	Friday February 2, 2001 @ 3:17
Author:	cameron

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

Modified Files:
	enter.c interface.c main.c ntscmds.c orbit.c struct.h 
Log Message:
	* ntserv/orbit.c (dock): reworked handling of return status,
	probably in a superfluous manner, but I've tested the various
	conditions now.

	* ntserv/struct.h, ntserv/ntscmds.c (do_nodock), ntserv/main.c
	(main), ntserv/enter.c (enter): change candock to p_candock to
	comply with convention.

	* ntserv/interface.c (lock_player): only mention docking status on
	a lock if the player is permitted to dock, otherwise treat it as a
	normal lock on a ship.



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

Index: Vanilla/ntserv/enter.c
diff -u Vanilla/ntserv/enter.c:1.9 Vanilla/ntserv/enter.c:1.10
--- Vanilla/ntserv/enter.c:1.9	Wed Jan  3 03:15:19 2001
+++ Vanilla/ntserv/enter.c	Fri Feb  2 03:17:52 2001
@@ -135,7 +135,7 @@
       {
 	me->p_flags |= PFDOCKOK; /* allow docking by default */
 	for(i = 0; i < MAXPLAYER; i++)
-	  players[i].candock = 1; /* give everybody permission to dock */
+	  players[i].p_candock = 1; /* give everybody permission to dock */
       }
     me->p_dir = 0;
     me->p_desdir = 0;
Index: Vanilla/ntserv/interface.c
diff -u Vanilla/ntserv/interface.c:1.8 Vanilla/ntserv/interface.c:1.9
--- Vanilla/ntserv/interface.c:1.8	Tue Aug 15 05:16:28 2000
+++ Vanilla/ntserv/interface.c	Fri Feb  2 03:17:52 2001
@@ -228,7 +228,8 @@
     /* notify player docking perm status of own SB when locking 7/19/92 TC */
 
     if ((players[player].p_team == me->p_team) &&
-	(players[player].p_ship.s_type == STARBASE)) 
+	(players[player].p_ship.s_type == STARBASE) &&
+	(me->p_candock)) 
         {
         if(send_short) {
                 swarning(SBLOCKMYTEAM,player,0);
Index: Vanilla/ntserv/main.c
diff -u Vanilla/ntserv/main.c:1.21 Vanilla/ntserv/main.c:1.22
--- Vanilla/ntserv/main.c:1.21	Wed Jan  3 03:15:19 2001
+++ Vanilla/ntserv/main.c	Fri Feb  2 03:17:52 2001
@@ -404,7 +404,7 @@
     for (i = 0, j = &players[i]; i < MAXPLAYER; i++, j++) 
       j->voting[me->p_no] = -1;
 #endif
-    me->candock = 1;
+    me->p_candock = 1;
     /* Get input until the player quits or dies */
     living++;
     while (living) input();
Index: Vanilla/ntserv/ntscmds.c
diff -u Vanilla/ntserv/ntscmds.c:1.17 Vanilla/ntserv/ntscmds.c:1.18
--- Vanilla/ntserv/ntscmds.c:1.17	Wed Jan  3 16:51:38 2001
+++ Vanilla/ntserv/ntscmds.c	Fri Feb  2 03:17:52 2001
@@ -1,4 +1,4 @@
-/* $Id: ntscmds.c,v 1.17 2001/01/03 22:51:38 unbelver Exp $
+/* $Id: ntscmds.c,v 1.18 2001/02/02 09:17:52 cameron Exp $
  */
 
 /*
@@ -1148,12 +1148,12 @@
 
   if( !strcmp("off", what) )
     {
-      victim->candock = 0;
+      victim->p_candock = 0;
       pmessage(whofrom, MINDIV, addr, "Slot %c no longer allowed to dock to SB", *who);
     }
   else if ( !strcmp("on", what) )
          {
-           victim->candock = 1;
+           victim->p_candock = 1;
            pmessage(whofrom, MINDIV, addr, "Slot %c is allowed to dock to SB", *who);
          }
        else pmessage(whofrom, MINDIV, addr, "dock usage: dock 0 on|off");
Index: Vanilla/ntserv/orbit.c
diff -u Vanilla/ntserv/orbit.c:1.6 Vanilla/ntserv/orbit.c:1.7
--- Vanilla/ntserv/orbit.c:1.6	Fri Feb  2 02:40:44 2001
+++ Vanilla/ntserv/orbit.c	Fri Feb  2 03:17:53 2001
@@ -63,12 +63,12 @@
  * Dock with a ship;
  * assumes it is a base, is alive, and is friendly.
  * (If one or more of these is not true, various nasty things happen.)
- * Returns TRUE if the docking worked, or FALSE if it failed.
- * Changed 3-Jan-2001. Villalpando Returns true if docking failed and 
- * a warning was issued. De-locks you and keeps "no valid targets" warning
- * from clobbering starbase failure warnings.
  */ 
 
+#define DOCK_NO_BASE 0
+#define DOCK_FAILURE 1
+#define DOCK_SUCCESS 2
+
 static int dock(struct player *base)
 {
   LONG dx, dy;
@@ -79,49 +79,49 @@
    * See if I am close enough:  */
   dx = base->p_x - me->p_x;
   if ((dx > DOCKDIST) || (dx < -DOCKDIST))
-    return FALSE;
+    return DOCK_NO_BASE;
   dy = base->p_y - me->p_y;
   if ((dy > DOCKDIST) || (dy < -DOCKDIST))
-    return FALSE;
+    return DOCK_NO_BASE;
   if (dx*dx + dy*dy > DOCKDIST*DOCKDIST)
-    return FALSE;
+    return DOCK_NO_BASE;
 
   /*
    * Can't dock on enemy bases:  */
-  if (! friendlyPlayer(base)) {
+  if (!friendlyPlayer(base)) {
     new_warning(UNDEF, "Docking onto a hostile base is unwise, Captain!");
     de_lock(me);
-    return FALSE;
+    return DOCK_FAILURE;
   }
 
   /*
    * Can't dock if you aren't allowed to */
-  if ( me->candock == 0 ) {
-    new_warning(UNDEF, 
-		"Starbase %s allows everybody else except us to dock, Captain.",
-		base->p_name);
+  if (me->p_candock == 0) {
+    if (send_short)
+      swarning(SBDOCKREFUSE_TEXT, base->p_no, 0);
+    else
+      new_warning(UNDEF, 
+		  "Starbase %s refusing us docking permission, Captain.",
+		  base->p_name);
     de_lock(me);
-    return FALSE;
+    return DOCK_FAILURE;
   }
 
   /* Disallow SB to SB docking */
   if (me->p_ship.s_type == STARBASE) {
     new_warning(UNDEF, "Starbases are too big to dock onto other starbases.");
     de_lock(me);
-    return FALSE;
+    return DOCK_FAILURE;
   }
 
   /*
    * See if the base is allowing docking: */
   if (! (base->p_flags & PFDOCKOK)) {
-    if (send_short)
-      swarning(SBDOCKREFUSE_TEXT, base->p_no, 0);
-    else
-      new_warning(UNDEF, 
-		  "Starbase %s refusing us docking permission, captain.",
-		  base->p_name);
+    new_warning(UNDEF, 
+		"Starbase %s refusing all docking requests, Captain.",
+		base->p_name);
     de_lock(me);
-    return FALSE;
+    return DOCK_FAILURE;
   }
   
   /*
@@ -132,7 +132,7 @@
     else
       new_warning(UNDEF, "Starbase %s: Permission to dock denied, all ports currently occupied.", base->p_name);
     de_lock(me);
-    return FALSE;
+    return DOCK_FAILURE;
   }
 
   /*
@@ -226,7 +226,7 @@
     swarning(ONEARG_TEXT, 2, port_id);
   else
     new_warning(UNDEF,"Helmsman:  Docking manuever completed Captain.  All moorings secured at port %d.", port_id);
-  return TRUE;
+  return DOCK_SUCCESS;
 }
 
 
@@ -285,9 +285,14 @@
 	continue;
       if (! isAlive(j))
 	continue;
-      /* There is!  Try to dock: */
-      if (dock(j))
+      switch (dock(j)) {
+      case DOCK_NO_BASE:
+	break;
+      case DOCK_FAILURE:
 	return;
+      case DOCK_SUCCESS:
+	return;
+      }
     }
   }
 
Index: Vanilla/ntserv/struct.h
diff -u Vanilla/ntserv/struct.h:1.14 Vanilla/ntserv/struct.h:1.15
--- Vanilla/ntserv/struct.h:1.14	Wed Jan  3 03:15:19 2001
+++ Vanilla/ntserv/struct.h	Fri Feb  2 03:17:53 2001
@@ -382,7 +382,7 @@
 #ifdef VOTING
     time_t voting[PV_TOTAL];	/* voting array */
 #endif
-    int candock;                /* is this player allowed to dock onto SB */
+    int p_candock;              /* is this player allowed to dock onto SB */
 };
 
 struct statentry {