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

Modified Files:
	players.c xtkill.c 
Log Message:
misc working updates

Index: xtkill.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/tools/xtkill.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- xtkill.c	2 Jan 2006 20:10:48 -0000	1.3
+++ xtkill.c	10 Apr 2006 04:24:51 -0000	1.4
@@ -110,10 +110,6 @@
       players[player].p_hostile &= ~team;
       players[player].p_swar &= ~team;
       players[player].p_war &= ~team;
-      sprintf(buf, "GOD->ALL  Change:  %2s is now a %s.",
-	      players[player].p_mapchars,
-	      names[team]);
-      _pmessage(buf, 0, MALL);
       sprintf(players[player].p_mapchars, "%c%c", 
 	      teamlet[players[player].p_team], shipnos[player]);
       sprintf(players[player].p_longname, "%s (%s)", 
@@ -200,10 +196,10 @@
       players[player].p_swar = 0;
       players[player].p_war = 0;
       players[player].p_team = 0;	/* indep */
-      players[player].p_ship.s_type = STARBASE;
+      players[player].p_ship.s_type = SCOUT;
       players[player].p_ship.s_mass = 200;
       players[player].p_ship.s_repair = 30000;
-      players[player].p_ship.s_maxspeed = 0;
+      break;
     case 'S':		/* super ship */
       players[player].p_ship.s_maxshield = 750;
       players[player].p_shield = 750;
@@ -217,9 +213,6 @@
 	players[player].p_stats.st_rank++;
 
       --players[player].p_stats.st_rank;
-      sprintf(buf, "GOD->ALL  %2s was (temporarily) demoted for rank normalization purposes.",
-	      players[player].p_mapchars);
-      _pmessage(buf, 0, MALL);
       break;
     case 'P':		/* promote, but not beyond admiral */
       if( players[player].p_stats.st_rank < (NUMRANKS - 1) ) 
@@ -241,7 +234,42 @@
       players[player].p_shield = 0;
       players[player].p_damage = players[player].p_ship.s_maxdamage/2;
       break;
-    case 'u':
+    case 'H':           /* hack */
+      {
+      struct player *me = &players[player];
+      /* make independent and hostile to only prior team */
+      int team = players[player].p_team;
+      players[player].p_hostile = team;
+      players[player].p_swar = team;
+      players[player].p_war = team;
+      players[player].p_team = 0;
+      sprintf(players[player].p_mapchars, "%c%c", 
+	      teamlet[players[player].p_team], shipnos[player]);
+      sprintf(players[player].p_longname, "%s (%s)", 
+	      players[player].p_name, players[player].p_mapchars);
+      /* cripple */
+      players[player].p_shield = 0;
+      players[player].p_damage = players[player].p_ship.s_maxdamage/2;
+      /* raise shields */
+      players[player].p_flags |= PFSHIELD;
+      players[player].p_flags &= ~(PFBOMB | PFREPAIR | PFBEAMUP | PFBEAMDOWN);
+      /* break tractors and decloak */
+      me->p_flags &= ~(PFTRACT | PFPRESS);
+      me->p_flags &= ~PFCLOAK;
+      /* set speed 0 */
+      me->p_desspeed = 0;
+      if (me->p_flags & PFDOCK) {
+	players[me->p_docked].p_docked--;
+	players[me->p_docked].p_port[me->p_port[0]] = VACANT;
+      }
+      me->p_flags &= ~(PFREPAIR | PFBOMB | PFORBIT | PFDOCK | PFBEAMUP | PFBEAMDOWN);
+      /* make unable to act */
+      players[player].p_flags |= PFTWARP;
+      /* show as puck */
+      players[player].p_ship.s_type = SCOUT;
+      }
+      break;
+    case 'u':           /* raise shields */
       players[player].p_flags |= PFSHIELD;
       players[player].p_flags &= ~(PFBOMB | PFREPAIR | PFBEAMUP | PFBEAMDOWN);
       break;
@@ -305,6 +333,7 @@
       (no mode == obliterate)\n\
       s(hip class change)[abcdosA]  (A = ATT)\n\
       t(eleport to quadrant)[frkoc] (c = center of galaxy)\n\
+      p(uck)                        (harmless little thing)\n\
       S(uper)                       (big shields/max damage/max etmp)\n\
       T(eam change)[frko]           (no team == independent)\n\
       D(emote)                      (-1 to rank)\n\

Index: players.c
===================================================================
RCS file: /cvsroot/netrek/server/Vanilla/tools/players.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- players.c	22 Feb 2006 09:18:30 -0000	1.3
+++ players.c	10 Apr 2006 04:24:51 -0000	1.4
@@ -11,10 +11,10 @@
 
 extern int openmem(int);
 
-int mode=0;
+int mode = 0;
 static char *ships[] = {"SC", "DD", "CA", "BB", "AS", "SB"};
 static char *statnames[] = {"F", "O", "A", "E", "D"};
-static int out = 1;        /* stdout for non-socket connections */
+static int fd = 1;        /* stdout for non-socket connections */
 
 /* forward function declarations */
 static void udp();
@@ -32,8 +32,9 @@
     char *fixed_name;
  
     if (argc>1) {
-	mode= *(argv[1]);
-	out = 0;
+	mode = *(argv[1]);
+	/* if stdin is not a tty, assume it is a socket */
+	if (!isatty(0)) fd = 0;
     }
 
     if (mode == 'u') { udp(); exit(0); }
@@ -313,17 +314,16 @@
 
 static void output(const char *fmt, ...)
 {
-   va_list args;
-   va_start(args, fmt);
+  va_list args;
+  va_start(args, fmt);
 
-   if(out == 1){
-      vfprintf(stdout, fmt, args);
-   }
-   else {
-      char      buf[512];
-      vsprintf(buf, fmt, args);
-      write(out, buf, strlen(buf));
-   }
-   va_end(args);
+  if (fd == 1) {
+    vfprintf(stdout, fmt, args);
+  } else {
+    char      buf[512];
+    vsnprintf(buf, 511, fmt, args);
+    write(fd, buf, strlen(buf));
+  }
+  va_end(args);
 }