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

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

Modified Files:
	data.c data.h decide.c dmessage.c main.c socket.c 
Log Message:
* Pre-T mode enhancement from Nick Slager, enabled by default.  See
  RGN for details.



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

Index: Vanilla/robotd/data.c
diff -u Vanilla/robotd/data.c:1.2 Vanilla/robotd/data.c:1.3
--- Vanilla/robotd/data.c:1.2	Thu Apr 26 18:41:50 2001
+++ Vanilla/robotd/data.c	Mon Jul  7 17:19:56 2003
@@ -155,3 +155,5 @@
 int		no_cloak = 0;
 int		oggv_packet=0;
 int		off=0,def=0;
+
+int     ignoreTMode = 0;
Index: Vanilla/robotd/data.h
diff -u Vanilla/robotd/data.h:1.2 Vanilla/robotd/data.h:1.3
--- Vanilla/robotd/data.h:1.2	Thu Apr 26 18:41:50 2001
+++ Vanilla/robotd/data.h	Mon Jul  7 17:19:56 2003
@@ -159,3 +159,8 @@
 extern int		no_cloak;
 extern int		oggv_packet;
 extern int		off,def;
+
+extern int      ignoreTMode;
+
+/*this is also defined in ../include/data.h*/
+#define PRE_T_ROBOT_LOGIN "Pre_T_Robot!"
Index: Vanilla/robotd/decide.c
diff -u Vanilla/robotd/decide.c:1.2 Vanilla/robotd/decide.c:1.3
--- Vanilla/robotd/decide.c:1.2	Thu Apr 26 18:41:50 2001
+++ Vanilla/robotd/decide.c	Mon Jul  7 17:19:56 2003
@@ -60,9 +60,9 @@
    }
 
    /* no automatic decisions unless t-mode */
-   if(!status->tourn && !_state.itourn)
+   if(!status->tourn && !_state.itourn) {
       return;
-
+   }
 
    /* decide ship and course of action */
    if(_state.dead && !_donedead){
@@ -453,7 +453,9 @@
    
    if(r < 5) return CRUISER;
    if(r < 7) return BATTLESHIP;
-   if(r < 9) return DESTROYER;
+   if(r < 9
+       && strcmp(me->p_login, PRE_T_ROBOT_LOGIN) /* if we're ignoring T we should keep the ships large */
+       ) return DESTROYER;
    return CRUISER;
 }
 
@@ -472,6 +474,9 @@
    struct planet	*defp = NULL, *cp;
    int			armycount = 1;
 
+   if(!strcmp(me->p_login, PRE_T_ROBOT_LOGIN)) 
+      return 0; /* we can't be protecting if we're just maintaining 4 on 4 */
+
    /* would have gotten here if take failed with too few armies */
    if(me->p_armies > 0 && (pls->total_tarmies + me->p_armies < 3)){
       protectp_c(home_planet(), "protect home -- drop armies");
@@ -715,16 +720,18 @@
 	 *ship = ASSAULT;
 
       if(ship){
-	 if((home_dist() < 15000 && me->p_kills < 2 && pls->total_textra_armies > 10) || tpl->pl_armies > 20)
-	    *ship = ASSAULT;
-	 else if((tpl->pl_flags & PLAGRI) && me->p_kills < 2)
-	    *ship = ASSAULT;
-	 else if(me->p_kills >= 2.0 && tpl->pl_armies < 10)
-	    *ship = DESTROYER;
-	 else if(tpl->pl_armies < 10)
-	    *ship = SCOUT;
-	 else
-	    *ship = SCOUT;
+            if((home_dist() < 15000 && me->p_kills < 2 && pls->total_textra_armies > 10) || tpl->pl_armies > 20)
+                  *ship = ASSAULT;
+            else if((tpl->pl_flags & PLAGRI) && me->p_kills < 2)
+                  *ship = ASSAULT;
+            else if(!strcmp(me->p_login, PRE_T_ROBOT_LOGIN)) /* if we're ignoring T we probably should keep ships larger */
+                  *ship = CRUISER;
+            else if(me->p_kills >= 2.0 && tpl->pl_armies < 10)
+                  *ship = DESTROYER;
+            else if(tpl->pl_armies < 10)
+                  *ship = SCOUT;
+            else
+                  *ship = SCOUT;
       }
 
       take_c(tpl, NULL);
@@ -770,6 +777,10 @@
 	       *ship = CRUISER;
 	       break;
 	    case SCOUT:
+             if(!strcmp(me->p_login, PRE_T_ROBOT_LOGIN)) { /* if we're ignoring T we should keep the ships large */
+               *ship = CRUISER;
+               break;
+             }
 	       *ship = DESTROYER;
 	       break;
 	    case CRUISER:
Index: Vanilla/robotd/dmessage.c
diff -u Vanilla/robotd/dmessage.c:1.4 Vanilla/robotd/dmessage.c:1.5
--- Vanilla/robotd/dmessage.c:1.4	Thu Apr 26 18:41:50 2001
+++ Vanilla/robotd/dmessage.c	Mon Jul  7 17:19:56 2003
@@ -237,6 +237,11 @@
    if (inl) return;
 
    if((flags & MINDIV) || std){
+     if(!strcmp(me->p_login, PRE_T_ROBOT_LOGIN)
+         && players[from].p_team != players[to].p_team) {
+       sendMessage("Try pushing around your own team punk.", MINDIV, from);
+       return;
+     }
 
       /* nopwd means accept commands from anyone */
       if(!std && (!nopwd || (nopwd && locked))){
@@ -651,10 +656,15 @@
       else if(strncmp(m, "ogg", 3) == 0){
 	 Player	*p;
 	 eoggtype	ot;
+         char defaultOgg = 'x';
 	 _state.ogg_req = 1;
 	 set_ogg_vars();
 	 p = id_to_player(&m[4], HOSTILE);
-	 ot = oggtype(&m[5]);
+         if(strlen(m) == 5) {
+           ot = oggtype(&defaultOgg);
+         } else {
+	   ot = oggtype(&m[5]);
+         }
 	 if(!p){
 	    response("unknown or friendly player");
 	    _state.ogg_req = 0;
Index: Vanilla/robotd/main.c
diff -u Vanilla/robotd/main.c:1.2 Vanilla/robotd/main.c:1.3
--- Vanilla/robotd/main.c:1.2	Sun Mar  5 10:09:53 2000
+++ Vanilla/robotd/main.c	Mon Jul  7 17:19:56 2003
@@ -26,7 +26,7 @@
 #define TIMEOUT1		50
 #define TIMEOUT2		50
 
-char	revision[] = "$Revision: 1.2 $";
+char	revision[] = "$Revision: 1.3 $";
 
 static   int    first = 1;
 jmp_buf         env;
@@ -264,6 +264,9 @@
 	    oggv_packet = 1;
 	    break;
 
+     case 'I':
+        ignoreTMode = 1;
+        break;
 	 default:
 	    mfprintf(stderr, "%s: unknown option '%c'\n", name, *ptr);
 	    err++;
Index: Vanilla/robotd/socket.c
diff -u Vanilla/robotd/socket.c:1.2 Vanilla/robotd/socket.c:1.3
--- Vanilla/robotd/socket.c:1.2	Thu Apr 26 18:41:50 2001
+++ Vanilla/robotd/socket.c	Mon Jul  7 17:19:56 2003
@@ -1123,7 +1123,11 @@
 #ifdef DEBUG_SCK
     DEBUG_SOCKET("handleStatus");
 #endif DEBUG_SCK
-    status->tourn=packet->tourn;
+    if(ignoreTMode) {
+      status->tourn=1;
+    } else {
+        status->tourn=packet->tourn;
+    }
     status->armsbomb=ntohl(packet->armsbomb);
     status->planets=ntohl(packet->planets);
     status->kills=ntohl(packet->kills);

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