Vanilla Development Maling List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CVS update: Vanilla/robots



Date:	Thursday June 17, 1999 @ 2:46
Author:	unbelver

Update of /home/netrek/cvsroot/Vanilla/robots
In directory cvs.castle.real-time.com:/var/tmp/cvs-serv6977

Modified Files:
	inlcomm.c 
Log Message:

These two bug reports fixed:

INL robot problems reported by fugitive@ugcs.caltech.edu

        - observers cannot become captain, they are told to choose a
          team first.  (Code in inlcomm.c check_player())

INL robot problems reported by sheldon@visi.com

        - one team set gametime and armies, but the other team did not,
          and yet the game still started.

The second item had a code snippet to check gametime, but was
#ifdef'ed out.  The army check was a simple copy of the time check.

It looked like this used to be the case.  It now checks to make sure
the numbers are the same, so there will be no warning if both captains
leave it at the default values.



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

Index: Vanilla/robots/inlcomm.c
diff -u Vanilla/robots/inlcomm.c:1.9 Vanilla/robots/inlcomm.c:1.10
--- Vanilla/robots/inlcomm.c:1.9	Fri May 28 08:35:12 1999
+++ Vanilla/robots/inlcomm.c	Thu Jun 17 02:46:14 1999
@@ -14,6 +14,7 @@
 #include <sys/resource.h>
 #include <signal.h>
 #include <setjmp.h>
+#include <varargs.h>
 #include <sys/file.h>
 #include <sys/wait.h>
 #include <sys/ipc.h>
@@ -42,13 +43,16 @@
 check_player(who, captain)
      int who, captain;
 {
-  int c,  num=-1;
+  int c,  num = NONE;
 
 #ifdef INLDEBUG
   ERROR(2,("	Enter check_player\n"));
 #endif
 
-  if ((players[who].w_queue != QU_HOME) && (players[who].w_queue != QU_AWAY))
+  if ((players[who].w_queue != QU_HOME) && 
+      (players[who].w_queue != QU_AWAY) &&
+      (players[who].w_queue != QU_HOME_OBS) && 
+      (players[who].w_queue != QU_AWAY_OBS) )
     {
       pmessage(who, MINDIV, addr_mess(who, MINDIV),
 	       "You are not on a team. Send yourself 'HOME' or 'AWAY'");
@@ -63,7 +67,7 @@
 	  break;
 	}
     }
-  if (num == -1)
+  if (num == NONE)
     {
       pmessage(who, MINDIV, addr_mess(who, MINDIV),
 	       "You need to pick a team first.");
@@ -223,7 +227,7 @@
 
   if (begin != 2) return 1;
 
-#ifdef nodef
+  /* #ifdef nodef */  /* why was this nodef here? */
   if ((inl_teams[HOME].time != inl_teams[AWAY].time ) ||
       (inl_teams[HOME].overtime != inl_teams[AWAY].overtime))
     {
@@ -238,8 +242,22 @@
 	}
       return 0;
     }
-#endif
+  /* #endif */
 
+  if (inl_teams[HOME].start_armies != inl_teams[AWAY].start_armies)
+    {
+      pmessage(0, MALL, inl_from,
+               "The initial army count has not be approved by both sides!");
+      for (c = 0; c < INLTEAM; c++)
+        {
+          pmessage(0, MALL, inl_from,
+                   "%s (%s) has set %d armies",
+                   inl_teams[c].t_name, inl_teams[c].name,
+                   inl_teams[c].start_armies);
+        }
+      return 0;
+    }
+
   for (c=0; c < INLTEAM; c++)
     inl_teams[c].flags &= ~T_START;
 
@@ -302,13 +320,9 @@
 	       inl_teams[HOME].planets, inl_teams[AWAY].planets,
 	       (20 - inl_teams[HOME].planets - inl_teams[AWAY].planets));
 #else
-      {
-	int seconds = ( (time - inl_stat.game_ticks) / PERSEC ) % 60;
-	int minutes = ( (time - inl_stat.game_ticks) / PERMIN );
-
-	pmessage(who, MINDIV, addr_mess(who, MINDIV),
-		 "Time remaining: %d:%02.2d", minutes, seconds);
-      }
+      pmessage(who, MINDIV, addr_mess(who, MINDIV),
+	       "Minutes remaining: %i",
+	       ((time - inl_stat.game_ticks) / PERMIN ));
 #endif
 
       return 1;