home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / games / volume10 / gb3 / patch2d / patches02a
Text File  |  1990-08-28  |  54KB  |  1,781 lines

  1. *** /usr/cna/billr/games/gb3/README    Fri Jun  1 11:52:49 1990
  2. --- README    Thu Aug 23 14:00:15 1990
  3. ***************
  4. *** 32,38 ****
  5.   then tells the server to do an update. The default update time is 4 hours, 
  6.   but you can change that with 'GB_daemon <hours between updates>'. It is a 
  7.   good idea to make your update times a factor of 24 hours. If you want to
  8. ! force an update just do 'GB_doturn' by itself.
  9.   
  10.   Players cannot enroll by themselves in this version. The game's host
  11.   must do that by running 'GB_enroll' and following the instructions. It
  12. --- 32,38 ----
  13.   then tells the server to do an update. The default update time is 4 hours, 
  14.   but you can change that with 'GB_daemon <hours between updates>'. It is a 
  15.   good idea to make your update times a factor of 24 hours. If you want to
  16. ! force an update just telnet to the server and enter the update password.
  17.   
  18.   Players cannot enroll by themselves in this version. The game's host
  19.   must do that by running 'GB_enroll' and following the instructions. It
  20. ***************
  21. *** 71,73 ****
  22. --- 71,81 ----
  23.   Bill Randle
  24.   billr@saab.CNA.TEK.COM
  25.   6/1/90
  26. + Patchlevel 2 reflects the changes necessary to bring this version up
  27. + to level 1.3.1 client and level 2.2.3 server.
  28. + Bill Randle
  29. + billr@saab.CNA.TEK.COM
  30. + 8/24/90
  31. *** /usr/cna/billr/games/gb3/README_ORIG    Wed May 30 15:10:28 1990
  32. --- README_ORIG    Wed Aug 22 11:42:01 1990
  33. ***************
  34. *** 1,3 ****
  35. --- 1,6 ----
  36. + (Note: This is the README which came along with GB .975 in April 1989 -
  37. +     It is currently outdated and is included for historical interest only - G.vC)
  38.   
  39.       This is a game of interstellar exploration/conquest.  By the time I
  40.   realized there really wasn't going to be much fighting going on in the game, I
  41. *** /usr/cna/billr/games/gb3/server/GB_server.c    Thu May 31 10:10:25 1990
  42. --- server/GB_server.c    Fri Aug 24 15:02:35 1990
  43. ***************
  44. *** 45,51 ****
  45.   #include <netinet/in.h>
  46.   #include <netdb.h>
  47.   
  48. ! /*#include <time.h>    /* included by <sys/time.h> with bsd */
  49.   #include <sys/timeb.h>
  50.   
  51.   #include <curses.h>
  52. --- 45,51 ----
  53.   #include <netinet/in.h>
  54.   #include <netdb.h>
  55.   
  56. ! /*#include <time.h>*/
  57.   #include <sys/timeb.h>
  58.   
  59.   #include <curses.h>
  60. ***************
  61. *** 84,94 ****
  62.   char start_buf[128];
  63.   char update_buf[128];
  64.   
  65. ! static const char *connect_fail = "Connection refused.\n";
  66. ! static const char *create_fail = "Connection refused.\n";
  67. ! static const char *flushed_message = "<Output Flushed>\n";
  68. ! static const char *shutdown_message = "Shutdown ordered by deity - Bye\n";
  69. ! static const char *already_on = "Connection refused.\n";
  70.   
  71.   int errno;
  72.   
  73. --- 84,93 ----
  74.   char start_buf[128];
  75.   char update_buf[128];
  76.   
  77. ! static char *connect_fail = "Connection refused.\n";
  78. ! static char *flushed_message = "<Output Flushed>\n";
  79. ! static char *shutdown_message = "Shutdown ordered by deity - Bye\n";
  80. ! static char *already_on = "Connection refused.\n";
  81.   
  82.   int errno;
  83.   
  84. ***************
  85. *** 134,140 ****
  86.   void welcome_user();
  87.   void check_connect();
  88.   void close_sockets();
  89. ! const char *addrout ();
  90.   void dump_users();
  91.   void set_signals();
  92.   struct descriptor_data *new_connection();
  93. --- 133,139 ----
  94.   void welcome_user();
  95.   void check_connect();
  96.   void close_sockets();
  97. ! char *addrout ();
  98.   void dump_users();
  99.   void set_signals();
  100.   struct descriptor_data *new_connection();
  101. ***************
  102. *** 180,187 ****
  103.   {
  104.   int maim_stardata, s; 
  105.   int i, j, dummy;
  106. - #ifdef BSD4_2
  107.   char zone[16];
  108.   struct timeval tp;
  109.   struct timezone tzp;
  110.   #endif
  111. --- 179,186 ----
  112.   {
  113.   int maim_stardata, s; 
  114.   int i, j, dummy;
  115.   char zone[16];
  116. + #ifdef BSD4_2
  117.   struct timeval tp;
  118.   struct timezone tzp;
  119.   #endif
  120. ***************
  121. *** 222,260 ****
  122.       }
  123.       Putblock(Blocks);
  124.   
  125. ! Num_races = Numraces();
  126. ! /* compute alliance block power */
  127. ! sprintf(Power_blocks.time, "%2d/%2d/%d %02d:%02d:%02d %s", 
  128. !     current_tm->tm_mon+1, current_tm->tm_mday,
  129. !     current_tm->tm_year, current_tm->tm_hour,
  130. !     current_tm->tm_min, current_tm->tm_sec, zone);
  131. !  for (i=1; i<=Num_races; i++) {
  132. !     dummy=(Blocks[i-1].invite & Blocks[i-1].pledge);
  133. !                 Power_blocks.members[i-1] = 0;
  134. !                 Power_blocks.sectors_owned[i-1] = 0;
  135. !                 Power_blocks.popn[i-1] = 0;
  136. !                 Power_blocks.ships_owned[i-1] = 0;
  137. !                 Power_blocks.planets_owned[i-1] = 0;
  138. !                 Power_blocks.resource[i-1] = 0;
  139. !                 Power_blocks.fuel[i-1] = 0;
  140. !                 Power_blocks.destruct[i-1] = 0;
  141. !                 Power_blocks.VPs[i-1] = 0;
  142. !     for(j=1; j<=Num_races; j++) 
  143. !             if(isset(dummy, j)){
  144. !                 Power_blocks.members[i-1] += 1;
  145. !                 Power_blocks.sectors_owned[i-1] += Power[j-1].sectors_owned;
  146. !                 Power_blocks.popn[i-1] += Power[j-1].popn;
  147. !                 Power_blocks.ships_owned[i-1] += Power[j-1].ships_owned;
  148. !                 Power_blocks.planets_owned[i-1] += Power[j-1].planets_owned;
  149. !                 Power_blocks.resource[i-1] += Power[j-1].resource;
  150. !                 Power_blocks.fuel[i-1] += Power[j-1].fuel;
  151. !                 Power_blocks.destruct[i-1] += Power[j-1].destruct;
  152. !                 Power_blocks.VPs[i-1] += Blocks[j-1].VPs;
  153. !             }
  154. !     }
  155.   
  156.       shovechars (argc==1 ? GB_PORT : atoi (argv[1]) );
  157.       close_sockets ();
  158.   printf("Going down.\n");
  159. --- 221,228 ----
  160.       }
  161.       Putblock(Blocks);
  162.   
  163. ! compute_power_blocks();
  164.   
  165.       shovechars (argc==1 ? GB_PORT : atoi (argv[1]) );
  166.       close_sockets ();
  167.   printf("Going down.\n");
  168. ***************
  169. *** 363,369 ****
  170. --- 331,339 ----
  171.           return;
  172.           }
  173.       } else {
  174.           (void) time (&now);
  175.           if (FD_ISSET (sock, &input_set)) {
  176.           if (!(newd = new_connection (sock))) {
  177.               if (errno != EINTR && errno != EMFILE) {
  178. ***************
  179. *** 375,384 ****
  180.               maxd = newd->descriptor + 1;
  181.           }
  182.           }
  183.           for (d = descriptor_list; d; d = dnext) {
  184.           dnext = d->next;
  185.           if (FD_ISSET (d->descriptor, &input_set)) {
  186. !             d->last_time = now;
  187.               if (!process_input (d)) {
  188.                   shutdownsock (d);
  189.                   continue;
  190. --- 345,355 ----
  191.               maxd = newd->descriptor + 1;
  192.           }
  193.           }
  194.           for (d = descriptor_list; d; d = dnext) {
  195.           dnext = d->next;
  196.           if (FD_ISSET (d->descriptor, &input_set)) {
  197. ! /*            d->last_time = now; */
  198.               if (!process_input (d)) {
  199.                   shutdownsock (d);
  200.                   continue;
  201. ***************
  202. *** 390,395 ****
  203. --- 361,367 ----
  204.               }
  205.           }
  206.           }
  207.       }
  208.       }
  209.   }
  210. ***************
  211. *** 460,466 ****
  212.       }
  213.   }
  214.   
  215. ! const char *addrout(a)
  216.   long a;
  217.   {
  218.       static char outbuf[1024];
  219. --- 432,438 ----
  220.       }
  221.   }
  222.   
  223. ! char *addrout(a)
  224.   long a;
  225.   {
  226.       static char outbuf[1024];
  227. ***************
  228. *** 536,542 ****
  229.   }
  230.   
  231.   struct text_block *make_text_block(s, n)
  232. ! const char *s;
  233.   int n;
  234.   {
  235.       struct text_block *p;
  236. --- 508,514 ----
  237.   }
  238.   
  239.   struct text_block *make_text_block(s, n)
  240. ! char *s;
  241.   int n;
  242.   {
  243.       struct text_block *p;
  244. ***************
  245. *** 559,565 ****
  246.   
  247.   void add_to_queue(q, b, n)
  248.   struct text_queue *q;
  249. ! const char *b;
  250.   int n;
  251.   {
  252.       struct text_block *p;
  253. --- 531,537 ----
  254.   
  255.   void add_to_queue(q, b, n)
  256.   struct text_queue *q;
  257. ! char *b;
  258.   int n;
  259.   {
  260.       struct text_block *p;
  261. ***************
  262. *** 598,604 ****
  263.   
  264.   int queue_write(d, b, n)
  265.   struct descriptor_data *d;
  266. ! const char *b;
  267.   int n;
  268.   {
  269.       int space;
  270. --- 570,576 ----
  271.   
  272.   int queue_write(d, b, n)
  273.   struct descriptor_data *d;
  274. ! char *b;
  275.   int n;
  276.   {
  277.       int space;
  278. ***************
  279. *** 613,619 ****
  280.   
  281.   int queue_string(d, s)
  282.   struct descriptor_data *d;
  283. ! const char *s;
  284.   {
  285.       return queue_write (d, s, strlen (s));
  286.   }
  287. --- 585,591 ----
  288.   
  289.   int queue_string(d, s)
  290.   struct descriptor_data *d;
  291. ! char *s;
  292.   {
  293.       return queue_write (d, s, strlen (s));
  294.   }
  295. ***************
  296. *** 646,651 ****
  297. --- 618,632 ----
  298.       return 1;
  299.   }
  300.   
  301. + void force_output()
  302. + {
  303. +     struct descriptor_data *d;
  304. +     for (d = descriptor_list; d; d = d->next)
  305. +         if (d->connected)
  306. +             process_output(d);
  307. + }
  308.   void make_nonblocking(s)
  309.   int s;
  310.   {
  311. ***************
  312. *** 723,733 ****
  313.   void goodbye_user(d)
  314.   struct descriptor_data *d;
  315.   {
  316.       write (d->descriptor, LEAVE_MESSAGE, strlen (LEAVE_MESSAGE));
  317.   }
  318.   
  319.   char *strsave (s)
  320. ! const char *s;
  321.   {
  322.       char *p;
  323.   
  324. --- 704,715 ----
  325.   void goodbye_user(d)
  326.   struct descriptor_data *d;
  327.   {
  328. + if(d->connected) /* this can happen, especially after updates */
  329.       write (d->descriptor, LEAVE_MESSAGE, strlen (LEAVE_MESSAGE));
  330.   }
  331.   
  332.   char *strsave (s)
  333. ! char *s;
  334.   {
  335.       char *p;
  336.   
  337. ***************
  338. *** 740,746 ****
  339.   
  340.   void save_command (d, command)
  341.   struct descriptor_data *d;
  342. ! const char *command;
  343.   
  344.   {
  345.       add_to_queue (&d->input, command, strlen(command)+1);
  346. --- 722,728 ----
  347.   
  348.   void save_command (d, command)
  349.   struct descriptor_data *d;
  350. ! char *command;
  351.   
  352.   {
  353.       add_to_queue (&d->input, command, strlen(command)+1);
  354. ***************
  355. *** 783,789 ****
  356.   
  357.   void set_userstring (userstring, command)
  358.   char **userstring;
  359. ! const char *command;
  360.   {
  361.       if (*userstring) {
  362.       free(*userstring);
  363. --- 765,771 ----
  364.   
  365.   void set_userstring (userstring, command)
  366.   char **userstring;
  367. ! char *command;
  368.   {
  369.       if (*userstring) {
  370.       free(*userstring);
  371. ***************
  372. *** 795,810 ****
  373.       *userstring = strsave (command);
  374.   }
  375.   
  376. - #ifdef __STDC__
  377. - void process_commands(void)
  378. - #else
  379.   void process_commands()
  380. - #endif
  381.   {
  382.       int nprocessed;
  383.       struct descriptor_data *d, *dnext;
  384.       struct text_block *t;
  385.   
  386.       do {
  387.       nprocessed = 0;
  388.       for (d = descriptor_list; d; d = dnext) {
  389. --- 777,792 ----
  390.       *userstring = strsave (command);
  391.   }
  392.   
  393.   void process_commands()
  394.   {
  395.       int nprocessed;
  396. +     long now;
  397.       struct descriptor_data *d, *dnext;
  398.       struct text_block *t;
  399.   
  400. +     (void) time (&now);
  401.       do {
  402.       nprocessed = 0;
  403.       for (d = descriptor_list; d; d = dnext) {
  404. ***************
  405. *** 816,825 ****
  406. --- 798,809 ----
  407.           if (!do_command (d, t -> start)) {
  408.               shutdownsock (d);
  409.           } else {
  410. +             d->last_time = now;    /* experimental code */
  411.               d -> input.head = t -> nxt;
  412.               if (!d -> input.head)
  413.               d -> input.tail = &d -> input.head;
  414.               free_text_block (t);
  415. +             d->last_time = now;    /* experimental code */
  416.           }
  417.   
  418.           }
  419. ***************
  420. *** 860,873 ****
  421.       if(d->connected) {
  422.   
  423.       openracedata(&server_racedata);
  424. !           getrace(server_racedata, &r, d->Playernum);
  425.       close_file(server_racedata);
  426.   
  427. !          sprintf(buf, "%s (%d) logged out.\n", r->name, d->Playernum);
  428.           for(i=1; i<=Numraces(); i++)
  429.           if(!Dir[i-1].gag)
  430.                         notify(i, buf);
  431. !             }
  432.       goodbye_user (d);
  433.       return 0;
  434.       } else if (!strcmp (args[0], WHO_COMMAND)) {
  435. --- 844,858 ----
  436.       if(d->connected) {
  437.   
  438.       openracedata(&server_racedata);
  439. !     getrace(server_racedata, &r, (int)d->Playernum);
  440.       close_file(server_racedata);
  441.   
  442. !          sprintf(buf, "%s [%d] logged out.\n", r->name, d->Playernum);
  443.           for(i=1; i<=Numraces(); i++)
  444.           if(!Dir[i-1].gag)
  445.                         notify(i, buf);
  446. !     free(r);
  447. !     }
  448.       goodbye_user (d);
  449.       return 0;
  450.       } else if (!strcmp (args[0], WHO_COMMAND)) {
  451. ***************
  452. *** 889,909 ****
  453.               }    
  454.       }
  455.       }
  456.       return 1;
  457.   }
  458.   
  459.   void check_connect (d, msg)
  460.   struct descriptor_data *d;
  461. ! const char *msg;
  462.   {
  463.       char password[MAX_COMMAND_LEN];
  464.       reg int i;
  465. !     int Playernum, Num_races;
  466.       racetype *r;
  467.       struct descriptor_data *d0, *dnext;
  468. - #ifdef BSD4_2
  469.       char zone[16];
  470. - #endif
  471.   
  472.       parse_connect (msg,  password);
  473.   
  474. --- 874,893 ----
  475.               }    
  476.       }
  477.       }
  478.       return 1;
  479.   }
  480.   
  481.   void check_connect (d, msg)
  482.   struct descriptor_data *d;
  483. ! char *msg;
  484.   {
  485.       char password[MAX_COMMAND_LEN];
  486.       reg int i;
  487. !     int Playernum, Num_races, racefile;
  488.       racetype *r;
  489.       struct descriptor_data *d0, *dnext;
  490.       char zone[16];
  491.   
  492.       parse_connect (msg,  password);
  493.   
  494. ***************
  495. *** 914,920 ****
  496.   for (i=1; i<=Num_races; i++)
  497.       notify(i, "DOING UPDATE...\n");
  498.   
  499.       clk = time(0);
  500.       update_tm=localtime(&clk);
  501.   #ifdef BSD4_2
  502. --- 898,904 ----
  503.   for (i=1; i<=Num_races; i++)
  504.       notify(i, "DOING UPDATE...\n");
  505.   
  506. ! force_output();
  507.       clk = time(0);
  508.       update_tm=localtime(&clk);
  509.   #ifdef BSD4_2
  510. ***************
  511. *** 922,927 ****
  512. --- 906,925 ----
  513.   #else
  514.       strcpy(zone, update_tm->tm_zone);
  515.   #endif
  516. + /* if hour is 0, allocate daily login time */
  517. + if(!update_tm->tm_hour) {
  518. + openracedata(&racefile);
  519. +     for (i=1; i<=Num_races; i++) {
  520. +     getrace(racefile, &r, i);
  521. +     r->daily = DAILY*60;
  522. +     if(!(update_tm->tm_mday%7))
  523. +         r->weekly = WEEKLY*60;
  524. +     putrace(racefile, r);
  525. +     }
  526. + close_file(racefile);
  527. + }
  528.   sprintf(Power_blocks.time, "%2d/%2d/%d %02d:%02d:%02d %s", 
  529.       update_tm->tm_mon+1, update_tm->tm_mday,
  530.       update_tm->tm_year, update_tm->tm_hour,
  531. ***************
  532. *** 930,937 ****
  533.       update_tm->tm_mon+1, update_tm->tm_mday,
  534.       update_tm->tm_year, update_tm->tm_hour,
  535.       update_tm->tm_min, update_tm->tm_sec, zone);
  536. !     do_turn();
  537. !     return;
  538.       }
  539.   
  540.   
  541. --- 928,937 ----
  542.       update_tm->tm_mon+1, update_tm->tm_mday,
  543.       update_tm->tm_year, update_tm->tm_hour,
  544.       update_tm->tm_min, update_tm->tm_sec, zone);
  545. !         do_turn();
  546. ! return;
  547.       }
  548.   
  549.   
  550. ***************
  551. *** 944,950 ****
  552.       } else {
  553.   
  554.       openracedata(&server_racedata);
  555. !           getrace(server_racedata, &r, i);
  556.       close_file(server_racedata);
  557.   
  558.             Playernum = r->Playernum;
  559. --- 944,950 ----
  560.       } else {
  561.   
  562.       openracedata(&server_racedata);
  563. !     getrace(server_racedata, &r, (int)i);
  564.       close_file(server_racedata);
  565.   
  566.             Playernum = r->Playernum;
  567. ***************
  568. *** 958,976 ****
  569.           }
  570.       }
  571.   
  572. !         fprintf (stderr, "CONNECTED %s(%d) on descriptor %d\n",
  573.                r->name, Playernum, d->descriptor);
  574.           d->connected = 1;
  575.           d->Playernum = Playernum;
  576.   
  577. !         sprintf(buf,"\nLogged in as %s (%d).\n",r->name,Playernum);
  578.           notify(Playernum, buf);
  579.        
  580. !         sprintf(buf, "%s (%d) logged on.\n", r->name, Playernum);
  581.           for(i=1; i<=Numraces(); i++)
  582.                     if(i != Playernum && !Dir[i-1].gag) notify(i, buf);
  583.   
  584. !     GB_time(Playernum);
  585.       if (r->Gov_ship==0) {
  586.           sprintf(buf,"You have no Governmental Center.  No action points will be produced\nuntil you build one and designate a capital.\n");
  587.           notify(Playernum, buf);
  588. --- 958,977 ----
  589.           }
  590.       }
  591.   
  592. !         fprintf (stderr, "CONNECTED %s [%d] on descriptor %d\n",
  593.                r->name, Playernum, d->descriptor);
  594.           d->connected = 1;
  595.           d->Playernum = Playernum;
  596.   
  597. !         sprintf(buf,"\nLogged in as %s [%d].\n",r->name,Playernum);
  598.           notify(Playernum, buf);
  599.        
  600. !         sprintf(buf, "%s [%d] logged on.\n", r->name, Playernum);
  601.           for(i=1; i<=Numraces(); i++)
  602.                     if(i != Playernum && !Dir[i-1].gag) notify(i, buf);
  603.   
  604. !     GB_time(Playernum, r, 0);
  605. !     if(r->standby) notify(Playernum, "Standing by\n");
  606.       if (r->Gov_ship==0) {
  607.           sprintf(buf,"You have no Governmental Center.  No action points will be produced\nuntil you build one and designate a capital.\n");
  608.           notify(Playernum, buf);
  609. ***************
  610. *** 978,988 ****
  611.           sprintf(buf,"Government Center #%d is active.\n", r->Gov_ship);
  612.           notify(Playernum, buf);
  613.           }
  614. !     }
  615.   }
  616.   
  617.   void parse_connect (msg, pass)
  618. ! const char *msg;
  619.   char *pass;
  620.   {
  621.       char *p;
  622. --- 979,994 ----
  623.           sprintf(buf,"Government Center #%d is active.\n", r->Gov_ship);
  624.           notify(Playernum, buf);
  625.           }
  626. !     if(!r->daily) {
  627. !         notify(Playernum, "You have no daily active time left.\n");
  628. !         }
  629. !     free(r);
  630. !     }
  631.   }
  632.   
  633.   void parse_connect (msg, pass)
  634. ! char *msg;
  635.   char *pass;
  636.   {
  637.       char *p;
  638. ***************
  639. *** 995,1005 ****
  640.       *p = '\0';
  641.   }
  642.   
  643. - #ifdef __STDC__
  644. - void close_sockets(void)
  645. - #else
  646.   void close_sockets()
  647. - #endif
  648.   {
  649.       struct descriptor_data *d, *dnext;
  650.   
  651. --- 1001,1007 ----
  652. ***************
  653. *** 1013,1034 ****
  654.       close (sock);
  655.   }
  656.   
  657. - #ifdef __STDC__
  658. - void emergency_shutdown(void)
  659. - #else
  660.   void emergency_shutdown()
  661. - #endif
  662.   {
  663.       close_sockets();
  664.   }
  665.   
  666. ! #ifdef __STDC__
  667. ! int bailout(int sig, int code, struct sigcontext *scp)
  668. ! #else
  669. ! int bailout(sig, code, scp)
  670. ! int sig, code;
  671.   struct sigcontext *scp;
  672. - #endif
  673.   {
  674.       char message[1024];
  675.       
  676. --- 1015,1029 ----
  677.       close (sock);
  678.   }
  679.   
  680.   void emergency_shutdown()
  681.   {
  682.       close_sockets();
  683.   }
  684.   
  685. ! int bailout(sig ,code,scp)
  686. ! int sig;
  687. ! int code;
  688.   struct sigcontext *scp;
  689.   {
  690.       char message[1024];
  691.       
  692. ***************
  693. *** 1038,1048 ****
  694.       return 0;
  695.   }
  696.   
  697. - #ifdef __STDC__
  698. - int dump_status(void)
  699. - #else
  700.   int dump_status()
  701. - #endif
  702.   {
  703.       struct descriptor_data *d;
  704.       long now;
  705. --- 1033,1039 ----
  706. ***************
  707. *** 1053,1061 ****
  708.   openracedata(&server_racedata);
  709.       for (d = descriptor_list; d; d = d->next) {
  710.       if (d->connected) {
  711. !         getrace(server_racedata, &r, d->Playernum);
  712.           fprintf (stderr, "PLAYING descriptor %d Playernum %s(%d)",
  713.                d->descriptor, r->name, d->Playernum);
  714.   
  715.           if (d->last_time)
  716.           fprintf (stderr, " idle %d seconds\n",
  717. --- 1044,1053 ----
  718.   openracedata(&server_racedata);
  719.       for (d = descriptor_list; d; d = d->next) {
  720.       if (d->connected) {
  721. !         getrace(server_racedata, &r, (int)d->Playernum);
  722.           fprintf (stderr, "PLAYING descriptor %d Playernum %s(%d)",
  723.                d->descriptor, r->name, d->Playernum);
  724. +         free(r);
  725.   
  726.           if (d->last_time)
  727.           fprintf (stderr, " idle %d seconds\n",
  728. ***************
  729. *** 1087,1120 ****
  730.   openracedata(&server_racedata);
  731.       for (d = descriptor_list; d; d = d->next) {
  732.       if (d->connected) {
  733. !         getrace(server_racedata, &r, d->Playernum);
  734.   
  735.           if (d->last_time)
  736. !         sprintf (buf, "%20s (%3d)     seconds idle %d\n", r->name, 
  737. !             d->Playernum, now - d->last_time);
  738.           else
  739. !         sprintf (buf, "%20s (%3d)     idle forever\n", r->name, d->Playernum);
  740.           queue_string (e, buf);
  741.       }
  742.       }
  743.   close_file(server_racedata);
  744.   }
  745.   
  746.   void process_command(Playernum, command) 
  747.   /* locate and parse the command for processing */
  748.   int Playernum;
  749.   char *command;
  750.   {
  751. ! int i,argn=0;
  752.   boolean parse_exit=0;
  753.   char args[MAXARGS][COMMANDSIZE];
  754.   char *string, *announcement, *dummy;
  755.   
  756. - openracedata(&server_racedata);
  757. - free(Race);
  758. - getrace(server_racedata, &Race, Playernum);
  759. - close_file(server_racedata);
  760.       string=command;    /* make pointers the same */
  761.   
  762.       while (!parse_exit) {
  763. --- 1079,1129 ----
  764.   openracedata(&server_racedata);
  765.       for (d = descriptor_list; d; d = d->next) {
  766.       if (d->connected) {
  767. !         getrace(server_racedata, &r, (int)d->Playernum);
  768.   
  769.           if (d->last_time)
  770. !         sprintf (buf, "%20s [%2d] [%d:%d] seconds idle %d %s %s\n", r->name, 
  771. !             d->Playernum, r->weekly/60, r->daily/60, now - d->last_time, (r->gag ? "GAG": ""),
  772. !             (r->standby ? "STAND BY" : ""));
  773.           else
  774. !         sprintf (buf, "%20s [%2d] idle forever\n", r->name, d->Playernum);
  775.           queue_string (e, buf);
  776. +         free(r);
  777. +         if((now - d->last_time) > DISCONNECT_TIME)
  778. +         d->connected = 0;
  779.       }
  780.       }
  781.   close_file(server_racedata);
  782.   }
  783.   
  784. + int daily_time(r)
  785. + racetype *r;
  786. + {
  787. +     struct descriptor_data *d;
  788. +     long now;
  789. +     int time_left;
  790. +     time_left = r->daily;
  791. +     
  792. +     (void) time (&now);
  793. +     for (d = descriptor_list; d; d = d->next)
  794. +     if (d->connected && d->last_time && (d->Playernum==r->Playernum)) {
  795. +         time_left = MAX(0, r->daily - (now - d->last_time));
  796. +     }
  797. +     return time_left;
  798. + }
  799.   void process_command(Playernum, command) 
  800.   /* locate and parse the command for processing */
  801.   int Playernum;
  802.   char *command;
  803.   {
  804. ! int i, j,argn=0, God, ok, old;
  805.   boolean parse_exit=0;
  806.   char args[MAXARGS][COMMANDSIZE];
  807.   char *string, *announcement, *dummy;
  808. + racetype *r;
  809.   
  810.       string=command;    /* make pointers the same */
  811.   
  812.       while (!parse_exit) {
  813. ***************
  814. *** 1138,1207 ****
  815.   /* target routine is specified by the first substring, other options 
  816.       are the substrings which follow */
  817.   
  818.           if (!strncmp(args[0],"announce",i))
  819.               announce(Playernum,0,argn,args, 0);
  820. !          else if (!strncmp(args[0],"allocate",i)) allocateAPs(Playernum,0, argn, args);
  821. !          else if (!strncmp(args[0],"assault",i)) land(Playernum,1,argn,args,1);
  822.       else if (!strncmp(args[0], "autoreport",i)) autoreport(Playernum, 0, argn, args);
  823. !     else if (!strncmp(args[0],"build",i)) build(Playernum,1,argn,args);
  824. !     else if (!strncmp(args[0], "broadcast", i)) announce(Playernum, 5*(!Race->God), argn, args, 1);
  825. !     else if (!strncmp(args[0], "block", i)) block(Playernum, 0, argn, args);
  826. !          else if (!strncmp(args[0],"capitol",i)) capitol(Playernum,50,argn,args);
  827. !          else if (!strncmp(args[0],"capture",i)) capture(Playernum,1,argn,args);
  828.       else if (!strncmp(args[0], "center", i)) center(Playernum, 0, argn, args);
  829.       else if (!strncmp(args[0],"cs",i)) cs(Playernum,0,argn,args);
  830. !     else if (!strncmp(args[0],"declare",i)) declare(Playernum,1,argn,args);
  831. !     else if (!strncmp(args[0],"dock",i)) land(Playernum,0,argn,args,0);
  832. !     else if (!strncmp(args[0],"enslave",i)) enslave(Playernum,2,argn,args);
  833. !     else if (!strncmp(args[0],"examine",i)) examine(Playernum,0,argn,args);
  834. !     else if (!strncmp(args[0],"explore",i)) exploration(Playernum,0,argn,args);
  835. !     else if (!strncmp(args[0],"fire",i)) fire(Playernum,1,argn,args);
  836. !     else if (!strncmp(args[0], "gag", i)) Dir[Playernum-1].gag = !Dir[Playernum-1].gag;
  837. !     else if (!strncmp(args[0],"give",i)) give(Playernum,5,argn,args);
  838.       else if (!strncmp(args[0], "identify", i)) whois(Playernum, 0, argn, args);
  839. !     else if (!strncmp(args[0], "invite", i)) invite(Playernum, 0, argn, args, 1);
  840. !     else if (!strncmp(args[0],"land",i)) land(Playernum,1,argn,args,0);
  841. !     else if (!strncmp(args[0],"launch",i)) launch(Playernum,1,argn,args);
  842. !     else if (!strncmp(args[0], "list", i) && Race->God) list(Playernum);
  843. !     else if (!strncmp(args[0],"load",i)) load(Playernum,0,argn,args);
  844. !     else if (!strncmp(args[0],"map",i)) map(Playernum,0,argn,args);
  845. !     else if (!strncmp(args[0],"mobilize",i)) mobilize(Playernum,1,argn,args);
  846. !     else if (!strncmp(args[0],"move",i)) move_popn(Playernum,1,argn,args);
  847. !     else if (!strncmp(args[0],"make", i)) make_mod(Playernum, 0, argn, args, 0);
  848. !     else if (!strncmp(args[0],"modify", i)) make_mod(Playernum, 0, argn, args, 1);
  849. !     else if (!strncmp(args[0],"name",i)) name(Playernum,1*(!Race->God),argn,args);
  850. !     else if (!strncmp(args[0],"object",i)) rst(Playernum,0,argn,args,4);
  851. !     else if (!strncmp(args[0],"orbit",i)) orbit(Playernum,0,argn,args);
  852. !     else if (!strncmp(args[0],"order",i)) order(Playernum,1,argn,args); 
  853. !     else if (!strncmp(args[0],"page",i)) page(Playernum, 1*(!Race->God), argn, args);
  854. !          else if (!strncmp(args[0],"colonies",i)) colonies(Playernum,0,argn,args);
  855. !     else if (!strncmp(args[0], "pledge", i)) pledge(Playernum, 0, argn, args, 1);
  856. !     else if (!strncmp(args[0],"power",i)) power(Playernum,0,argn,args);
  857. !     else if (!strncmp(args[0],"profile",i)) profile(Playernum,0,argn,args);
  858. !     else if (!strncmp(args[0],"relation",i)) relation(Playernum,0,argn,args);
  859.       else if (!strncmp(args[0],"read",i)) read_messages(Playernum,0,argn,args);
  860. !     else if (!strncmp(args[0],"reset", i) && Race->God) reload_star_data_base();
  861. !     else if (!strncmp(args[0],"report",i)) rst(Playernum,0,argn,args,0);
  862. !     else if (!strncmp(args[0],"@@shutdown",i) && Race->God) {
  863.           shutdown_flag = 1;
  864.           notify(Playernum, "Doing shutdown.\n");
  865. !     } else if (!strncmp(args[0],"stock",i)) rst(Playernum,0,argn,args,1);
  866. !     else if (!strncmp(args[0],"ship",i)) rst(Playernum,0,argn,args,3);
  867. !     else if (!strncmp(args[0],"survey",i)) survey(Playernum,0,argn,args);
  868. !     else if (!strncmp(args[0], "send", i)) send_message(Playernum, 1*(!Race->God), argn, args);
  869. !     else if (!strncmp(args[0],"scrap",i)) scrap(Playernum,1,argn,args);
  870. !     else if(!strncmp(args[0],"tactical",i)) rst(Playernum,0,argn,args,2);
  871. ! /*    else if (!strncmp(args[0],"telegram",i)) telegram(Playernum,0,argn,args); */
  872. !     else if(!strncmp(args[0],"technology",i)) technology(Playernum,1,argn,args);
  873.       else if (!strncmp(args[0],"toggle",i)) toggle(Playernum,0,argn,args);
  874. !     else if(!strncmp(args[0],"toxicity",i)) toxicity(Playernum,1,argn,args);
  875. !     else if (!strncmp(args[0],"transfer",i)) transfer(Playernum,1,argn,args);
  876. !     else if (!strncmp(args[0],"unload",i)) load(Playernum,0,argn,args);
  877. !     else if (!strncmp(args[0],"undock",i)) launch(Playernum,0,argn,args);
  878. !     else if (!strncmp(args[0], "uninvite", i)) invite(Playernum, 0, argn, args, 0); 
  879. !     else if (!strncmp(args[0], "unpledge", i)) pledge(Playernum, 0, argn, args, 0); 
  880. !         else if (!strncmp(args[0],"time",i)) GB_time(Playernum);
  881. !     else if (!strncmp(args[0],"zoom",i)) zoom(Playernum,0,argn,args);
  882.               /* only owning player can use fix */
  883.        else {
  884.              sprintf(buf,"'%s':illegal command error(%d).\n",args[0],*args[0]);
  885. --- 1147,1252 ----
  886.   /* target routine is specified by the first substring, other options 
  887.       are the substrings which follow */
  888.   
  889. + openracedata(&server_racedata);
  890. + getrace(server_racedata, &r, Playernum);
  891. + old = r->daily;
  892. + God = r->God;
  893. + if(!r->standby && r->daily) {
  894. +     r->daily = (short)daily_time(r);
  895. +     putrace(server_racedata, r);
  896. +     }
  897. + close_file(server_racedata);
  898. + ok = ((!r->standby && r->daily) || God);    /* whether or not the player can execture the command */
  899.           if (!strncmp(args[0],"announce",i))
  900.               announce(Playernum,0,argn,args, 0);
  901. !          else if (!strncmp(args[0],"allocate",i) && ok) allocateAPs(Playernum,0, argn, args);
  902. !          else if (!strncmp(args[0],"assault",i) && ok) dock(Playernum,1,argn,args,1);
  903.       else if (!strncmp(args[0], "autoreport",i)) autoreport(Playernum, 0, argn, args);
  904. !     else if (!strncmp(args[0],"build",i) && ok) build(Playernum,1,argn,args);
  905. !     else if (!strncmp(args[0], "'", i) || !strncmp(args[0], "broadcast", i)) announce(Playernum, 0, argn, args, 1);
  906. !     else if (!strncmp(args[0], "block", i) && ok) block(Playernum, 0, argn, args);
  907. !          else if (!strncmp(args[0],"capitol",i) && ok) capitol(Playernum,50,argn,args);
  908. !          else if (!strncmp(args[0],"capture",i) && ok) capture(Playernum,1,argn,args);
  909.       else if (!strncmp(args[0], "center", i)) center(Playernum, 0, argn, args);
  910.       else if (!strncmp(args[0],"cs",i)) cs(Playernum,0,argn,args);
  911. !     else if (!strncmp(args[0],"declare",i) && ok) declare(Playernum,1,argn,args);
  912. !     else if (!strncmp(args[0],"detonate",i) && ok) detonate(Playernum,0,argn,args);
  913. !     else if (!strncmp(args[0],"dismount", i) && ok) mount(Playernum, 0, argn, args, 0);
  914. !     else if (!strncmp(args[0], "dissolve", i)) dissolve(Playernum, argn, args);
  915. !     else if (!strncmp(args[0],"dock",i) && ok) dock(Playernum,0,argn,args,0);
  916. !     else if (!strncmp(args[0],"dump",i) && ok) dump(Playernum,10,argn,args,0);
  917. !     else if (!strncmp(args[0],"enslave",i) && ok) enslave(Playernum,2,argn,args);
  918. !     else if (!strncmp(args[0],"examine",i) && ok) examine(Playernum,0,argn,args);
  919. !     else if (!strncmp(args[0],"explore",i) && ok) exploration(Playernum,0,argn,args);
  920. !     else if (!strncmp(args[0],"fire",i) && ok) fire(Playernum,1,argn,args);
  921. !     else if (!strncmp(args[0],"give",i) && ok) give(Playernum,5,argn,args);
  922. !     else if (!strncmp(args[0], "highlight", i)) highlight(Playernum, 0, argn, args);
  923.       else if (!strncmp(args[0], "identify", i)) whois(Playernum, 0, argn, args);
  924. !     else if (!strncmp(args[0], "invite", i) && ok) invite(Playernum, 0, argn, args, 1);
  925. !     else if (!strncmp(args[0],"land",i) && ok) land(Playernum,1,argn,args);
  926. !     else if (!strncmp(args[0],"launch",i) && ok) launch(Playernum,1,argn,args);
  927. !     else if (!strncmp(args[0], "list", i) && God) list(Playernum);
  928. !     else if (!strncmp(args[0],"load",i) && ok) load(Playernum,0,argn,args, 0);
  929. !     else if (!strncmp(args[0],"map",i) && ok) map(Playernum,0,argn,args);
  930. !     else if (!strncmp(args[0],"mobilize",i) && ok) mobilize(Playernum,1,argn,args);
  931. !     else if (!strncmp(args[0],"move",i) && ok) move_popn(Playernum,1,argn,args);
  932. !     else if (!strncmp(args[0],"make", i) && ok) make_mod(Playernum, 0, argn, args, 0);
  933. !     else if (!strncmp(args[0],"modify", i) && ok) make_mod(Playernum, 0, argn, args, 1);
  934. !     else if (!strncmp(args[0],"mount", i) && ok) mount(Playernum, 0, argn, args, 1);
  935. !     else if (!strncmp(args[0],"motto", i) && ok) motto(Playernum, 0, argn, args);
  936. !     else if (!strncmp(args[0],"name",i) && ok) name(Playernum, !God,argn,args);
  937. !     else if (!strncmp(args[0],"orbit",i) && ok) orbit(Playernum,0,argn,args);
  938. !     else if (!strncmp(args[0],"order",i) && ok) order(Playernum,1,argn,args); 
  939. !     else if (!strncmp(args[0],"page",i)) page(Playernum, !God, argn, args);
  940. !          else if (!strncmp(args[0],"colonies",i) && ok) colonies(Playernum,0,argn,args);
  941. !     else if (!strncmp(args[0], "pledge", i) && ok) pledge(Playernum, 0, argn, args, 1);
  942. !     else if (!strncmp(args[0],"power",i) && ok) power(Playernum,0,argn,args);
  943. !     else if (!strncmp(args[0],"profile",i) && ok) profile(Playernum,0,argn,args);
  944. !     else if (!strncmp(args[0],"production", i) && ok) production(Playernum, 0, argn, args);
  945. !     else if (!strncmp(args[0],"relation",i) && ok) relation(Playernum,0,argn,args);
  946.       else if (!strncmp(args[0],"read",i)) read_messages(Playernum,0,argn,args);
  947. !     else if (!strncmp(args[0],"reset", i) && God) {
  948. !                 for (j=1; j<=Numraces(); j++)
  949. !                 notify(j, "DOING RESET...\n");
  950. !                 force_output();
  951. !             reload_star_data_base();
  952. !             do_reset();
  953. !             }
  954. !     else if (!strncmp(args[0],"report",i) && ok) rst(Playernum,0,argn,args,0);
  955. !     else if (!strncmp(args[0],"repair",i) && ok) repair(Playernum,0,argn,args);
  956. !     else if (!strncmp(args[0],"@@shutdown",i) && God) {
  957.           shutdown_flag = 1;
  958.           notify(Playernum, "Doing shutdown.\n");
  959. !     } else if (!strncmp(args[0],"stock",i) && ok) rst(Playernum,0,argn,args,1);
  960. !     else if (!strncmp(args[0], "standby", i)) {
  961. !         r->standby = !r->standby;
  962. !         openracedata(&server_racedata);
  963. !         putrace(server_racedata, r);
  964. !         close_file(server_racedata);
  965. !         if(r->standby) notify(Playernum, "Standing by\n");
  966. !         else notify(Playernum, "Returning to active status\n");
  967. !     } else if (!strncmp(args[0],"stats",i) && ok) rst(Playernum,0,argn,args,4);
  968. !     else if (!strncmp(args[0],"ship",i) && ok) rst(Playernum,0,argn,args,3);
  969. !     else if (!strncmp(args[0],"survey",i) && ok) survey(Playernum,0,argn,args);
  970. !     else if (!strncmp(args[0], "send", i)) send_message(Playernum, 1*(!God), argn, args);
  971. !     else if (!strncmp(args[0],"scrap",i) && ok) scrap(Playernum,1,argn,args);
  972. !     else if(!strncmp(args[0],"tactical",i) && ok) rst(Playernum,0,argn,args,2);
  973. !     else if(!strncmp(args[0],"technology",i) && ok) technology(Playernum,1,argn,args);
  974.       else if (!strncmp(args[0],"toggle",i)) toggle(Playernum,0,argn,args);
  975. !     else if(!strncmp(args[0],"toxicity",i) && ok) toxicity(Playernum,1,argn,args);
  976. !     else if (!strncmp(args[0],"transfer",i) && ok) transfer(Playernum,1,argn,args);
  977. !     else if (!strncmp(args[0],"unload",i) && ok) load(Playernum,0,argn,args, 1);
  978. !     else if (!strncmp(args[0],"undock",i) && ok) launch(Playernum,0,argn,args);
  979. !     else if (!strncmp(args[0], "uninvite", i) && ok) invite(Playernum, 0, argn, args, 0); 
  980. !     else if (!strncmp(args[0], "unpledge", i) && ok) pledge(Playernum, 0, argn, args, 0); 
  981. !         else if (!strncmp(args[0],"time",i)) {
  982. !             int alloc;
  983. !             if(argn > 1) alloc = atoi(args[1]);
  984. !             else alloc = 0;
  985. !             GB_time(Playernum, r, alloc);
  986. !     } else if (!strncmp(args[0],"zoom",i)) zoom(Playernum,0,argn,args);
  987.               /* only owning player can use fix */
  988.        else {
  989.              sprintf(buf,"'%s':illegal command error(%d).\n",args[0],*args[0]);
  990. ***************
  991. *** 1208,1221 ****
  992.           notify(Playernum, buf);
  993.           }
  994.   
  995. ! /* send the prompt to the player */
  996. !     sprintf(buf, "%s", Dir[Playernum-1].prompt);
  997.           notify(Playernum, buf);
  998.   
  999.   }
  1000.   
  1001.   void panic(message)
  1002. ! const char *message;
  1003.   {
  1004.       FILE *f;
  1005.       int i;
  1006. --- 1253,1272 ----
  1007.           notify(Playernum, buf);
  1008.           }
  1009.   
  1010. ! /* compute the prompt and send to the player */
  1011. ! do_prompt(r);
  1012. ! if(old && !r->daily)
  1013. !     notify(Playernum, "You're daily time allocation has run out!!!\n");
  1014. ! free(r);
  1015. ! sprintf(buf, "%s", Dir[Playernum-1].prompt);
  1016.           notify(Playernum, buf);
  1017.   
  1018.   }
  1019.   
  1020.   void panic(message)
  1021. ! char *message;
  1022.   {
  1023.       FILE *f;
  1024.       int i;
  1025. ***************
  1026. *** 1261,1273 ****
  1027.       strcat(s1, s2);
  1028.   }
  1029.   
  1030. ! GB_time(Playernum) /* report back the update status */
  1031.   int Playernum;
  1032.   {
  1033. - #ifdef BSD4_2
  1034.       char zone[16];
  1035. - #endif
  1036.   
  1037.       clk = time(0);
  1038.       current_tm=localtime(&clk);
  1039.   #ifdef BSD4_2
  1040. --- 1312,1325 ----
  1041.       strcat(s1, s2);
  1042.   }
  1043.   
  1044. ! GB_time(Playernum, r, alloc) /* report back the update status */
  1045.   int Playernum;
  1046. + racetype *r;
  1047. + int alloc;
  1048.   {
  1049.       char zone[16];
  1050.   
  1051. +     if(!alloc) {
  1052.       clk = time(0);
  1053.       current_tm=localtime(&clk);
  1054.   #ifdef BSD4_2
  1055. ***************
  1056. *** 1286,1291 ****
  1057. --- 1338,1359 ----
  1058.      notify(Playernum, "No updates since the server was started.\n");
  1059.       /* can happen if you have just started the game up */   
  1060.   notify(Playernum, start_buf);
  1061. + sprintf(buf, "%d/%d weekly/daily minutes of active time remaining.\n", r->weekly/60, r->daily/60);
  1062. + notify(Playernum, buf);
  1063. +     } else if(alloc  > 0) {
  1064. +         printf("%d\n", alloc);
  1065. +         alloc = MIN(MIN(alloc*60, r->weekly), DAILY*60 - r->daily)/60;
  1066. +         r->weekly -= alloc*60;
  1067. +         r->daily += alloc*60;
  1068. +         sprintf(buf, "%d minutes of weekly allotment allocated.\n", alloc);
  1069. +         notify(Playernum, buf);
  1070. +     openracedata(&server_racedata);
  1071. +     putrace(server_racedata, r);
  1072. +     close_file(server_racedata);
  1073. +     } else {
  1074. +         notify(Playernum, "You can only allocate a positive number of minutes.\n");
  1075. +     }
  1076.   }
  1077.   
  1078.   help(e, argn,args)
  1079. ***************
  1080. *** 1299,1327 ****
  1081.       sprintf(buf,"usage: help [topic]\n");
  1082.           queue_string(e, buf);
  1083.       sprintf(buf,"    valid topics are:\n  CONCEPTS:\n%s",
  1084. !         "help     scope    actionpoints       explore    colony\n" );
  1085.           queue_string(e, buf);
  1086. !     sprintf(buf,"daemon   races     blocks     quit           info\n");
  1087.           queue_string(e, buf);
  1088.       sprintf(buf,"\n  COMMANDS:\n");
  1089.           queue_string(e, buf);
  1090. !     sprintf(buf,"cs       map      survey  orbit      zoom     autoreport\n");
  1091.           queue_string(e, buf);
  1092.       sprintf(buf,"toggle   gag      capitol  allocate\n\n");
  1093.           queue_string(e, buf);
  1094. !     sprintf(buf, "announce page    who    time    quit\n");
  1095.           queue_string(e, buf);
  1096. !     sprintf(buf,"build    ship     stock   report     tactical  order     examine\n");
  1097.           queue_string(e, buf);
  1098.       sprintf(buf,"land     launch   dock    undock     load      assault   scrap\n\n");
  1099.           queue_string(e, buf);
  1100. !     sprintf(buf,"assault  capture  fire    give       move       enslave\n\n");
  1101.           queue_string(e, buf);
  1102. !     sprintf(buf,"declare  profile  relation    power   explore\n");
  1103.           queue_string(e, buf);
  1104. !     sprintf(buf,"colonies name     mobilize technology toxicity   transfer\n");
  1105.           queue_string(e, buf);
  1106. !     sprintf(buf, "make   modify\n");
  1107.           queue_string(e, buf); 
  1108.   
  1109.    } else {
  1110. --- 1367,1395 ----
  1111.       sprintf(buf,"usage: help [topic]\n");
  1112.           queue_string(e, buf);
  1113.       sprintf(buf,"    valid topics are:\n  CONCEPTS:\n%s",
  1114. !         "beginner\nhelp     scope    actionpoints       explore    colony\n" );
  1115.           queue_string(e, buf);
  1116. !     sprintf(buf,"daemon   races     blocks     quit      crystal     lasers    info\n");
  1117.           queue_string(e, buf);
  1118.       sprintf(buf,"\n  COMMANDS:\n");
  1119.           queue_string(e, buf);
  1120. !     sprintf(buf,"cs       map      survey  orbit      zoom     autoreport    production\n");
  1121.           queue_string(e, buf);
  1122.       sprintf(buf,"toggle   gag      capitol  allocate\n\n");
  1123.           queue_string(e, buf);
  1124. !     sprintf(buf, "announce page    who    time    standby    quit\n");
  1125.           queue_string(e, buf);
  1126. !     sprintf(buf,"build    ship     stock   report     tactical  stats order     examine\n");
  1127.           queue_string(e, buf);
  1128.       sprintf(buf,"land     launch   dock    undock     load      assault   scrap\n\n");
  1129.           queue_string(e, buf);
  1130. !     sprintf(buf,"assault  capture  fire    give       move       enslave    repair\n\n");
  1131.           queue_string(e, buf);
  1132. !     sprintf(buf,"declare  profile  relation    power   explore     detonate\n");
  1133.           queue_string(e, buf);
  1134. !     sprintf(buf,"colonies dump  name motto    mobilize technology toxicity   transfer\n");
  1135.           queue_string(e, buf);
  1136. !     sprintf(buf, "make   modify    mount\n");
  1137.           queue_string(e, buf); 
  1138.   
  1139.    } else {
  1140. ***************
  1141. *** 1356,1358 ****
  1142. --- 1424,1513 ----
  1143.   if(sbuf.st_size)
  1144.   notify(Playernum, "You have telegram(s) waiting. Use 'read' to read them.\n");
  1145.   }
  1146. + kill_ship(Playernum, ship)
  1147. + int Playernum;
  1148. + shiptype *ship;
  1149. + {
  1150. + racetype *r;
  1151. + shiptype *s;
  1152. + int kill_racedata, kill_shdata, sh;
  1153. + ship->is_alive = 0;
  1154. + ship->popn = 0;
  1155. + ship->damage = 100; 
  1156. + ship->notified = 0;
  1157. + if(ship->type==OTYPE_GOV) {
  1158. +         openracedata(&kill_racedata);
  1159. +         getrace(kill_racedata, &r, (int)ship->owner);
  1160. +         r->Gov_ship = 0;
  1161. +         putrace(kill_racedata, r);
  1162. +         close_file(kill_racedata);
  1163. +         free(r);
  1164. +                 }
  1165. + /* undock the stuff docked with it */
  1166. + if(ship->is_docked && ship->whatdest==LEVEL_SHIP) {
  1167. +     openshdata(&kill_shdata);
  1168. +     getship(kill_shdata, &s, ship->destshipno);
  1169. +     s->is_docked = 0;
  1170. +     s->whatdest = LEVEL_UNIV;
  1171. +     putship(kill_shdata, s, ship->destshipno);
  1172. +     free(s);
  1173. + }
  1174. + /* fighters are destroyed if one board a carrier */
  1175. + if(ship->type==STYPE_CARRIER) {
  1176. +     sh=ship->object.number;
  1177. +     openshdata(&kill_shdata);
  1178. +     while(sh) {
  1179. +     (void)getship(kill_shdata, &s, sh);
  1180. +     s->is_alive = 0; s->notified = 0;
  1181. +     putship(kill_shdata, s, sh);    
  1182. +     sh = s->object.number;
  1183. +     free(s);
  1184. +     }
  1185. +     close_file(kill_shdata);
  1186. + }
  1187. + /* if the ship is a VN, keep track of who killed it */
  1188. +     if(ship->type==OTYPE_VN) {
  1189. +         ship->object.number3 = Playernum; /* remember who killed it */
  1190. +     }
  1191. + }
  1192. + compute_power_blocks()
  1193. + {
  1194. + int i, j, dummy;
  1195. + Num_races = Numraces();
  1196. + /* compute alliance block power */
  1197. + sprintf(Power_blocks.time, "%2d/%2d/%d %02d:%02d:%02d %s", 
  1198. +     current_tm->tm_mon+1, current_tm->tm_mday,
  1199. +     current_tm->tm_year, current_tm->tm_hour,
  1200. +     current_tm->tm_min, current_tm->tm_sec, current_tm->tm_zone);
  1201. +  for (i=1; i<=Num_races; i++) {
  1202. +     dummy=(Blocks[i-1].invite & Blocks[i-1].pledge);
  1203. +                 Power_blocks.members[i-1] = 0;
  1204. +                 Power_blocks.sectors_owned[i-1] = 0;
  1205. +                 Power_blocks.popn[i-1] = 0;
  1206. +                 Power_blocks.ships_owned[i-1] = 0;
  1207. +                 Power_blocks.resource[i-1] = 0;
  1208. +                 Power_blocks.fuel[i-1] = 0;
  1209. +                 Power_blocks.destruct[i-1] = 0;
  1210. +                 Power_blocks.systems_owned[i-1] = Blocks[i-1].systems_owned;
  1211. +                 Power_blocks.VPs[i-1] = Blocks[i-1].VPs;
  1212. +     for(j=1; j<=Num_races; j++) 
  1213. +             if(isset(dummy, j)){
  1214. +                 Power_blocks.members[i-1] += 1;
  1215. +                 Power_blocks.sectors_owned[i-1] += Power[j-1].sectors_owned;
  1216. +                 Power_blocks.popn[i-1] += Power[j-1].popn;
  1217. +                 Power_blocks.ships_owned[i-1] += Power[j-1].ships_owned;
  1218. +                 Power_blocks.resource[i-1] += Power[j-1].resource;
  1219. +                 Power_blocks.fuel[i-1] += Power[j-1].fuel;
  1220. +                 Power_blocks.destruct[i-1] += Power[j-1].destruct;
  1221. +             }
  1222. +     }
  1223. + }
  1224. *** /usr/cna/billr/games/gb3/server/doplanet.c    Wed May 30 15:13:01 1990
  1225. --- server/doplanet.c    Thu Aug 23 16:54:48 1990
  1226. ***************
  1227. *** 71,76 ****
  1228. --- 71,77 ----
  1229.   int oldplanetpopn, oldplanetmaxpopn;
  1230.   boolean allmod=0,allexp=0;
  1231.   char buf[200]; 
  1232. + float tech_prod();
  1233.   
  1234.   Sectormappos = planet->sectormappos;
  1235.   check(planet,0);
  1236. ***************
  1237. *** 78,84 ****
  1238.       return 0;    /* no one's here now */
  1239.   
  1240.   if (Stinfo[starnum][planetnum].inhab) {
  1241. - /*    printf(" getting sectmap pos %d\n",planet->sectormappos); */
  1242.       opensectdata(§data);
  1243.       getsmap(sectdata,Smap,planet);
  1244.       close_file(sectdata);
  1245. --- 79,84 ----
  1246. ***************
  1247. *** 87,94 ****
  1248.       bzero((char *)Sectinfo, sizeof(Sectinfo) );
  1249.   }
  1250.   
  1251.   check(planet,1);
  1252.     shipno = planet->ships;
  1253.   
  1254. --- 87,92 ----
  1255. ***************
  1256. *** 147,163 ****
  1257.              {
  1258.               sectortype *s;
  1259.               s = &Sector(*planet,(int)ship->xpos,(int)ship->ypos);
  1260. !             if (s->des != DES_GAS && 
  1261.               (int_rand(1,100) <= (((100-ship->damage) * 
  1262.                     ship->popn)/Max_crew(ship)))) {
  1263.                 /* gas sectors can't be terraformed. */
  1264.                s->des = races[ship->owner-1]->likesbest;
  1265. !              s->eff *= 0.5;
  1266. !              s->mobilization *= 0.5;
  1267. !              s->resource *= 0.7;
  1268. !              /*s->popn *= 0.5;*/    /* ?? not sure bout this */
  1269.               s->popn = 0;
  1270. !             s->owner = 0;/* i AM sure about this :) */
  1271.                ship->fuel -= (float)FUEL_COST_TERRA;
  1272.                ship->mass -= FUEL_COST_TERRA*MASS_FUEL;
  1273.               if (planet->conditions[TOXIC]<100)
  1274. --- 145,160 ----
  1275.              {
  1276.               sectortype *s;
  1277.               s = &Sector(*planet,(int)ship->xpos,(int)ship->ypos);
  1278. !             if (s->des !=races[ship->owner-1]->likesbest &&
  1279. !             s->des != DES_GAS && 
  1280.               (int_rand(1,100) <= (((100-ship->damage) * 
  1281.                     ship->popn)/Max_crew(ship)))) {
  1282.                 /* gas sectors can't be terraformed. */
  1283.                s->des = races[ship->owner-1]->likesbest;
  1284. !              s->eff = 0;
  1285. !              s->mobilization = 0.;
  1286.               s->popn = 0;
  1287. !             s->owner = 0;
  1288.                ship->fuel -= (float)FUEL_COST_TERRA;
  1289.                ship->mass -= FUEL_COST_TERRA*MASS_FUEL;
  1290.               if (planet->conditions[TOXIC]<100)
  1291. ***************
  1292. *** 201,208 ****
  1293.   check(planet,2);
  1294.     }
  1295.   
  1296. !  if (!Stinfo[starnum][planetnum].inhab && 
  1297.        !Stinfo[starnum][planetnum].Thing_add)
  1298.       return 0;    /* (no one's explored the planet) */
  1299.   
  1300. --- 198,204 ----
  1301.   check(planet,2);
  1302.     }
  1303.   
  1304. ! if (!Stinfo[starnum][planetnum].inhab && 
  1305.        !Stinfo[starnum][planetnum].Thing_add)
  1306.       return 0;    /* (no one's explored the planet) */
  1307.   
  1308. ***************
  1309. *** 253,258 ****
  1310. --- 249,255 ----
  1311.   bzero((char *)prod_res, sizeof(prod_res) );
  1312.   bzero((char *)prod_fuel, sizeof(prod_fuel) );
  1313.   bzero((char *)prod_destruct, sizeof(prod_destruct) );
  1314. + bzero((char *)prod_crystals, sizeof(prod_crystals) );
  1315.   
  1316.   tot_resdep = prod_eff= prod_mob = tot_captured = 0;
  1317.   Claims = 0;
  1318. ***************
  1319. *** 267,272 ****
  1320. --- 264,270 ----
  1321.   for (i=1; i<=Num_races; i++) {
  1322.       Compat[i-1] = compatibility(planet, races[i-1]);
  1323.       planet->info[i-1].numsectsowned = 0;
  1324. +     planet->info[i-1].popn = 0;
  1325.       populations[i-1] = 0;
  1326.       prod_fuel[i-1] = 0;
  1327.       prod_destruct[i-1] = 0;
  1328. ***************
  1329. *** 275,285 ****
  1330.   }
  1331.   
  1332.   Getxysect(planet, &x, &y, 1);
  1333. - /*printf(" while %d\n",Getxysect(planet, &x, &y, 1));    /* reset */
  1334.   
  1335. - check(planet,4);
  1336.   while (Getxysect(planet, &x, &y, 0)) {
  1337.          p = &Sector(*planet,x,y);
  1338.        if (p->owner) {
  1339.           /* (all modified; sectors belonging to that player modified) */
  1340.           allmod = 1;    
  1341. --- 273,282 ----
  1342.   }
  1343.   
  1344.   Getxysect(planet, &x, &y, 1);
  1345.   
  1346.   while (Getxysect(planet, &x, &y, 0)) {
  1347.          p = &Sector(*planet,x,y);
  1348.        if (p->owner) {
  1349.           /* (all modified; sectors belonging to that player modified) */
  1350.           allmod = 1;    
  1351. ***************
  1352. *** 304,310 ****
  1353.   
  1354.             Sectinfo[x][y].done = 1;
  1355.   
  1356. !       }
  1357.   
  1358.   
  1359.              if (p->owner) {
  1360. --- 301,308 ----
  1361.   
  1362.             Sectinfo[x][y].done = 1;
  1363.   
  1364. !       } else
  1365. !         p->popn = 0;
  1366.   
  1367.   
  1368.              if (p->owner) {
  1369. ***************
  1370. *** 355,363 ****
  1371.       }
  1372.        }
  1373.   
  1374. ! }
  1375. ! check(planet,5);
  1376.   
  1377.   if (allmod) {    /* ( >= 1 inhabited sector on the planet) */
  1378.   
  1379.   check(planet,51);
  1380. --- 353,363 ----
  1381.       }
  1382.        }
  1383.   
  1384. !    }
  1385.   
  1386. + check(planet,5);
  1387. + allmod=1;
  1388.   if (allmod) {    /* ( >= 1 inhabited sector on the planet) */
  1389.   
  1390.   check(planet,51);
  1391. ***************
  1392. *** 426,437 ****
  1393.           Stars[starnum]->name, Stars[starnum]->pnames[planetnum] );
  1394.             sprintf(buf," \nWAR STATUS: %d sectors gained, %d sectors lost.\n", sects_gained[i-1],sects_lost[i-1]);
  1395.       str_cat(telegram_buf, buf);
  1396. !     push_message(TELEG_PLAYER_AUTO, i, telegram_buf);
  1397.         }
  1398.   
  1399. !     for (i=1; i<=Num_races; i++)
  1400.        if (planet->info[i-1].autorep) {
  1401.   check(planet,8);
  1402.   /*      planet->info[i-1].autorep = planet->info[i-1].autorep - 1; */
  1403.   check(planet,85);
  1404. --- 426,439 ----
  1405.           Stars[starnum]->name, Stars[starnum]->pnames[planetnum] );
  1406.             sprintf(buf," \nWAR STATUS: %d sectors gained, %d sectors lost.\n", sects_gained[i-1],sects_lost[i-1]);
  1407.       str_cat(telegram_buf, buf);
  1408. !     push_message(TELEG_PLAYER_AUTO, i, telegram_buf, COMBAT);
  1409.         }
  1410.   
  1411. !     for (i=1; i<=Num_races; i++) {
  1412. !         planet->info[i-1].prod_res = prod_res[i-1];
  1413. !         planet->info[i-1].prod_fuel = prod_fuel[i-1];
  1414. !         planet->info[i-1].prod_dest = prod_destruct[i-1];
  1415.        if (planet->info[i-1].autorep) {
  1416.   check(planet,8);
  1417.   /*      planet->info[i-1].autorep = planet->info[i-1].autorep - 1; */
  1418.   check(planet,85);
  1419. ***************
  1420. *** 445,450 ****
  1421. --- 447,456 ----
  1422.         sprintf(buf, "Total      Prod: %dr %df %dd\n", prod_res[i-1], prod_fuel[i-1],
  1423.               prod_destruct[i-1]);
  1424.       str_cat(telegram_buf, buf);
  1425. +     if(prod_crystals[i-1]) {
  1426. +         sprintf(buf, "    %d crystals found\n", prod_crystals[i-1]);
  1427. +         str_cat(telegram_buf, buf);
  1428. +             }
  1429.   
  1430.       if(tot_captured) {
  1431.         sprintf(buf,"%d sectors captured\n", tot_captured);
  1432. ***************
  1433. *** 468,476 ****
  1434.           str_cat(telegram_buf, buf);
  1435.         }
  1436.   
  1437. !  push_message(TELEG_PLAYER_AUTO, i, telegram_buf);
  1438.   
  1439.       }
  1440.   check(planet,9);
  1441.   
  1442.          /* find out who is on this planet, for nova notification */
  1443. --- 474,483 ----
  1444.           str_cat(telegram_buf, buf);
  1445.         }
  1446.   
  1447. !  push_message(TELEG_PLAYER_AUTO, i, telegram_buf, TELEGRAM);
  1448.   
  1449.       }
  1450. + }
  1451.   check(planet,9);
  1452.   
  1453.          /* find out who is on this planet, for nova notification */
  1454. ***************
  1455. *** 486,492 ****
  1456.           str_cat(telegram_buf, buf);
  1457.                 for (i=1; i<=Num_races; i++)
  1458.           if (planet->info[i-1].numsectsowned) {
  1459. !         push_message(TELEG_PLAYER_AUTO, i, telegram_buf);
  1460.           }
  1461.        }
  1462.   
  1463. --- 493,499 ----
  1464.           str_cat(telegram_buf, buf);
  1465.                 for (i=1; i<=Num_races; i++)
  1466.           if (planet->info[i-1].numsectsowned) {
  1467. !         push_message(TELEG_PLAYER_AUTO, i, telegram_buf, TELEGRAM);
  1468.           }
  1469.        }
  1470.   
  1471. ***************
  1472. *** 498,504 ****
  1473.       this requires that you be the only one inhabiting the planet */
  1474.   
  1475.       if (planet->info[i-1].numsectsowned > 0) {
  1476. !         int aliensects=0,stolenres=0,stolendes=0,stolenfuel=0;
  1477.           int stuff=0;
  1478.   
  1479.   
  1480. --- 505,512 ----
  1481.       this requires that you be the only one inhabiting the planet */
  1482.   
  1483.       if (planet->info[i-1].numsectsowned > 0) {
  1484. !         int aliensects=0;
  1485. !         int stolenres=0,stolendes=0,stolenfuel=0, stolencrystals=0;
  1486.           int stuff=0;
  1487.   
  1488.   
  1489. ***************
  1490. *** 508,514 ****
  1491.               aliensects += planet->info[j-1].numsectsowned;
  1492.               if(planet->info[j-1].resource >0 ||
  1493.                  planet->info[j-1].destruct >0 ||
  1494. !                planet->info[j-1].fuel > 0.0) stuff=1;
  1495.               }
  1496.   
  1497.           if(!aliensects && stuff)
  1498. --- 516,523 ----
  1499.               aliensects += planet->info[j-1].numsectsowned;
  1500.               if(planet->info[j-1].resource >0 ||
  1501.                  planet->info[j-1].destruct >0 ||
  1502. !                planet->info[j-1].fuel > 0.0 ||
  1503. !                planet->info[j-1].crystals) stuff=1;
  1504.               }
  1505.   
  1506.           if(!aliensects && stuff)
  1507. ***************
  1508. *** 519,537 ****
  1509.                 stolenres += planet->info[j-1].resource;
  1510.                 stolendes += planet->info[j-1].destruct;
  1511.                 stolenfuel += planet->info[j-1].fuel;
  1512.                 planet->info[j-1].resource = 0;
  1513.                 planet->info[j-1].destruct = 0;
  1514.                 planet->info[j-1].fuel = 0;
  1515. !             }
  1516.           planet->info[i-1].resource += stolenres;
  1517.           planet->info[i-1].destruct += stolendes;
  1518.           planet->info[i-1].fuel += stolenfuel;
  1519. ! /* notify player of recovered stockpiles */
  1520.         sprintf(telegram_buf,"****** Report: Planet /%s/%s ******\n\n", 
  1521.           Stars[starnum]->name, Stars[starnum]->pnames[planetnum] );
  1522. !       sprintf(buf," %d resources \n %d destruct \n %d fuel recovered from alien stock piles",stolenres,stolendes,stolenfuel);
  1523.       str_cat(telegram_buf, buf);
  1524. !     push_message(TELEG_PLAYER_AUTO, i, telegram_buf);
  1525.               } /*aliensect==0*/
  1526.           }
  1527.   
  1528. --- 528,549 ----
  1529.                 stolenres += planet->info[j-1].resource;
  1530.                 stolendes += planet->info[j-1].destruct;
  1531.                 stolenfuel += planet->info[j-1].fuel;
  1532. +               stolencrystals += planet->info[j-1].crystals;
  1533.                 planet->info[j-1].resource = 0;
  1534.                 planet->info[j-1].destruct = 0;
  1535.                 planet->info[j-1].fuel = 0;
  1536. !               planet->info[j-1].crystals = 0;
  1537. !               }
  1538.           planet->info[i-1].resource += stolenres;
  1539.           planet->info[i-1].destruct += stolendes;
  1540.           planet->info[i-1].fuel += stolenfuel;
  1541. !         planet->info[i-1].crystals += stolencrystals;
  1542. !         /* notify player of recovered stockpiles */
  1543.         sprintf(telegram_buf,"****** Report: Planet /%s/%s ******\n\n", 
  1544.           Stars[starnum]->name, Stars[starnum]->pnames[planetnum] );
  1545. !       sprintf(buf," %d resources \n %d destruct \n %d fuel\n %d crystals recovered from alien stock piles",stolenres,stolendes,stolenfuel,stolencrystals);
  1546.       str_cat(telegram_buf, buf);
  1547. !     push_message(TELEG_PLAYER_AUTO, i, telegram_buf, TELEGRAM);
  1548.               } /*aliensect==0*/
  1549.           }
  1550.   
  1551. ***************
  1552. *** 558,564 ****
  1553.       else if (planet->conditions[TOXIC] < 0)
  1554.          planet->conditions[TOXIC] = 0;
  1555.   
  1556. !     /* deal with enslaved planets */
  1557.      if (planet->slaved_to) {
  1558.       if (populations[planet->slaved_to-1] >= planet->popn * 0.001 ||
  1559.           (Stinfo[starnum][planetnum].intimidated && random()&01) ) {
  1560. --- 570,583 ----
  1561.       else if (planet->conditions[TOXIC] < 0)
  1562.          planet->conditions[TOXIC] = 0;
  1563.   
  1564. ! Getxysect(planet, &x, &y, 1);
  1565. ! while (Getxysect(planet, &x, &y, 0)) {
  1566. !        p = &Sector(*planet,x,y);
  1567. !      if (p->owner)
  1568. !          planet->info[p->owner-1].popn += p->popn;
  1569. !  }
  1570. ! /* deal with enslaved planets */
  1571.      if (planet->slaved_to) {
  1572.       if (populations[planet->slaved_to-1] >= planet->popn * 0.001 ||
  1573.           (Stinfo[starnum][planetnum].intimidated && random()&01) ) {
  1574. ***************
  1575. *** 601,607 ****
  1576.                   p->is_wasted = 1;
  1577.                  }
  1578.               }
  1579. !         }
  1580.           sprintf(telegram_buf,"NOTICE from planet /%s/%s!\n",
  1581.                   Stars[starnum]->name,
  1582.                   Stars[starnum]->pnames[planetnum]);
  1583. --- 620,629 ----
  1584.                   p->is_wasted = 1;
  1585.                  }
  1586.               }
  1587. ! /* also add up the populations while here */
  1588. !             
  1589. !             }
  1590.           sprintf(telegram_buf,"NOTICE from planet /%s/%s!\n",
  1591.                   Stars[starnum]->name,
  1592.                   Stars[starnum]->pnames[planetnum]);
  1593. ***************
  1594. *** 613,622 ****
  1595.               str_cat(telegram_buf, buf);
  1596.           for (i=1; i<=Num_races; i++)
  1597.             if (planet->info[i-1].numsectsowned && i!=planet->slaved_to) {
  1598. !             push_message(TELEG_PLAYER_AUTO, i, telegram_buf);
  1599.               }
  1600.            /* send to previous slave holder */
  1601. !     push_message(TELEG_PLAYER_AUTO, planet->slaved_to, telegram_buf);
  1602.   
  1603.           planet->slaved_to = 0;
  1604.           planet->is_sheep = 0;
  1605. --- 635,644 ----
  1606.               str_cat(telegram_buf, buf);
  1607.           for (i=1; i<=Num_races; i++)
  1608.             if (planet->info[i-1].numsectsowned && i!=planet->slaved_to) {
  1609. !             push_message(TELEG_PLAYER_AUTO, i, telegram_buf, TELEGRAM);
  1610.               }
  1611.            /* send to previous slave holder */
  1612. !     push_message(TELEG_PLAYER_AUTO, planet->slaved_to, telegram_buf, TELEGRAM);
  1613.   
  1614.           planet->slaved_to = 0;
  1615.           planet->is_sheep = 0;
  1616. ***************
  1617. *** 628,654 ****
  1618.   
  1619.         if (planet->info[i-1].numsectsowned) {
  1620.   
  1621. !          if (planet->info[i-1].fuel + prod_fuel[i-1] > 100000)
  1622. !           planet->info[i-1].fuel = 100000;
  1623.           else
  1624.             planet->info[i-1].fuel += prod_fuel[i-1];
  1625.   
  1626. !          if (planet->info[i-1].resource + prod_res[i-1] > 100000)
  1627. !           planet->info[i-1].resource = 100000;
  1628.           else
  1629.             planet->info[i-1].resource += prod_res[i-1];
  1630.   
  1631. !          if (planet->info[i-1].destruct + prod_destruct[i-1] > 100000)
  1632. !           planet->info[i-1].destruct = 100000;
  1633.           else
  1634.             planet->info[i-1].destruct += prod_destruct[i-1];
  1635.   
  1636. !         /* do tech investments */
  1637.          if (planet->info[i-1].resource >= planet->info[i-1].tech_invest) {
  1638. !          races[i-1]->tech += 
  1639. !             log10(1.0+(double)planet->info[i-1].tech_invest) * TECH_INVEST;
  1640.            planet->info[i-1].resource -= planet->info[i-1].tech_invest;
  1641. !        }
  1642.   
  1643.          /* build wc's if it's been ordered */
  1644.         if (planet->info[i-1].tox_thresh>0 &&
  1645. --- 650,684 ----
  1646.   
  1647.         if (planet->info[i-1].numsectsowned) {
  1648.   
  1649. !          if (planet->info[i-1].fuel + prod_fuel[i-1] > 65567)
  1650. !           planet->info[i-1].fuel = 65567;
  1651.           else
  1652.             planet->info[i-1].fuel += prod_fuel[i-1];
  1653.   
  1654. !          if (planet->info[i-1].resource + prod_res[i-1] > 65567)
  1655. !           planet->info[i-1].resource = 65567;
  1656.           else
  1657.             planet->info[i-1].resource += prod_res[i-1];
  1658.   
  1659. !          if (planet->info[i-1].destruct + prod_destruct[i-1] > 65567)
  1660. !           planet->info[i-1].destruct = 65567;
  1661.           else
  1662.             planet->info[i-1].destruct += prod_destruct[i-1];
  1663.   
  1664. !         if (planet->info[i-1].crystals + prod_crystals[i-1] > 127)
  1665. !           planet->info[i-1].crystals = 127;
  1666. !         else
  1667. !           planet->info[i-1].crystals += prod_crystals[i-1];
  1668. !         /* do tech investments */
  1669.          if (planet->info[i-1].resource >= planet->info[i-1].tech_invest) {
  1670. !           planet->info[i-1].prod_tech =
  1671. !           tech_prod((int)planet->info[i-1].tech_invest,
  1672. !                   (int)planet->info[i-1].popn);
  1673.            planet->info[i-1].resource -= planet->info[i-1].tech_invest;
  1674. !          races[i-1]->tech += planet->info[i-1].prod_tech;
  1675. !        } else
  1676. !           planet->info[i-1].prod_tech;
  1677.   
  1678.          /* build wc's if it's been ordered */
  1679.         if (planet->info[i-1].tox_thresh>0 &&
  1680. ***************
  1681. *** 665,679 ****
  1682.   
  1683.           s2->armor = Shipdata[OTYPE_TOXWC][ABIL_ARMOR];
  1684.           s2->guns = Shipdata[OTYPE_TOXWC][ABIL_GUNS];
  1685. -         s2->size = Shipdata[OTYPE_TOXWC][ABIL_TARGET];
  1686.           s2->max_crew = Shipdata[OTYPE_TOXWC][ABIL_MAXCREW];
  1687.           s2->max_resource = Shipdata[OTYPE_TOXWC][ABIL_CARGO];
  1688.           s2->max_fuel = Shipdata[OTYPE_TOXWC][ABIL_FUELCAP];
  1689.           s2->max_destruct = Shipdata[OTYPE_TOXWC][ABIL_DESTCAP];
  1690.           s2->max_speed = Shipdata[OTYPE_TOXWC][ABIL_SPEED];
  1691. !         s2->base_mass = getmass(s2);
  1692.           s2->mass = s2->base_mass;
  1693.            s2->is_alive = 1;
  1694.           sprintf(s2->name,"Scum%04d",Num_ships);
  1695.   
  1696.           insert_sh_plan(planet,s2,Num_ships);
  1697. --- 695,711 ----
  1698.   
  1699.           s2->armor = Shipdata[OTYPE_TOXWC][ABIL_ARMOR];
  1700.           s2->guns = Shipdata[OTYPE_TOXWC][ABIL_GUNS];
  1701.           s2->max_crew = Shipdata[OTYPE_TOXWC][ABIL_MAXCREW];
  1702.           s2->max_resource = Shipdata[OTYPE_TOXWC][ABIL_CARGO];
  1703.           s2->max_fuel = Shipdata[OTYPE_TOXWC][ABIL_FUELCAP];
  1704.           s2->max_destruct = Shipdata[OTYPE_TOXWC][ABIL_DESTCAP];
  1705.           s2->max_speed = Shipdata[OTYPE_TOXWC][ABIL_SPEED];
  1706. !         s2->build_cost = Shipdata[OTYPE_TOXWC][ABIL_COST];
  1707. !         s2->size = ship_size(s2);
  1708. !          s2->base_mass = 1.0; /* a hack */
  1709.           s2->mass = s2->base_mass;
  1710.            s2->is_alive = 1;
  1711. +         s2->active = 1;
  1712.           sprintf(s2->name,"Scum%04d",Num_ships);
  1713.   
  1714.           insert_sh_plan(planet,s2,Num_ships);
  1715. ***************
  1716. *** 707,714 ****
  1717.       Power[i-1].resource += planet->info[i-1].resource;
  1718.       Power[i-1].destruct += planet->info[i-1].destruct;
  1719.       Power[i-1].fuel += planet->info[i-1].fuel;
  1720. -     Power[i-1].planets_owned += !!planet->info[i-1].numsectsowned;
  1721.       Power[i-1].sectors_owned += planet->info[i-1].numsectsowned;
  1722.   /*    Power[i-1].sum_mob += avg_mob[i-1]; */
  1723.    }
  1724.   
  1725. --- 739,746 ----
  1726.       Power[i-1].resource += planet->info[i-1].resource;
  1727.       Power[i-1].destruct += planet->info[i-1].destruct;
  1728.       Power[i-1].fuel += planet->info[i-1].fuel;
  1729.       Power[i-1].sectors_owned += planet->info[i-1].numsectsowned;
  1730. +     Power[i-1].planets_owned += !!planet->info[i-1].numsectsowned;
  1731.   /*    Power[i-1].sum_mob += avg_mob[i-1]; */
  1732.    }
  1733.   
  1734.