home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / games / volume3 / trek73 / part01 / src / cmds2.c < prev    next >
C/C++ Source or Header  |  1987-12-17  |  15KB  |  651 lines

  1. #ident "@(#) TREK73 $Header: cmds2.c,v 1.2 87/10/13 16:00:46 okamoto Exp $"
  2. /*
  3.  * $Source: /ccc/okamoto/src/trek/src/RCS/cmds2.c,v $
  4.  *
  5.  * $Header: cmds2.c,v 1.2 87/10/13 16:00:46 okamoto Exp $
  6.  *
  7.  * $Log:    cmds2.c,v $
  8.  * Revision 1.2  87/10/13  16:00:46  16:00:46  okamoto (Jeff Okamoto)
  9.  * Fixed calls to Gets
  10.  * 
  11.  * Revision 1.1  87/10/09  11:01:38  11:01:38  okamoto (Jeff Okamoto)
  12.  * Initial revision
  13.  * 
  14.  */
  15. /*
  16.  * TREK73: cmds2.c
  17.  *
  18.  * User Commands
  19.  *
  20.  * pos_report, pos_display, pursue, elude, helm, self_scan, scan
  21.  *
  22.  * (print_damages)
  23.  *
  24.  */
  25.  
  26. #include "externs.h"
  27. #include <ctype.h>
  28.  
  29. int
  30. pos_report(sp)
  31. struct ship *sp;
  32. {
  33.     struct    ship *sp1;
  34.     struct    torpedo *tp;
  35.     struct    list *lp;
  36.     int    x, y;
  37.     int    range;
  38.     float    bear;
  39.     float    speed;
  40.     float    course;
  41.     float    relbear;
  42.     float    revrelbear;
  43.     int    maxlen = 0;
  44.     int    incltorp = 0;
  45.     char    whitespace[5], who[80];
  46. #ifdef SHOWTORP
  47.     char    buf[20];
  48. #endif
  49.  
  50. #ifdef SHOWTORP
  51.     printf("%s:  Include torpedoes?\n", science);
  52.     printf("%s:  [yes or no] ", captain);
  53.     (void) Gets(buf, sizeof buf);
  54.     if (buf[0] == 'y' || buf[0] == 'Y')
  55.         incltorp = 1;
  56. #endif
  57.     /*
  58.      * Go through the list of objects and find out the longest
  59.      * name of any of them.  This is to insure that no matter
  60.      * what the names of the ship, the position report will
  61.      * come out formatted.
  62.      */
  63.     for (lp = &head; lp != tail; lp = lp->fwd)
  64.         switch(lp->type) {
  65.         case I_SHIP:
  66.             sp1 = lp->data.sp;
  67.             maxlen = max(maxlen, strlen(sp1->name));
  68.             break;
  69. #ifdef SHOWTORP
  70.         case I_TORPEDO:
  71.             if (!incltorp)
  72.                 break;
  73.             tp = lp->data.tp;
  74.             maxlen = max(maxlen, strlen(tp->from->name) + 8);
  75.             break;
  76. #endif
  77.         case I_PROBE:
  78.             tp = lp->data.tp;
  79.             maxlen = max(maxlen, strlen(tp->from->name) + 9);
  80.             break;
  81.         case I_ENG:
  82.             tp = lp->data.tp;
  83.             maxlen = max(maxlen, strlen(tp->from->name) + 12);
  84.             break;
  85.         }
  86.     maxlen += 2;            /* For "cloaked" column */
  87.     /*
  88.      * Construct a string %ns where n is the length of the
  89.      * longest name.
  90.      */
  91.     (void) sprintf(whitespace, "%%%ds", maxlen);
  92.     /*
  93.      * And print out the position report
  94.      */
  95.     printf(whitespace, " ");
  96.     puts("                     abs           rel   rev rel");
  97.     printf(whitespace, " ");
  98.     puts(" class warp course bearing range bearing bearing");
  99.     for (lp = &head; lp != tail; lp = lp->fwd) {
  100.         if (lp->type == 0)
  101.             continue;
  102.         sp1 = NULL;
  103.         tp = NULL;
  104.         if (lp->type == I_SHIP) {
  105.             sp1 = lp->data.sp;
  106.             if (is_dead(sp1, S_DEAD))
  107.                 continue;
  108.             if (cansee(sp1)) {
  109.                 x = sp1->x;
  110.                 y = sp1->y;
  111.                 speed = sp1->warp;
  112.                 course = sp1->course;
  113.                 /* Reset what we know about his position */
  114.                 sp1->position.x = sp1->x;
  115.                 sp1->position.y = sp1->y;
  116.                 sp1->position.warp = sp1->warp;
  117.                 sp1->position.course = sp1->course;
  118.                 sp1->position.bearing = bearing(sp->x,
  119.                     sp1->x, sp->y, sp1->y);
  120.                 sp1->position.range = rangefind(sp->x,
  121.                     sp1->x, sp->y, sp1->y);
  122.                 (void) sprintf(who, "%.*s  ",
  123.                     sizeof who - 3, sp1->name);
  124.             } else {
  125.                 x = sp1->position.x;
  126.                 y = sp1->position.y;
  127.                 speed = sp1->position.warp;
  128.                 course = sp1->position.course;
  129.                 (void) sprintf(who, "%.*s *",
  130.                     sizeof who - 3, sp1->name);
  131.             }
  132.         } else {
  133.             tp = lp->data.tp;
  134.             if (lp->type == I_TORPEDO && !incltorp)
  135.                 continue;
  136.             x = tp->x;
  137.             y = tp->y;
  138.             speed = tp->speed;
  139.             course = tp->course;
  140.             switch(lp->type) {
  141. #ifdef SHOWTORP
  142.                 case I_TORPEDO:
  143.                     (void) sprintf(who,"%.*s torp %d  ",
  144.                         sizeof who - 11, tp->from->name,
  145.                         tp->id);
  146.                     break;
  147. #endif
  148.                 case I_PROBE:
  149.                     (void) sprintf(who, "%.*s probe %d  ",
  150.                         sizeof who - 12, tp->from->name,
  151.                         tp->id);
  152.                     break;
  153.                 case I_ENG:
  154.                     (void) sprintf(who,"%.*s engineering  ",
  155.                         sizeof who - 15, tp->from->name);
  156.                     break;
  157.                 default:
  158.                     (void) sprintf(who, "lp->type = %d  ",
  159.                         lp->type);
  160.                     break;
  161.             }
  162.         }
  163.         printf(whitespace, who);
  164.         if (sp1)
  165.             printf("%5s", sp1->class);
  166.         else
  167.             printf("     ");
  168.         printf("%6.1f   %3.0f   ", speed, course);
  169.         if (sp1 == sp) {
  170.             if (sp->target != NULL)
  171.                 printf("helm locked on %s", sp->target->name);
  172.             putchar('\n');
  173.         } else {
  174.             bear = bearing(sp->x, x, sp->y, y);
  175.             range = rangefind(sp->x, x, sp->y, y);
  176.             relbear = rectify(round(bear - sp->course));
  177.             revrelbear = rectify(round(bear + 180.0 - course));
  178.             printf(" %3.0f   %5d   %3.0f     %3.0f\n",
  179.                 bear, range, relbear, revrelbear);
  180.         }
  181.     }
  182.     return 0;
  183. }
  184.  
  185.  
  186. int
  187. pos_display(sp)
  188. struct ship *sp;
  189. {
  190.     register int i;
  191.     register int j;
  192.     int    range;
  193.     char    buf1[20];
  194.     int    x, y;
  195.     float    xf, yf;
  196.     int    h, v;
  197.     int     hpitch = 10;
  198.     int    vpitch = 6;
  199.     char    map[13][23];    /* [2*MAXvpitch + 1][2*MAXhpitch + 1] */
  200.     struct    list *lp;
  201.     struct    ship *sp1;
  202.     struct    torpedo *tp;
  203.     char    c;
  204.  
  205.     if (is_dead(sp, S_SENSOR)) {
  206.         printf("%s: Sensors are damaged.\n", science);
  207.         return 0;
  208.     }
  209.     if (!syswork(sp, S_SENSOR)) {
  210.         printf("%s: Sensors are temporarily inoperative.\n",
  211.             science);
  212.         return 0;
  213.     }
  214.     printf("   display to [%d-%d] ", MIN_SENSOR_RANGE, MAX_SENSOR_RANGE);
  215.     (void) Gets(buf1, sizeof(buf1));
  216.     if (buf1[0] == NULL)
  217.         return 0;
  218.     range = atoi(buf1);
  219.     if (range < MIN_SENSOR_RANGE || range > MAX_SENSOR_RANGE)
  220.         return 0;
  221.     /*
  222.      * Compensation for aspect ratio of the output device
  223.      */
  224.     x = range/hpitch;
  225.     y = range/vpitch;
  226.     for (i=0; i<=2*vpitch; i++) {
  227.         if (i == 0 || i == 2*vpitch)
  228.             for(j=0; j<=2*hpitch; j++)
  229.                 map[i][j] = '-';
  230.         else
  231.             for(j=0; j<=2*hpitch; j++)
  232.                 map[i][j] = ' ';
  233.     }
  234.     map[vpitch][hpitch] = '+';
  235.     for (lp = &head; lp != tail; lp = lp->fwd) {
  236.         if (lp->data.sp == sp)
  237.             continue;
  238.         if (lp->type == I_SHIP) {
  239.             sp1 = lp->data.sp;
  240.             if (cansee(sp1)) {
  241.                 /* Update the position */
  242.                 sp1->position.x = sp1->x;
  243.                 sp1->position.y = sp1->y;
  244.                 sp1->position.warp = sp1->warp;
  245.                 sp1->position.course = sp1->course;
  246.                 sp1->position.bearing = bearing(sp->x, x, sp->y, y);
  247.                 sp1->position.range = rangefind(sp->x, x, sp->y, y);
  248.                 xf = sp1->x - sp->x;
  249.                 yf = sp1->y - sp->y;
  250.             } else {
  251.                 xf = sp1->position.x - sp->x;
  252.                 yf = sp1->position.y - sp->y;
  253.             }
  254.         } else {
  255.             tp = lp->data.tp;
  256.             xf = tp->x - sp->x;
  257.             yf = tp->y - sp->y;
  258.         }
  259.         v = yf/y + vpitch + 0.5;
  260.         h = xf/x + hpitch + 0.5;
  261.         if (v < 0 || v > 2*vpitch)
  262.             continue;
  263.         if (h < 0 || h > 2*hpitch)
  264.             continue;
  265.         switch (lp->type) {
  266.             case I_SHIP:
  267.                 c = lp->data.sp->name[0];
  268.                 if (cantsee(lp->data.sp))
  269.                     c = tolower(c);
  270.                 break;
  271.             case I_TORPEDO:
  272.                 c = ':';
  273.                 break;
  274.             case I_ENG:
  275.                 c = '#';
  276.                 break;
  277.             case I_PROBE:
  278.                 c = '*';
  279.                 break;
  280.             default:
  281.                 c = '?';
  282.                 break;
  283.         }
  284.         map[2*vpitch - v][h] = c;
  285.     }
  286.     for (i=0; i<=2*vpitch; i++) {
  287.         for (j=0; j<=2*hpitch; j++)
  288.             if (map[i][j] != ' ')
  289.                 break;
  290.         if (j <= 2*hpitch)
  291.             printf("%.*s", 2*hpitch + 1, map[i]);
  292.         putchar('\n');
  293.     }
  294.     return 0;
  295. }
  296.  
  297.  
  298. int
  299. pursue(sp)
  300. struct ship *sp;
  301. {
  302.     register float i;
  303.     char    buf1[20];
  304.     struct    ship *ep;
  305.     float    warp;
  306.     
  307.     if (is_dead(sp, S_COMP)) {
  308.         printf("%s: Impossible, %s, our computer is dead\n",science ,title);
  309.         return 0;
  310.     }
  311.     if (!syswork(sp, S_COMP)) {
  312.         printf("%s: Main computer down, %s.  Rebooting.\n",
  313.             science, title);
  314.         return 0;
  315.     }
  316.     printf("   Mr. %s, pursue [who] ", nav);
  317.     (void) Gets(buf1, sizeof(buf1));
  318.     if (buf1[0] == NULL)
  319.         return 0;
  320.     ep = ship_name(buf1);
  321.     if (ep == NULL)
  322.         return 0;
  323.     if (cantsee(ep)) {
  324.         printf("%s:  %s, unable to acquire helm lock.\n", nav, title);
  325.         return 0;
  326.     }
  327.     printf("   Mr. %s, warp factor [-%.2f to %.2f] ", helmsman, 
  328.         sp->max_speed, sp->max_speed);
  329.     (void) Gets(buf1, sizeof(buf1));
  330.     if (buf1[0] == NULL)
  331.         return 0;
  332.     warp = atof(buf1);
  333.     if (fabs(warp) > 1.0 && is_dead(sp, S_WARP)) {
  334.         printf("%s: Warp drive is dead, Captain.\n", science);
  335.         warp = (warp < 0.0) ? -1.0 : 1.0;
  336.     }
  337.     if (fabs(warp) > sp->max_speed) {
  338.         printf("%s: %s, the engines canna go that fast!\n",engineer, title);
  339.         warp = (warp < 0.0) ? -sp->max_speed : sp->max_speed;
  340.     }
  341.     sp->newwarp = warp;
  342.     sp->target = ep;
  343.     sp->relbear = 0.0;
  344.     i = bearing(sp->x, ep->x, sp->y, ep->y);
  345.     printf("%s: Aye, %s, coming to course %3.0f.\n", nav, title, i);
  346.     sp->newcourse = i;
  347.     return 1;
  348. }
  349.  
  350.  
  351. int
  352. elude(sp)
  353. struct ship *sp;
  354. {
  355.     register float i;
  356.     char    buf1[20];
  357.     struct    ship *ep;
  358.     float    warp;
  359.  
  360.     if (is_dead(sp, S_COMP)) {
  361.         printf("%s: Impossible, %s, our computer is dead\n",
  362.             science, title);
  363.         return 0;
  364.     }
  365.     if (!syswork(sp, S_COMP)) {
  366.         printf("%s: Main computer down, %s.  Rebooting.\n",
  367.             science, title);
  368.         return 0;
  369.     }
  370.     printf("   Mr. %s, elude [who] ", nav);
  371.     (void) Gets(buf1, sizeof(buf1));
  372.     if (buf1[0] == NULL)
  373.         return 0;
  374.     ep = ship_name(buf1);
  375.     if (ep == NULL)
  376.         return 0;
  377.     if (cantsee(ep)) {
  378.         printf("%s:  %s, unable to acquire helm lock.\n",
  379.             nav, title);
  380.         return 0;
  381.     }
  382.         
  383.     printf("   Mr. %s, warp factor [-%.2f to %.2f] ", helmsman, 
  384.         sp->max_speed, sp->max_speed);
  385.     (void) Gets(buf1, sizeof(buf1));
  386.     if (buf1[0] == NULL)
  387.         return 0;
  388.     warp = (float) atof(buf1);
  389.     if (fabs(warp) > 1.0 && is_dead(sp, S_WARP)) {
  390.         printf("%s: Warp drive is dead, Captain.\n", science);
  391.         warp = (warp < 0.0) ? -1.0 : 1.0;
  392.     }
  393.     if (fabs(warp) > sp->max_speed) {
  394.         printf("%s: %s, the engines canna go that fast!\n",engineer, title);
  395.         warp = (warp < 0.0) ? -sp->max_speed : sp->max_speed;
  396.     }
  397.     sp->newwarp = warp;
  398.     sp->target = ep;
  399.     sp->relbear = 180.0;
  400.     i = bearing(sp->x, ep->x, sp->y, ep->y);
  401.     i = rectify(i + 180.0);
  402.     printf("%s: Aye, %s, coming to course %3.0f.\n", nav, title, i);
  403.     sp->newcourse = i;
  404.     return 1;
  405. }
  406.  
  407. int
  408. helm(sp)
  409. struct ship *sp;
  410. {
  411.     char    buf1[20];
  412.     register float course;
  413.     float    warp;
  414.  
  415.     printf("   Mr. %s, come to course [0-359] ", nav);
  416.     (void) Gets(buf1, sizeof(buf1));
  417.     if (buf1[0] == NULL)
  418.         return 0;
  419.     course = atof(buf1);
  420.     if (course < 0.0 || course >= 360.0)
  421.         return 0;
  422.     printf("   Mr. %s, warp factor [-%.2f to %.2f] ", helmsman, 
  423.         sp->max_speed, sp->max_speed);
  424.     (void) Gets(buf1, sizeof(buf1));
  425.     if (buf1[0] == NULL)
  426.         return 0;
  427.     warp = (float) atof(buf1);
  428.     if (fabs(warp) > 1.0 && is_dead(sp, S_WARP)) {
  429.         printf("%s: Warp drive is dead, Captain.\n", science);
  430.         warp = (warp < 0.0) ? -1.0 : 1.0;
  431.     }
  432.     if (fabs(warp) > sp->max_speed) {
  433.         printf("%s: %s, the engines canna go that fast!\n",engineer, title);
  434.         warp = (warp < 0.0) ? -sp->max_speed : sp->max_speed;
  435.     }
  436.     sp->newwarp = warp;
  437.     sp->newcourse = course;
  438.     sp->target = NULL;
  439.     sp->relbear = 0.0;
  440.     printf("%s: Aye, %s.\n", nav, title);
  441.     printf("%s: Aye, %s.\n", helmsman, title);
  442.     return 1;
  443. }
  444.  
  445. int
  446. self_scan(sp)
  447. struct ship *sp;
  448. {
  449.     (void) print_damage(sp);
  450.     return 1;
  451. }
  452.  
  453. int
  454. scan(sp)
  455. struct ship *sp;
  456. {
  457.     struct    ship *ep = NULL;
  458.     struct    torpedo *tp = NULL;
  459.     struct    list *lp;
  460.     int    item = I_UNDEFINED;
  461.     int    probe_num;
  462.     char    buf1[20];
  463.  
  464.     printf("   %s, scan [who] ", science);
  465.     (void) Gets(buf1, sizeof(buf1));
  466.     if (buf1[0] == NULL)
  467.         return 0;
  468.     if (buf1[0] == '#') {
  469.         strcpy(buf1,buf1+1);
  470.         if (strlen(buf1) == 0) {
  471.             printf("%s: %s, scan whose engineering?\n", science, title);
  472.             return 0;
  473.         }
  474.         ep = ship_name(buf1);
  475.         if (ep == NULL) {
  476.             printf("%s: %s, no such ship as the %s.\n", science, title, buf1);
  477.             return 0;
  478.         }
  479.         for (lp = &head; lp != NULL; lp = lp->fwd) {
  480.             if (lp == tail)
  481.                 break;
  482.             if (lp->type == I_UNDEFINED)
  483.                 continue;
  484.             if (lp->type == I_ENG && lp->data.tp->from == ep) {
  485.                 tp = lp->data.tp;
  486.                 break;
  487.             }
  488.         }
  489.         if (tp == NULL) {
  490.             printf("%s:  %s, the %s has not jettisoned it's engineering.\n",
  491.                 science, title, ep->name);
  492.             return 0;
  493.         }
  494.         item = I_ENG;
  495.     } else if ((probe_num = atoi(buf1)) > 0) {
  496.         for (lp = &head; lp != NULL; lp = lp->fwd) {
  497.             if (lp == tail)
  498.                 break;
  499.             if (lp->type != I_PROBE)
  500.                 continue;
  501.             if (lp->data.tp->id == probe_num) {
  502.                 tp = lp->data.tp;
  503.                 break;
  504.             }
  505.         }
  506.         if (tp == NULL) {
  507.             printf("%s: %s, there is no probe %d", science, title, probe_num);
  508.             return 0;
  509.         }
  510.         item = I_PROBE;
  511.     } else {
  512.         ep = ship_name(buf1);
  513.         if (ep == NULL) {
  514.             printf("%s: %s, no such ship as the %s.\n", science, title, buf1);
  515.             return 0;
  516.         }
  517.         item = I_SHIP;
  518.         if (cantsee(ep)) {
  519.             printf("%s:  %s, I am unable to scan the %s.\n",
  520.                 science, title, ep->name);
  521.             return 0;
  522.         }
  523.     }
  524.     if ((sp != ep) && (is_dead(sp, S_SENSOR))) {
  525.         printf ("%s: The sensors are damaged, Captain.\n",
  526.             science);
  527.         return 0;
  528.     }
  529.     if ((sp != ep) && (!syswork(sp, S_SENSOR))) {
  530.         printf("%s: %s, sensors are temporarily out.\n",
  531.             science, title);
  532.         return 0;
  533.     }
  534.     if ((sp == ep) && (item == I_SHIP)) {
  535.         printf ("%s: Captain, don't you mean 'Damage Report'?\n", science);
  536.         return 0;
  537.     }
  538.     if (item == I_SHIP)
  539.         (void) print_damage(ep);
  540.     else
  541.         (void) scan_torpedo(tp);
  542.     return 1;
  543. }
  544.  
  545. int
  546. print_damage(ep)
  547. struct ship *ep;
  548. {    
  549.     register int i;
  550.     register int j;
  551.     register float k;
  552.  
  553.     printf("\n\nDamages to the %s\n", ep->name);
  554.     for (i=0; i<S_NUMSYSTEMS + 1; i++) {
  555.         if (is_dead(ep, i))
  556.             printf("%s.\n", statmsg[i]);
  557.         else if (ep->status[i] && i < S_NUMSYSTEMS)
  558.             printf("%s damaged %d%%\n", sysname[i], ep->status[i]);
  559.     }
  560.     printf("Survivors: %d\n", ep->complement);
  561.     printf("Helm lock: ");
  562.     if (ep->target == NULL)
  563.         printf("none.\n");
  564.     else
  565.         printf("%s\n",ep->target);
  566.     printf("\nPhasers Control");
  567.     for (i=0; i<ep->num_phasers; i++) {
  568.         if (ep->phasers[i].status & P_DAMAGED)
  569.             printf("\tdamaged");
  570.         else if (ep->phasers[i].target == NULL)
  571.             printf("\tmanual");
  572.         else
  573.             printf("\t%.7s", ep->phasers[i].target->name);
  574.     }
  575.     printf("\n\t turned");
  576.     for (i=0; i<ep->num_phasers; i++)
  577.         if (ep->phasers[i].status & P_DAMAGED)
  578.             printf("\t");
  579.         else if (ep->phasers[i].target == NULL)
  580.             printf("\t%.0f", ep->phasers[i].bearing);
  581.         else
  582.             printf("\tLOCKED");
  583.     printf("\n\t  level");
  584.     for (i=0; i<ep->num_phasers; i++)
  585.         if (ep->phasers[i].status & P_DAMAGED)
  586.             printf("\t");
  587.         else
  588.             printf("\t%-2d", ep->phasers[i].load);
  589.     printf("\n");
  590.     printf("\nTubes\tcontrol");
  591.     for (i=0; i<ep->num_tubes; i++) {
  592.         if (ep->tubes[i].status & T_DAMAGED)
  593.             printf("\tdamaged");
  594.         else if (ep->tubes[i].target == NULL)
  595.             printf("\tmanual");
  596.         else
  597.             printf("\t%.7s", ep->tubes[i].target->name);
  598.     }
  599.     printf("\n\t turned");
  600.     for (i=0; i<ep->num_tubes; i++)
  601.         if (ep->tubes[i].status & T_DAMAGED)
  602.             printf("\t");
  603.         else if (ep->tubes[i].target == NULL)
  604.             printf("\t%.0f", ep->tubes[i].bearing);
  605.         else
  606.             printf("\tLOCKED");
  607.     printf("\n\t  level");
  608.     for (i=0; i<ep->num_tubes; i++)
  609.         if (ep->tubes[i].status & T_DAMAGED)
  610.             printf("\t");
  611.         else
  612.             printf("\t%-2d", ep->tubes[i].load);
  613.     printf("\n");
  614.     printf("\nShields\t levels");
  615.     for (i=0; i<SHIELDS; i++) {
  616.         j = 100 * ep->shields[i].eff * ep->shields[i].drain;
  617.         printf("\t%-2d", j);
  618.     }
  619.     printf("\n\t drains");
  620.     for (i=0; i<SHIELDS; i++) {
  621.         k = ep->shields[i].attemp_drain;
  622.         printf("\t%-4.2f", k);
  623.     }
  624.     printf("\n\nEfficiency: %4.1f\tFuel remaining: %d\n",
  625.         ep->eff, (int)ep->energy);
  626.     printf("Regeneration: %4.1f\tFuel capacity: %d\n",
  627.         ep->regen, (int)ep->pods);
  628.     return 1;
  629. }
  630.  
  631. int
  632. scan_torpedo(pp)
  633. struct torpedo *pp;
  634. {
  635.     char kind[20];
  636.     char tgt[20];
  637.  
  638.     printf("\nobject id time  prox units target\n");
  639.     if (pp->type == TP_PROBE)
  640.         strcpy(kind, "probe");
  641.     else
  642.         strcpy(kind, "engng");
  643.     if (pp->target == NULL)
  644.         strcpy(tgt, "NONE");
  645.     else
  646.         strcpy(tgt, pp->target->name);
  647.     printf("%-7s%2d  %2.1f %4d   %3d   %s\n",
  648.         kind, pp->id, pp->timedelay, pp->prox, pp->fuel, tgt);
  649.     return 1;
  650. }
  651.