home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
games
/
volume10
/
gb3
/
patch2d
/
patches02a
Wrap
Text File
|
1990-08-28
|
54KB
|
1,781 lines
*** /usr/cna/billr/games/gb3/README Fri Jun 1 11:52:49 1990
--- README Thu Aug 23 14:00:15 1990
***************
*** 32,38 ****
then tells the server to do an update. The default update time is 4 hours,
but you can change that with 'GB_daemon <hours between updates>'. It is a
good idea to make your update times a factor of 24 hours. If you want to
! force an update just do 'GB_doturn' by itself.
Players cannot enroll by themselves in this version. The game's host
must do that by running 'GB_enroll' and following the instructions. It
--- 32,38 ----
then tells the server to do an update. The default update time is 4 hours,
but you can change that with 'GB_daemon <hours between updates>'. It is a
good idea to make your update times a factor of 24 hours. If you want to
! force an update just telnet to the server and enter the update password.
Players cannot enroll by themselves in this version. The game's host
must do that by running 'GB_enroll' and following the instructions. It
***************
*** 71,73 ****
--- 71,81 ----
Bill Randle
billr@saab.CNA.TEK.COM
6/1/90
+
+
+ Patchlevel 2 reflects the changes necessary to bring this version up
+ to level 1.3.1 client and level 2.2.3 server.
+
+ Bill Randle
+ billr@saab.CNA.TEK.COM
+ 8/24/90
*** /usr/cna/billr/games/gb3/README_ORIG Wed May 30 15:10:28 1990
--- README_ORIG Wed Aug 22 11:42:01 1990
***************
*** 1,3 ****
--- 1,6 ----
+ (Note: This is the README which came along with GB .975 in April 1989 -
+ It is currently outdated and is included for historical interest only - G.vC)
+
This is a game of interstellar exploration/conquest. By the time I
realized there really wasn't going to be much fighting going on in the game, I
*** /usr/cna/billr/games/gb3/server/GB_server.c Thu May 31 10:10:25 1990
--- server/GB_server.c Fri Aug 24 15:02:35 1990
***************
*** 45,51 ****
#include <netinet/in.h>
#include <netdb.h>
! /*#include <time.h> /* included by <sys/time.h> with bsd */
#include <sys/timeb.h>
#include <curses.h>
--- 45,51 ----
#include <netinet/in.h>
#include <netdb.h>
! /*#include <time.h>*/
#include <sys/timeb.h>
#include <curses.h>
***************
*** 84,94 ****
char start_buf[128];
char update_buf[128];
! static const char *connect_fail = "Connection refused.\n";
! static const char *create_fail = "Connection refused.\n";
! static const char *flushed_message = "<Output Flushed>\n";
! static const char *shutdown_message = "Shutdown ordered by deity - Bye\n";
! static const char *already_on = "Connection refused.\n";
int errno;
--- 84,93 ----
char start_buf[128];
char update_buf[128];
! static char *connect_fail = "Connection refused.\n";
! static char *flushed_message = "<Output Flushed>\n";
! static char *shutdown_message = "Shutdown ordered by deity - Bye\n";
! static char *already_on = "Connection refused.\n";
int errno;
***************
*** 134,140 ****
void welcome_user();
void check_connect();
void close_sockets();
! const char *addrout ();
void dump_users();
void set_signals();
struct descriptor_data *new_connection();
--- 133,139 ----
void welcome_user();
void check_connect();
void close_sockets();
! char *addrout ();
void dump_users();
void set_signals();
struct descriptor_data *new_connection();
***************
*** 180,187 ****
{
int maim_stardata, s;
int i, j, dummy;
- #ifdef BSD4_2
char zone[16];
struct timeval tp;
struct timezone tzp;
#endif
--- 179,186 ----
{
int maim_stardata, s;
int i, j, dummy;
char zone[16];
+ #ifdef BSD4_2
struct timeval tp;
struct timezone tzp;
#endif
***************
*** 222,260 ****
}
Putblock(Blocks);
! Num_races = Numraces();
! /* compute alliance block power */
! sprintf(Power_blocks.time, "%2d/%2d/%d %02d:%02d:%02d %s",
! current_tm->tm_mon+1, current_tm->tm_mday,
! current_tm->tm_year, current_tm->tm_hour,
! current_tm->tm_min, current_tm->tm_sec, zone);
! for (i=1; i<=Num_races; i++) {
! dummy=(Blocks[i-1].invite & Blocks[i-1].pledge);
! Power_blocks.members[i-1] = 0;
! Power_blocks.sectors_owned[i-1] = 0;
! Power_blocks.popn[i-1] = 0;
! Power_blocks.ships_owned[i-1] = 0;
! Power_blocks.planets_owned[i-1] = 0;
! Power_blocks.resource[i-1] = 0;
! Power_blocks.fuel[i-1] = 0;
! Power_blocks.destruct[i-1] = 0;
! Power_blocks.VPs[i-1] = 0;
! for(j=1; j<=Num_races; j++)
! if(isset(dummy, j)){
! Power_blocks.members[i-1] += 1;
! Power_blocks.sectors_owned[i-1] += Power[j-1].sectors_owned;
! Power_blocks.popn[i-1] += Power[j-1].popn;
! Power_blocks.ships_owned[i-1] += Power[j-1].ships_owned;
! Power_blocks.planets_owned[i-1] += Power[j-1].planets_owned;
! Power_blocks.resource[i-1] += Power[j-1].resource;
! Power_blocks.fuel[i-1] += Power[j-1].fuel;
! Power_blocks.destruct[i-1] += Power[j-1].destruct;
! Power_blocks.VPs[i-1] += Blocks[j-1].VPs;
! }
! }
-
-
shovechars (argc==1 ? GB_PORT : atoi (argv[1]) );
close_sockets ();
printf("Going down.\n");
--- 221,228 ----
}
Putblock(Blocks);
! compute_power_blocks();
shovechars (argc==1 ? GB_PORT : atoi (argv[1]) );
close_sockets ();
printf("Going down.\n");
***************
*** 363,369 ****
--- 331,339 ----
return;
}
} else {
+
(void) time (&now);
+
if (FD_ISSET (sock, &input_set)) {
if (!(newd = new_connection (sock))) {
if (errno != EINTR && errno != EMFILE) {
***************
*** 375,384 ****
maxd = newd->descriptor + 1;
}
}
for (d = descriptor_list; d; d = dnext) {
dnext = d->next;
if (FD_ISSET (d->descriptor, &input_set)) {
! d->last_time = now;
if (!process_input (d)) {
shutdownsock (d);
continue;
--- 345,355 ----
maxd = newd->descriptor + 1;
}
}
+
for (d = descriptor_list; d; d = dnext) {
dnext = d->next;
if (FD_ISSET (d->descriptor, &input_set)) {
! /* d->last_time = now; */
if (!process_input (d)) {
shutdownsock (d);
continue;
***************
*** 390,395 ****
--- 361,367 ----
}
}
}
+
}
}
}
***************
*** 460,466 ****
}
}
! const char *addrout(a)
long a;
{
static char outbuf[1024];
--- 432,438 ----
}
}
! char *addrout(a)
long a;
{
static char outbuf[1024];
***************
*** 536,542 ****
}
struct text_block *make_text_block(s, n)
! const char *s;
int n;
{
struct text_block *p;
--- 508,514 ----
}
struct text_block *make_text_block(s, n)
! char *s;
int n;
{
struct text_block *p;
***************
*** 559,565 ****
void add_to_queue(q, b, n)
struct text_queue *q;
! const char *b;
int n;
{
struct text_block *p;
--- 531,537 ----
void add_to_queue(q, b, n)
struct text_queue *q;
! char *b;
int n;
{
struct text_block *p;
***************
*** 598,604 ****
int queue_write(d, b, n)
struct descriptor_data *d;
! const char *b;
int n;
{
int space;
--- 570,576 ----
int queue_write(d, b, n)
struct descriptor_data *d;
! char *b;
int n;
{
int space;
***************
*** 613,619 ****
int queue_string(d, s)
struct descriptor_data *d;
! const char *s;
{
return queue_write (d, s, strlen (s));
}
--- 585,591 ----
int queue_string(d, s)
struct descriptor_data *d;
! char *s;
{
return queue_write (d, s, strlen (s));
}
***************
*** 646,651 ****
--- 618,632 ----
return 1;
}
+ void force_output()
+ {
+ struct descriptor_data *d;
+
+ for (d = descriptor_list; d; d = d->next)
+ if (d->connected)
+ process_output(d);
+ }
+
void make_nonblocking(s)
int s;
{
***************
*** 723,733 ****
void goodbye_user(d)
struct descriptor_data *d;
{
write (d->descriptor, LEAVE_MESSAGE, strlen (LEAVE_MESSAGE));
}
char *strsave (s)
! const char *s;
{
char *p;
--- 704,715 ----
void goodbye_user(d)
struct descriptor_data *d;
{
+ if(d->connected) /* this can happen, especially after updates */
write (d->descriptor, LEAVE_MESSAGE, strlen (LEAVE_MESSAGE));
}
char *strsave (s)
! char *s;
{
char *p;
***************
*** 740,746 ****
void save_command (d, command)
struct descriptor_data *d;
! const char *command;
{
add_to_queue (&d->input, command, strlen(command)+1);
--- 722,728 ----
void save_command (d, command)
struct descriptor_data *d;
! char *command;
{
add_to_queue (&d->input, command, strlen(command)+1);
***************
*** 783,789 ****
void set_userstring (userstring, command)
char **userstring;
! const char *command;
{
if (*userstring) {
free(*userstring);
--- 765,771 ----
void set_userstring (userstring, command)
char **userstring;
! char *command;
{
if (*userstring) {
free(*userstring);
***************
*** 795,810 ****
*userstring = strsave (command);
}
- #ifdef __STDC__
- void process_commands(void)
- #else
void process_commands()
- #endif
{
int nprocessed;
struct descriptor_data *d, *dnext;
struct text_block *t;
do {
nprocessed = 0;
for (d = descriptor_list; d; d = dnext) {
--- 777,792 ----
*userstring = strsave (command);
}
void process_commands()
{
int nprocessed;
+ long now;
struct descriptor_data *d, *dnext;
struct text_block *t;
+
+ (void) time (&now);
+
do {
nprocessed = 0;
for (d = descriptor_list; d; d = dnext) {
***************
*** 816,825 ****
--- 798,809 ----
if (!do_command (d, t -> start)) {
shutdownsock (d);
} else {
+ d->last_time = now; /* experimental code */
d -> input.head = t -> nxt;
if (!d -> input.head)
d -> input.tail = &d -> input.head;
free_text_block (t);
+ d->last_time = now; /* experimental code */
}
}
***************
*** 860,873 ****
if(d->connected) {
openracedata(&server_racedata);
! getrace(server_racedata, &r, d->Playernum);
close_file(server_racedata);
! sprintf(buf, "%s (%d) logged out.\n", r->name, d->Playernum);
for(i=1; i<=Numraces(); i++)
if(!Dir[i-1].gag)
notify(i, buf);
! }
goodbye_user (d);
return 0;
} else if (!strcmp (args[0], WHO_COMMAND)) {
--- 844,858 ----
if(d->connected) {
openracedata(&server_racedata);
! getrace(server_racedata, &r, (int)d->Playernum);
close_file(server_racedata);
! sprintf(buf, "%s [%d] logged out.\n", r->name, d->Playernum);
for(i=1; i<=Numraces(); i++)
if(!Dir[i-1].gag)
notify(i, buf);
! free(r);
! }
goodbye_user (d);
return 0;
} else if (!strcmp (args[0], WHO_COMMAND)) {
***************
*** 889,909 ****
}
}
}
return 1;
}
void check_connect (d, msg)
struct descriptor_data *d;
! const char *msg;
{
char password[MAX_COMMAND_LEN];
reg int i;
! int Playernum, Num_races;
racetype *r;
struct descriptor_data *d0, *dnext;
- #ifdef BSD4_2
char zone[16];
- #endif
parse_connect (msg, password);
--- 874,893 ----
}
}
}
+
return 1;
}
void check_connect (d, msg)
struct descriptor_data *d;
! char *msg;
{
char password[MAX_COMMAND_LEN];
reg int i;
! int Playernum, Num_races, racefile;
racetype *r;
struct descriptor_data *d0, *dnext;
char zone[16];
parse_connect (msg, password);
***************
*** 914,920 ****
for (i=1; i<=Num_races; i++)
notify(i, "DOING UPDATE...\n");
!
clk = time(0);
update_tm=localtime(&clk);
#ifdef BSD4_2
--- 898,904 ----
for (i=1; i<=Num_races; i++)
notify(i, "DOING UPDATE...\n");
! force_output();
clk = time(0);
update_tm=localtime(&clk);
#ifdef BSD4_2
***************
*** 922,927 ****
--- 906,925 ----
#else
strcpy(zone, update_tm->tm_zone);
#endif
+
+ /* if hour is 0, allocate daily login time */
+ if(!update_tm->tm_hour) {
+ openracedata(&racefile);
+ for (i=1; i<=Num_races; i++) {
+ getrace(racefile, &r, i);
+ r->daily = DAILY*60;
+ if(!(update_tm->tm_mday%7))
+ r->weekly = WEEKLY*60;
+ putrace(racefile, r);
+ }
+ close_file(racefile);
+ }
+
sprintf(Power_blocks.time, "%2d/%2d/%d %02d:%02d:%02d %s",
update_tm->tm_mon+1, update_tm->tm_mday,
update_tm->tm_year, update_tm->tm_hour,
***************
*** 930,937 ****
update_tm->tm_mon+1, update_tm->tm_mday,
update_tm->tm_year, update_tm->tm_hour,
update_tm->tm_min, update_tm->tm_sec, zone);
! do_turn();
! return;
}
--- 928,937 ----
update_tm->tm_mon+1, update_tm->tm_mday,
update_tm->tm_year, update_tm->tm_hour,
update_tm->tm_min, update_tm->tm_sec, zone);
!
! do_turn();
!
! return;
}
***************
*** 944,950 ****
} else {
openracedata(&server_racedata);
! getrace(server_racedata, &r, i);
close_file(server_racedata);
Playernum = r->Playernum;
--- 944,950 ----
} else {
openracedata(&server_racedata);
! getrace(server_racedata, &r, (int)i);
close_file(server_racedata);
Playernum = r->Playernum;
***************
*** 958,976 ****
}
}
! fprintf (stderr, "CONNECTED %s(%d) on descriptor %d\n",
r->name, Playernum, d->descriptor);
d->connected = 1;
d->Playernum = Playernum;
! sprintf(buf,"\nLogged in as %s (%d).\n",r->name,Playernum);
notify(Playernum, buf);
! sprintf(buf, "%s (%d) logged on.\n", r->name, Playernum);
for(i=1; i<=Numraces(); i++)
if(i != Playernum && !Dir[i-1].gag) notify(i, buf);
! GB_time(Playernum);
if (r->Gov_ship==0) {
sprintf(buf,"You have no Governmental Center. No action points will be produced\nuntil you build one and designate a capital.\n");
notify(Playernum, buf);
--- 958,977 ----
}
}
! fprintf (stderr, "CONNECTED %s [%d] on descriptor %d\n",
r->name, Playernum, d->descriptor);
d->connected = 1;
d->Playernum = Playernum;
! sprintf(buf,"\nLogged in as %s [%d].\n",r->name,Playernum);
notify(Playernum, buf);
! sprintf(buf, "%s [%d] logged on.\n", r->name, Playernum);
for(i=1; i<=Numraces(); i++)
if(i != Playernum && !Dir[i-1].gag) notify(i, buf);
! GB_time(Playernum, r, 0);
! if(r->standby) notify(Playernum, "Standing by\n");
if (r->Gov_ship==0) {
sprintf(buf,"You have no Governmental Center. No action points will be produced\nuntil you build one and designate a capital.\n");
notify(Playernum, buf);
***************
*** 978,988 ****
sprintf(buf,"Government Center #%d is active.\n", r->Gov_ship);
notify(Playernum, buf);
}
! }
}
void parse_connect (msg, pass)
! const char *msg;
char *pass;
{
char *p;
--- 979,994 ----
sprintf(buf,"Government Center #%d is active.\n", r->Gov_ship);
notify(Playernum, buf);
}
! if(!r->daily) {
! notify(Playernum, "You have no daily active time left.\n");
! }
!
! free(r);
! }
}
void parse_connect (msg, pass)
! char *msg;
char *pass;
{
char *p;
***************
*** 995,1005 ****
*p = '\0';
}
- #ifdef __STDC__
- void close_sockets(void)
- #else
void close_sockets()
- #endif
{
struct descriptor_data *d, *dnext;
--- 1001,1007 ----
***************
*** 1013,1034 ****
close (sock);
}
- #ifdef __STDC__
- void emergency_shutdown(void)
- #else
void emergency_shutdown()
- #endif
{
close_sockets();
}
! #ifdef __STDC__
! int bailout(int sig, int code, struct sigcontext *scp)
! #else
! int bailout(sig, code, scp)
! int sig, code;
struct sigcontext *scp;
- #endif
{
char message[1024];
--- 1015,1029 ----
close (sock);
}
void emergency_shutdown()
{
close_sockets();
}
! int bailout(sig ,code,scp)
! int sig;
! int code;
struct sigcontext *scp;
{
char message[1024];
***************
*** 1038,1048 ****
return 0;
}
- #ifdef __STDC__
- int dump_status(void)
- #else
int dump_status()
- #endif
{
struct descriptor_data *d;
long now;
--- 1033,1039 ----
***************
*** 1053,1061 ****
openracedata(&server_racedata);
for (d = descriptor_list; d; d = d->next) {
if (d->connected) {
! getrace(server_racedata, &r, d->Playernum);
fprintf (stderr, "PLAYING descriptor %d Playernum %s(%d)",
d->descriptor, r->name, d->Playernum);
if (d->last_time)
fprintf (stderr, " idle %d seconds\n",
--- 1044,1053 ----
openracedata(&server_racedata);
for (d = descriptor_list; d; d = d->next) {
if (d->connected) {
! getrace(server_racedata, &r, (int)d->Playernum);
fprintf (stderr, "PLAYING descriptor %d Playernum %s(%d)",
d->descriptor, r->name, d->Playernum);
+ free(r);
if (d->last_time)
fprintf (stderr, " idle %d seconds\n",
***************
*** 1087,1120 ****
openracedata(&server_racedata);
for (d = descriptor_list; d; d = d->next) {
if (d->connected) {
! getrace(server_racedata, &r, d->Playernum);
if (d->last_time)
! sprintf (buf, "%20s (%3d) seconds idle %d\n", r->name,
! d->Playernum, now - d->last_time);
else
! sprintf (buf, "%20s (%3d) idle forever\n", r->name, d->Playernum);
queue_string (e, buf);
}
}
close_file(server_racedata);
}
void process_command(Playernum, command)
/* locate and parse the command for processing */
int Playernum;
char *command;
{
! int i,argn=0;
boolean parse_exit=0;
char args[MAXARGS][COMMANDSIZE];
char *string, *announcement, *dummy;
- openracedata(&server_racedata);
- free(Race);
- getrace(server_racedata, &Race, Playernum);
- close_file(server_racedata);
-
string=command; /* make pointers the same */
while (!parse_exit) {
--- 1079,1129 ----
openracedata(&server_racedata);
for (d = descriptor_list; d; d = d->next) {
if (d->connected) {
! getrace(server_racedata, &r, (int)d->Playernum);
if (d->last_time)
! sprintf (buf, "%20s [%2d] [%d:%d] seconds idle %d %s %s\n", r->name,
! d->Playernum, r->weekly/60, r->daily/60, now - d->last_time, (r->gag ? "GAG": ""),
! (r->standby ? "STAND BY" : ""));
else
! sprintf (buf, "%20s [%2d] idle forever\n", r->name, d->Playernum);
queue_string (e, buf);
+ free(r);
+ if((now - d->last_time) > DISCONNECT_TIME)
+ d->connected = 0;
}
}
close_file(server_racedata);
}
+ int daily_time(r)
+ racetype *r;
+ {
+ struct descriptor_data *d;
+ long now;
+ int time_left;
+
+ time_left = r->daily;
+
+ (void) time (&now);
+ for (d = descriptor_list; d; d = d->next)
+ if (d->connected && d->last_time && (d->Playernum==r->Playernum)) {
+ time_left = MAX(0, r->daily - (now - d->last_time));
+ }
+ return time_left;
+ }
+
void process_command(Playernum, command)
/* locate and parse the command for processing */
int Playernum;
char *command;
{
! int i, j,argn=0, God, ok, old;
boolean parse_exit=0;
char args[MAXARGS][COMMANDSIZE];
char *string, *announcement, *dummy;
+ racetype *r;
string=command; /* make pointers the same */
while (!parse_exit) {
***************
*** 1138,1207 ****
/* target routine is specified by the first substring, other options
are the substrings which follow */
if (!strncmp(args[0],"announce",i))
announce(Playernum,0,argn,args, 0);
! else if (!strncmp(args[0],"allocate",i)) allocateAPs(Playernum,0, argn, args);
! else if (!strncmp(args[0],"assault",i)) land(Playernum,1,argn,args,1);
else if (!strncmp(args[0], "autoreport",i)) autoreport(Playernum, 0, argn, args);
! else if (!strncmp(args[0],"build",i)) build(Playernum,1,argn,args);
! else if (!strncmp(args[0], "broadcast", i)) announce(Playernum, 5*(!Race->God), argn, args, 1);
! else if (!strncmp(args[0], "block", i)) block(Playernum, 0, argn, args);
! else if (!strncmp(args[0],"capitol",i)) capitol(Playernum,50,argn,args);
! else if (!strncmp(args[0],"capture",i)) capture(Playernum,1,argn,args);
else if (!strncmp(args[0], "center", i)) center(Playernum, 0, argn, args);
else if (!strncmp(args[0],"cs",i)) cs(Playernum,0,argn,args);
! else if (!strncmp(args[0],"declare",i)) declare(Playernum,1,argn,args);
! else if (!strncmp(args[0],"dock",i)) land(Playernum,0,argn,args,0);
! else if (!strncmp(args[0],"enslave",i)) enslave(Playernum,2,argn,args);
! else if (!strncmp(args[0],"examine",i)) examine(Playernum,0,argn,args);
! else if (!strncmp(args[0],"explore",i)) exploration(Playernum,0,argn,args);
! else if (!strncmp(args[0],"fire",i)) fire(Playernum,1,argn,args);
! else if (!strncmp(args[0], "gag", i)) Dir[Playernum-1].gag = !Dir[Playernum-1].gag;
! else if (!strncmp(args[0],"give",i)) give(Playernum,5,argn,args);
else if (!strncmp(args[0], "identify", i)) whois(Playernum, 0, argn, args);
! else if (!strncmp(args[0], "invite", i)) invite(Playernum, 0, argn, args, 1);
! else if (!strncmp(args[0],"land",i)) land(Playernum,1,argn,args,0);
! else if (!strncmp(args[0],"launch",i)) launch(Playernum,1,argn,args);
! else if (!strncmp(args[0], "list", i) && Race->God) list(Playernum);
! else if (!strncmp(args[0],"load",i)) load(Playernum,0,argn,args);
! else if (!strncmp(args[0],"map",i)) map(Playernum,0,argn,args);
! else if (!strncmp(args[0],"mobilize",i)) mobilize(Playernum,1,argn,args);
! else if (!strncmp(args[0],"move",i)) move_popn(Playernum,1,argn,args);
! else if (!strncmp(args[0],"make", i)) make_mod(Playernum, 0, argn, args, 0);
! else if (!strncmp(args[0],"modify", i)) make_mod(Playernum, 0, argn, args, 1);
! else if (!strncmp(args[0],"name",i)) name(Playernum,1*(!Race->God),argn,args);
! else if (!strncmp(args[0],"object",i)) rst(Playernum,0,argn,args,4);
! else if (!strncmp(args[0],"orbit",i)) orbit(Playernum,0,argn,args);
! else if (!strncmp(args[0],"order",i)) order(Playernum,1,argn,args);
! else if (!strncmp(args[0],"page",i)) page(Playernum, 1*(!Race->God), argn, args);
! else if (!strncmp(args[0],"colonies",i)) colonies(Playernum,0,argn,args);
! else if (!strncmp(args[0], "pledge", i)) pledge(Playernum, 0, argn, args, 1);
! else if (!strncmp(args[0],"power",i)) power(Playernum,0,argn,args);
! else if (!strncmp(args[0],"profile",i)) profile(Playernum,0,argn,args);
! else if (!strncmp(args[0],"relation",i)) relation(Playernum,0,argn,args);
else if (!strncmp(args[0],"read",i)) read_messages(Playernum,0,argn,args);
! else if (!strncmp(args[0],"reset", i) && Race->God) reload_star_data_base();
! else if (!strncmp(args[0],"report",i)) rst(Playernum,0,argn,args,0);
! else if (!strncmp(args[0],"@@shutdown",i) && Race->God) {
shutdown_flag = 1;
notify(Playernum, "Doing shutdown.\n");
! } else if (!strncmp(args[0],"stock",i)) rst(Playernum,0,argn,args,1);
! else if (!strncmp(args[0],"ship",i)) rst(Playernum,0,argn,args,3);
! else if (!strncmp(args[0],"survey",i)) survey(Playernum,0,argn,args);
! else if (!strncmp(args[0], "send", i)) send_message(Playernum, 1*(!Race->God), argn, args);
! else if (!strncmp(args[0],"scrap",i)) scrap(Playernum,1,argn,args);
! else if(!strncmp(args[0],"tactical",i)) rst(Playernum,0,argn,args,2);
! /* else if (!strncmp(args[0],"telegram",i)) telegram(Playernum,0,argn,args); */
! else if(!strncmp(args[0],"technology",i)) technology(Playernum,1,argn,args);
else if (!strncmp(args[0],"toggle",i)) toggle(Playernum,0,argn,args);
! else if(!strncmp(args[0],"toxicity",i)) toxicity(Playernum,1,argn,args);
! else if (!strncmp(args[0],"transfer",i)) transfer(Playernum,1,argn,args);
! else if (!strncmp(args[0],"unload",i)) load(Playernum,0,argn,args);
! else if (!strncmp(args[0],"undock",i)) launch(Playernum,0,argn,args);
! else if (!strncmp(args[0], "uninvite", i)) invite(Playernum, 0, argn, args, 0);
! else if (!strncmp(args[0], "unpledge", i)) pledge(Playernum, 0, argn, args, 0);
! else if (!strncmp(args[0],"time",i)) GB_time(Playernum);
! else if (!strncmp(args[0],"zoom",i)) zoom(Playernum,0,argn,args);
/* only owning player can use fix */
else {
sprintf(buf,"'%s':illegal command error(%d).\n",args[0],*args[0]);
--- 1147,1252 ----
/* target routine is specified by the first substring, other options
are the substrings which follow */
+ openracedata(&server_racedata);
+ getrace(server_racedata, &r, Playernum);
+ old = r->daily;
+ God = r->God;
+ if(!r->standby && r->daily) {
+ r->daily = (short)daily_time(r);
+ putrace(server_racedata, r);
+ }
+ close_file(server_racedata);
+
+ ok = ((!r->standby && r->daily) || God); /* whether or not the player can execture the command */
+
if (!strncmp(args[0],"announce",i))
announce(Playernum,0,argn,args, 0);
! else if (!strncmp(args[0],"allocate",i) && ok) allocateAPs(Playernum,0, argn, args);
! else if (!strncmp(args[0],"assault",i) && ok) dock(Playernum,1,argn,args,1);
else if (!strncmp(args[0], "autoreport",i)) autoreport(Playernum, 0, argn, args);
! else if (!strncmp(args[0],"build",i) && ok) build(Playernum,1,argn,args);
! else if (!strncmp(args[0], "'", i) || !strncmp(args[0], "broadcast", i)) announce(Playernum, 0, argn, args, 1);
! else if (!strncmp(args[0], "block", i) && ok) block(Playernum, 0, argn, args);
! else if (!strncmp(args[0],"capitol",i) && ok) capitol(Playernum,50,argn,args);
! else if (!strncmp(args[0],"capture",i) && ok) capture(Playernum,1,argn,args);
else if (!strncmp(args[0], "center", i)) center(Playernum, 0, argn, args);
else if (!strncmp(args[0],"cs",i)) cs(Playernum,0,argn,args);
! else if (!strncmp(args[0],"declare",i) && ok) declare(Playernum,1,argn,args);
! else if (!strncmp(args[0],"detonate",i) && ok) detonate(Playernum,0,argn,args);
! else if (!strncmp(args[0],"dismount", i) && ok) mount(Playernum, 0, argn, args, 0);
! else if (!strncmp(args[0], "dissolve", i)) dissolve(Playernum, argn, args);
! else if (!strncmp(args[0],"dock",i) && ok) dock(Playernum,0,argn,args,0);
! else if (!strncmp(args[0],"dump",i) && ok) dump(Playernum,10,argn,args,0);
! else if (!strncmp(args[0],"enslave",i) && ok) enslave(Playernum,2,argn,args);
! else if (!strncmp(args[0],"examine",i) && ok) examine(Playernum,0,argn,args);
! else if (!strncmp(args[0],"explore",i) && ok) exploration(Playernum,0,argn,args);
! else if (!strncmp(args[0],"fire",i) && ok) fire(Playernum,1,argn,args);
! else if (!strncmp(args[0],"give",i) && ok) give(Playernum,5,argn,args);
! else if (!strncmp(args[0], "highlight", i)) highlight(Playernum, 0, argn, args);
else if (!strncmp(args[0], "identify", i)) whois(Playernum, 0, argn, args);
! else if (!strncmp(args[0], "invite", i) && ok) invite(Playernum, 0, argn, args, 1);
! else if (!strncmp(args[0],"land",i) && ok) land(Playernum,1,argn,args);
! else if (!strncmp(args[0],"launch",i) && ok) launch(Playernum,1,argn,args);
! else if (!strncmp(args[0], "list", i) && God) list(Playernum);
! else if (!strncmp(args[0],"load",i) && ok) load(Playernum,0,argn,args, 0);
! else if (!strncmp(args[0],"map",i) && ok) map(Playernum,0,argn,args);
! else if (!strncmp(args[0],"mobilize",i) && ok) mobilize(Playernum,1,argn,args);
! else if (!strncmp(args[0],"move",i) && ok) move_popn(Playernum,1,argn,args);
! else if (!strncmp(args[0],"make", i) && ok) make_mod(Playernum, 0, argn, args, 0);
! else if (!strncmp(args[0],"modify", i) && ok) make_mod(Playernum, 0, argn, args, 1);
! else if (!strncmp(args[0],"mount", i) && ok) mount(Playernum, 0, argn, args, 1);
! else if (!strncmp(args[0],"motto", i) && ok) motto(Playernum, 0, argn, args);
! else if (!strncmp(args[0],"name",i) && ok) name(Playernum, !God,argn,args);
! else if (!strncmp(args[0],"orbit",i) && ok) orbit(Playernum,0,argn,args);
! else if (!strncmp(args[0],"order",i) && ok) order(Playernum,1,argn,args);
! else if (!strncmp(args[0],"page",i)) page(Playernum, !God, argn, args);
! else if (!strncmp(args[0],"colonies",i) && ok) colonies(Playernum,0,argn,args);
! else if (!strncmp(args[0], "pledge", i) && ok) pledge(Playernum, 0, argn, args, 1);
! else if (!strncmp(args[0],"power",i) && ok) power(Playernum,0,argn,args);
! else if (!strncmp(args[0],"profile",i) && ok) profile(Playernum,0,argn,args);
! else if (!strncmp(args[0],"production", i) && ok) production(Playernum, 0, argn, args);
! else if (!strncmp(args[0],"relation",i) && ok) relation(Playernum,0,argn,args);
else if (!strncmp(args[0],"read",i)) read_messages(Playernum,0,argn,args);
! else if (!strncmp(args[0],"reset", i) && God) {
! for (j=1; j<=Numraces(); j++)
! notify(j, "DOING RESET...\n");
! force_output();
! reload_star_data_base();
! do_reset();
! }
! else if (!strncmp(args[0],"report",i) && ok) rst(Playernum,0,argn,args,0);
! else if (!strncmp(args[0],"repair",i) && ok) repair(Playernum,0,argn,args);
! else if (!strncmp(args[0],"@@shutdown",i) && God) {
shutdown_flag = 1;
notify(Playernum, "Doing shutdown.\n");
! } else if (!strncmp(args[0],"stock",i) && ok) rst(Playernum,0,argn,args,1);
! else if (!strncmp(args[0], "standby", i)) {
! r->standby = !r->standby;
! openracedata(&server_racedata);
! putrace(server_racedata, r);
! close_file(server_racedata);
! if(r->standby) notify(Playernum, "Standing by\n");
! else notify(Playernum, "Returning to active status\n");
! } else if (!strncmp(args[0],"stats",i) && ok) rst(Playernum,0,argn,args,4);
! else if (!strncmp(args[0],"ship",i) && ok) rst(Playernum,0,argn,args,3);
! else if (!strncmp(args[0],"survey",i) && ok) survey(Playernum,0,argn,args);
! else if (!strncmp(args[0], "send", i)) send_message(Playernum, 1*(!God), argn, args);
! else if (!strncmp(args[0],"scrap",i) && ok) scrap(Playernum,1,argn,args);
! else if(!strncmp(args[0],"tactical",i) && ok) rst(Playernum,0,argn,args,2);
! else if(!strncmp(args[0],"technology",i) && ok) technology(Playernum,1,argn,args);
else if (!strncmp(args[0],"toggle",i)) toggle(Playernum,0,argn,args);
! else if(!strncmp(args[0],"toxicity",i) && ok) toxicity(Playernum,1,argn,args);
! else if (!strncmp(args[0],"transfer",i) && ok) transfer(Playernum,1,argn,args);
! else if (!strncmp(args[0],"unload",i) && ok) load(Playernum,0,argn,args, 1);
! else if (!strncmp(args[0],"undock",i) && ok) launch(Playernum,0,argn,args);
! else if (!strncmp(args[0], "uninvite", i) && ok) invite(Playernum, 0, argn, args, 0);
! else if (!strncmp(args[0], "unpledge", i) && ok) pledge(Playernum, 0, argn, args, 0);
! else if (!strncmp(args[0],"time",i)) {
! int alloc;
! if(argn > 1) alloc = atoi(args[1]);
! else alloc = 0;
! GB_time(Playernum, r, alloc);
! } else if (!strncmp(args[0],"zoom",i)) zoom(Playernum,0,argn,args);
/* only owning player can use fix */
else {
sprintf(buf,"'%s':illegal command error(%d).\n",args[0],*args[0]);
***************
*** 1208,1221 ****
notify(Playernum, buf);
}
! /* send the prompt to the player */
! sprintf(buf, "%s", Dir[Playernum-1].prompt);
notify(Playernum, buf);
}
void panic(message)
! const char *message;
{
FILE *f;
int i;
--- 1253,1272 ----
notify(Playernum, buf);
}
! /* compute the prompt and send to the player */
! do_prompt(r);
!
! if(old && !r->daily)
! notify(Playernum, "You're daily time allocation has run out!!!\n");
!
! free(r);
! sprintf(buf, "%s", Dir[Playernum-1].prompt);
notify(Playernum, buf);
}
void panic(message)
! char *message;
{
FILE *f;
int i;
***************
*** 1261,1273 ****
strcat(s1, s2);
}
! GB_time(Playernum) /* report back the update status */
int Playernum;
{
- #ifdef BSD4_2
char zone[16];
- #endif
clk = time(0);
current_tm=localtime(&clk);
#ifdef BSD4_2
--- 1312,1325 ----
strcat(s1, s2);
}
! GB_time(Playernum, r, alloc) /* report back the update status */
int Playernum;
+ racetype *r;
+ int alloc;
{
char zone[16];
+ if(!alloc) {
clk = time(0);
current_tm=localtime(&clk);
#ifdef BSD4_2
***************
*** 1286,1291 ****
--- 1338,1359 ----
notify(Playernum, "No updates since the server was started.\n");
/* can happen if you have just started the game up */
notify(Playernum, start_buf);
+
+ sprintf(buf, "%d/%d weekly/daily minutes of active time remaining.\n", r->weekly/60, r->daily/60);
+ notify(Playernum, buf);
+ } else if(alloc > 0) {
+ printf("%d\n", alloc);
+ alloc = MIN(MIN(alloc*60, r->weekly), DAILY*60 - r->daily)/60;
+ r->weekly -= alloc*60;
+ r->daily += alloc*60;
+ sprintf(buf, "%d minutes of weekly allotment allocated.\n", alloc);
+ notify(Playernum, buf);
+ openracedata(&server_racedata);
+ putrace(server_racedata, r);
+ close_file(server_racedata);
+ } else {
+ notify(Playernum, "You can only allocate a positive number of minutes.\n");
+ }
}
help(e, argn,args)
***************
*** 1299,1327 ****
sprintf(buf,"usage: help [topic]\n");
queue_string(e, buf);
sprintf(buf," valid topics are:\n CONCEPTS:\n%s",
! "help scope actionpoints explore colony\n" );
queue_string(e, buf);
! sprintf(buf,"daemon races blocks quit info\n");
queue_string(e, buf);
sprintf(buf,"\n COMMANDS:\n");
queue_string(e, buf);
! sprintf(buf,"cs map survey orbit zoom autoreport\n");
queue_string(e, buf);
sprintf(buf,"toggle gag capitol allocate\n\n");
queue_string(e, buf);
! sprintf(buf, "announce page who time quit\n");
queue_string(e, buf);
! sprintf(buf,"build ship stock report tactical order examine\n");
queue_string(e, buf);
sprintf(buf,"land launch dock undock load assault scrap\n\n");
queue_string(e, buf);
! sprintf(buf,"assault capture fire give move enslave\n\n");
queue_string(e, buf);
! sprintf(buf,"declare profile relation power explore\n");
queue_string(e, buf);
! sprintf(buf,"colonies name mobilize technology toxicity transfer\n");
queue_string(e, buf);
! sprintf(buf, "make modify\n");
queue_string(e, buf);
} else {
--- 1367,1395 ----
sprintf(buf,"usage: help [topic]\n");
queue_string(e, buf);
sprintf(buf," valid topics are:\n CONCEPTS:\n%s",
! "beginner\nhelp scope actionpoints explore colony\n" );
queue_string(e, buf);
! sprintf(buf,"daemon races blocks quit crystal lasers info\n");
queue_string(e, buf);
sprintf(buf,"\n COMMANDS:\n");
queue_string(e, buf);
! sprintf(buf,"cs map survey orbit zoom autoreport production\n");
queue_string(e, buf);
sprintf(buf,"toggle gag capitol allocate\n\n");
queue_string(e, buf);
! sprintf(buf, "announce page who time standby quit\n");
queue_string(e, buf);
! sprintf(buf,"build ship stock report tactical stats order examine\n");
queue_string(e, buf);
sprintf(buf,"land launch dock undock load assault scrap\n\n");
queue_string(e, buf);
! sprintf(buf,"assault capture fire give move enslave repair\n\n");
queue_string(e, buf);
! sprintf(buf,"declare profile relation power explore detonate\n");
queue_string(e, buf);
! sprintf(buf,"colonies dump name motto mobilize technology toxicity transfer\n");
queue_string(e, buf);
! sprintf(buf, "make modify mount\n");
queue_string(e, buf);
} else {
***************
*** 1356,1358 ****
--- 1424,1513 ----
if(sbuf.st_size)
notify(Playernum, "You have telegram(s) waiting. Use 'read' to read them.\n");
}
+
+ kill_ship(Playernum, ship)
+ int Playernum;
+ shiptype *ship;
+ {
+ racetype *r;
+ shiptype *s;
+ int kill_racedata, kill_shdata, sh;
+
+ ship->is_alive = 0;
+ ship->popn = 0;
+ ship->damage = 100;
+ ship->notified = 0;
+ if(ship->type==OTYPE_GOV) {
+ openracedata(&kill_racedata);
+ getrace(kill_racedata, &r, (int)ship->owner);
+ r->Gov_ship = 0;
+ putrace(kill_racedata, r);
+ close_file(kill_racedata);
+ free(r);
+ }
+
+ /* undock the stuff docked with it */
+ if(ship->is_docked && ship->whatdest==LEVEL_SHIP) {
+ openshdata(&kill_shdata);
+ getship(kill_shdata, &s, ship->destshipno);
+ s->is_docked = 0;
+ s->whatdest = LEVEL_UNIV;
+ putship(kill_shdata, s, ship->destshipno);
+ free(s);
+ }
+ /* fighters are destroyed if one board a carrier */
+ if(ship->type==STYPE_CARRIER) {
+ sh=ship->object.number;
+ openshdata(&kill_shdata);
+ while(sh) {
+ (void)getship(kill_shdata, &s, sh);
+ s->is_alive = 0; s->notified = 0;
+ putship(kill_shdata, s, sh);
+ sh = s->object.number;
+ free(s);
+ }
+ close_file(kill_shdata);
+ }
+
+ /* if the ship is a VN, keep track of who killed it */
+ if(ship->type==OTYPE_VN) {
+ ship->object.number3 = Playernum; /* remember who killed it */
+ }
+ }
+
+ compute_power_blocks()
+ {
+ int i, j, dummy;
+ Num_races = Numraces();
+ /* compute alliance block power */
+ sprintf(Power_blocks.time, "%2d/%2d/%d %02d:%02d:%02d %s",
+ current_tm->tm_mon+1, current_tm->tm_mday,
+ current_tm->tm_year, current_tm->tm_hour,
+ current_tm->tm_min, current_tm->tm_sec, current_tm->tm_zone);
+ for (i=1; i<=Num_races; i++) {
+ dummy=(Blocks[i-1].invite & Blocks[i-1].pledge);
+ Power_blocks.members[i-1] = 0;
+ Power_blocks.sectors_owned[i-1] = 0;
+ Power_blocks.popn[i-1] = 0;
+ Power_blocks.ships_owned[i-1] = 0;
+ Power_blocks.resource[i-1] = 0;
+ Power_blocks.fuel[i-1] = 0;
+ Power_blocks.destruct[i-1] = 0;
+ Power_blocks.systems_owned[i-1] = Blocks[i-1].systems_owned;
+ Power_blocks.VPs[i-1] = Blocks[i-1].VPs;
+ for(j=1; j<=Num_races; j++)
+ if(isset(dummy, j)){
+ Power_blocks.members[i-1] += 1;
+ Power_blocks.sectors_owned[i-1] += Power[j-1].sectors_owned;
+ Power_blocks.popn[i-1] += Power[j-1].popn;
+ Power_blocks.ships_owned[i-1] += Power[j-1].ships_owned;
+ Power_blocks.resource[i-1] += Power[j-1].resource;
+ Power_blocks.fuel[i-1] += Power[j-1].fuel;
+ Power_blocks.destruct[i-1] += Power[j-1].destruct;
+ }
+ }
+
+
+ }
+
+
*** /usr/cna/billr/games/gb3/server/doplanet.c Wed May 30 15:13:01 1990
--- server/doplanet.c Thu Aug 23 16:54:48 1990
***************
*** 71,76 ****
--- 71,77 ----
int oldplanetpopn, oldplanetmaxpopn;
boolean allmod=0,allexp=0;
char buf[200];
+ float tech_prod();
Sectormappos = planet->sectormappos;
check(planet,0);
***************
*** 78,84 ****
return 0; /* no one's here now */
if (Stinfo[starnum][planetnum].inhab) {
- /* printf(" getting sectmap pos %d\n",planet->sectormappos); */
opensectdata(§data);
getsmap(sectdata,Smap,planet);
close_file(sectdata);
--- 79,84 ----
***************
*** 87,94 ****
bzero((char *)Sectinfo, sizeof(Sectinfo) );
}
-
-
check(planet,1);
shipno = planet->ships;
--- 87,92 ----
***************
*** 147,163 ****
{
sectortype *s;
s = &Sector(*planet,(int)ship->xpos,(int)ship->ypos);
! if (s->des != DES_GAS &&
(int_rand(1,100) <= (((100-ship->damage) *
ship->popn)/Max_crew(ship)))) {
/* gas sectors can't be terraformed. */
s->des = races[ship->owner-1]->likesbest;
! s->eff *= 0.5;
! s->mobilization *= 0.5;
! s->resource *= 0.7;
! /*s->popn *= 0.5;*/ /* ?? not sure bout this */
s->popn = 0;
! s->owner = 0;/* i AM sure about this :) */
ship->fuel -= (float)FUEL_COST_TERRA;
ship->mass -= FUEL_COST_TERRA*MASS_FUEL;
if (planet->conditions[TOXIC]<100)
--- 145,160 ----
{
sectortype *s;
s = &Sector(*planet,(int)ship->xpos,(int)ship->ypos);
! if (s->des !=races[ship->owner-1]->likesbest &&
! s->des != DES_GAS &&
(int_rand(1,100) <= (((100-ship->damage) *
ship->popn)/Max_crew(ship)))) {
/* gas sectors can't be terraformed. */
s->des = races[ship->owner-1]->likesbest;
! s->eff = 0;
! s->mobilization = 0.;
s->popn = 0;
! s->owner = 0;
ship->fuel -= (float)FUEL_COST_TERRA;
ship->mass -= FUEL_COST_TERRA*MASS_FUEL;
if (planet->conditions[TOXIC]<100)
***************
*** 201,208 ****
check(planet,2);
}
!
! if (!Stinfo[starnum][planetnum].inhab &&
!Stinfo[starnum][planetnum].Thing_add)
return 0; /* (no one's explored the planet) */
--- 198,204 ----
check(planet,2);
}
! if (!Stinfo[starnum][planetnum].inhab &&
!Stinfo[starnum][planetnum].Thing_add)
return 0; /* (no one's explored the planet) */
***************
*** 253,258 ****
--- 249,255 ----
bzero((char *)prod_res, sizeof(prod_res) );
bzero((char *)prod_fuel, sizeof(prod_fuel) );
bzero((char *)prod_destruct, sizeof(prod_destruct) );
+ bzero((char *)prod_crystals, sizeof(prod_crystals) );
tot_resdep = prod_eff= prod_mob = tot_captured = 0;
Claims = 0;
***************
*** 267,272 ****
--- 264,270 ----
for (i=1; i<=Num_races; i++) {
Compat[i-1] = compatibility(planet, races[i-1]);
planet->info[i-1].numsectsowned = 0;
+ planet->info[i-1].popn = 0;
populations[i-1] = 0;
prod_fuel[i-1] = 0;
prod_destruct[i-1] = 0;
***************
*** 275,285 ****
}
Getxysect(planet, &x, &y, 1);
- /*printf(" while %d\n",Getxysect(planet, &x, &y, 1)); /* reset */
- check(planet,4);
while (Getxysect(planet, &x, &y, 0)) {
p = &Sector(*planet,x,y);
if (p->owner) {
/* (all modified; sectors belonging to that player modified) */
allmod = 1;
--- 273,282 ----
}
Getxysect(planet, &x, &y, 1);
while (Getxysect(planet, &x, &y, 0)) {
p = &Sector(*planet,x,y);
+
if (p->owner) {
/* (all modified; sectors belonging to that player modified) */
allmod = 1;
***************
*** 304,310 ****
Sectinfo[x][y].done = 1;
! }
if (p->owner) {
--- 301,308 ----
Sectinfo[x][y].done = 1;
! } else
! p->popn = 0;
if (p->owner) {
***************
*** 355,363 ****
}
}
! }
! check(planet,5);
if (allmod) { /* ( >= 1 inhabited sector on the planet) */
check(planet,51);
--- 353,363 ----
}
}
! }
+
+ check(planet,5);
+ allmod=1;
if (allmod) { /* ( >= 1 inhabited sector on the planet) */
check(planet,51);
***************
*** 426,437 ****
Stars[starnum]->name, Stars[starnum]->pnames[planetnum] );
sprintf(buf," \nWAR STATUS: %d sectors gained, %d sectors lost.\n", sects_gained[i-1],sects_lost[i-1]);
str_cat(telegram_buf, buf);
! push_message(TELEG_PLAYER_AUTO, i, telegram_buf);
}
! for (i=1; i<=Num_races; i++)
if (planet->info[i-1].autorep) {
-
check(planet,8);
/* planet->info[i-1].autorep = planet->info[i-1].autorep - 1; */
check(planet,85);
--- 426,439 ----
Stars[starnum]->name, Stars[starnum]->pnames[planetnum] );
sprintf(buf," \nWAR STATUS: %d sectors gained, %d sectors lost.\n", sects_gained[i-1],sects_lost[i-1]);
str_cat(telegram_buf, buf);
! push_message(TELEG_PLAYER_AUTO, i, telegram_buf, COMBAT);
}
! for (i=1; i<=Num_races; i++) {
! planet->info[i-1].prod_res = prod_res[i-1];
! planet->info[i-1].prod_fuel = prod_fuel[i-1];
! planet->info[i-1].prod_dest = prod_destruct[i-1];
if (planet->info[i-1].autorep) {
check(planet,8);
/* planet->info[i-1].autorep = planet->info[i-1].autorep - 1; */
check(planet,85);
***************
*** 445,450 ****
--- 447,456 ----
sprintf(buf, "Total Prod: %dr %df %dd\n", prod_res[i-1], prod_fuel[i-1],
prod_destruct[i-1]);
str_cat(telegram_buf, buf);
+ if(prod_crystals[i-1]) {
+ sprintf(buf, " %d crystals found\n", prod_crystals[i-1]);
+ str_cat(telegram_buf, buf);
+ }
if(tot_captured) {
sprintf(buf,"%d sectors captured\n", tot_captured);
***************
*** 468,476 ****
str_cat(telegram_buf, buf);
}
! push_message(TELEG_PLAYER_AUTO, i, telegram_buf);
}
check(planet,9);
/* find out who is on this planet, for nova notification */
--- 474,483 ----
str_cat(telegram_buf, buf);
}
! push_message(TELEG_PLAYER_AUTO, i, telegram_buf, TELEGRAM);
}
+ }
check(planet,9);
/* find out who is on this planet, for nova notification */
***************
*** 486,492 ****
str_cat(telegram_buf, buf);
for (i=1; i<=Num_races; i++)
if (planet->info[i-1].numsectsowned) {
! push_message(TELEG_PLAYER_AUTO, i, telegram_buf);
}
}
--- 493,499 ----
str_cat(telegram_buf, buf);
for (i=1; i<=Num_races; i++)
if (planet->info[i-1].numsectsowned) {
! push_message(TELEG_PLAYER_AUTO, i, telegram_buf, TELEGRAM);
}
}
***************
*** 498,504 ****
this requires that you be the only one inhabiting the planet */
if (planet->info[i-1].numsectsowned > 0) {
! int aliensects=0,stolenres=0,stolendes=0,stolenfuel=0;
int stuff=0;
--- 505,512 ----
this requires that you be the only one inhabiting the planet */
if (planet->info[i-1].numsectsowned > 0) {
! int aliensects=0;
! int stolenres=0,stolendes=0,stolenfuel=0, stolencrystals=0;
int stuff=0;
***************
*** 508,514 ****
aliensects += planet->info[j-1].numsectsowned;
if(planet->info[j-1].resource >0 ||
planet->info[j-1].destruct >0 ||
! planet->info[j-1].fuel > 0.0) stuff=1;
}
if(!aliensects && stuff)
--- 516,523 ----
aliensects += planet->info[j-1].numsectsowned;
if(planet->info[j-1].resource >0 ||
planet->info[j-1].destruct >0 ||
! planet->info[j-1].fuel > 0.0 ||
! planet->info[j-1].crystals) stuff=1;
}
if(!aliensects && stuff)
***************
*** 519,537 ****
stolenres += planet->info[j-1].resource;
stolendes += planet->info[j-1].destruct;
stolenfuel += planet->info[j-1].fuel;
planet->info[j-1].resource = 0;
planet->info[j-1].destruct = 0;
planet->info[j-1].fuel = 0;
! }
planet->info[i-1].resource += stolenres;
planet->info[i-1].destruct += stolendes;
planet->info[i-1].fuel += stolenfuel;
! /* notify player of recovered stockpiles */
sprintf(telegram_buf,"****** Report: Planet /%s/%s ******\n\n",
Stars[starnum]->name, Stars[starnum]->pnames[planetnum] );
! sprintf(buf," %d resources \n %d destruct \n %d fuel recovered from alien stock piles",stolenres,stolendes,stolenfuel);
str_cat(telegram_buf, buf);
! push_message(TELEG_PLAYER_AUTO, i, telegram_buf);
} /*aliensect==0*/
}
--- 528,549 ----
stolenres += planet->info[j-1].resource;
stolendes += planet->info[j-1].destruct;
stolenfuel += planet->info[j-1].fuel;
+ stolencrystals += planet->info[j-1].crystals;
planet->info[j-1].resource = 0;
planet->info[j-1].destruct = 0;
planet->info[j-1].fuel = 0;
! planet->info[j-1].crystals = 0;
! }
planet->info[i-1].resource += stolenres;
planet->info[i-1].destruct += stolendes;
planet->info[i-1].fuel += stolenfuel;
! planet->info[i-1].crystals += stolencrystals;
! /* notify player of recovered stockpiles */
sprintf(telegram_buf,"****** Report: Planet /%s/%s ******\n\n",
Stars[starnum]->name, Stars[starnum]->pnames[planetnum] );
! sprintf(buf," %d resources \n %d destruct \n %d fuel\n %d crystals recovered from alien stock piles",stolenres,stolendes,stolenfuel,stolencrystals);
str_cat(telegram_buf, buf);
! push_message(TELEG_PLAYER_AUTO, i, telegram_buf, TELEGRAM);
} /*aliensect==0*/
}
***************
*** 558,564 ****
else if (planet->conditions[TOXIC] < 0)
planet->conditions[TOXIC] = 0;
! /* deal with enslaved planets */
if (planet->slaved_to) {
if (populations[planet->slaved_to-1] >= planet->popn * 0.001 ||
(Stinfo[starnum][planetnum].intimidated && random()&01) ) {
--- 570,583 ----
else if (planet->conditions[TOXIC] < 0)
planet->conditions[TOXIC] = 0;
! Getxysect(planet, &x, &y, 1);
! while (Getxysect(planet, &x, &y, 0)) {
! p = &Sector(*planet,x,y);
! if (p->owner)
! planet->info[p->owner-1].popn += p->popn;
! }
!
! /* deal with enslaved planets */
if (planet->slaved_to) {
if (populations[planet->slaved_to-1] >= planet->popn * 0.001 ||
(Stinfo[starnum][planetnum].intimidated && random()&01) ) {
***************
*** 601,607 ****
p->is_wasted = 1;
}
}
! }
sprintf(telegram_buf,"NOTICE from planet /%s/%s!\n",
Stars[starnum]->name,
Stars[starnum]->pnames[planetnum]);
--- 620,629 ----
p->is_wasted = 1;
}
}
!
! /* also add up the populations while here */
!
! }
sprintf(telegram_buf,"NOTICE from planet /%s/%s!\n",
Stars[starnum]->name,
Stars[starnum]->pnames[planetnum]);
***************
*** 613,622 ****
str_cat(telegram_buf, buf);
for (i=1; i<=Num_races; i++)
if (planet->info[i-1].numsectsowned && i!=planet->slaved_to) {
! push_message(TELEG_PLAYER_AUTO, i, telegram_buf);
}
/* send to previous slave holder */
! push_message(TELEG_PLAYER_AUTO, planet->slaved_to, telegram_buf);
planet->slaved_to = 0;
planet->is_sheep = 0;
--- 635,644 ----
str_cat(telegram_buf, buf);
for (i=1; i<=Num_races; i++)
if (planet->info[i-1].numsectsowned && i!=planet->slaved_to) {
! push_message(TELEG_PLAYER_AUTO, i, telegram_buf, TELEGRAM);
}
/* send to previous slave holder */
! push_message(TELEG_PLAYER_AUTO, planet->slaved_to, telegram_buf, TELEGRAM);
planet->slaved_to = 0;
planet->is_sheep = 0;
***************
*** 628,654 ****
if (planet->info[i-1].numsectsowned) {
! if (planet->info[i-1].fuel + prod_fuel[i-1] > 100000)
! planet->info[i-1].fuel = 100000;
else
planet->info[i-1].fuel += prod_fuel[i-1];
! if (planet->info[i-1].resource + prod_res[i-1] > 100000)
! planet->info[i-1].resource = 100000;
else
planet->info[i-1].resource += prod_res[i-1];
! if (planet->info[i-1].destruct + prod_destruct[i-1] > 100000)
! planet->info[i-1].destruct = 100000;
else
planet->info[i-1].destruct += prod_destruct[i-1];
! /* do tech investments */
if (planet->info[i-1].resource >= planet->info[i-1].tech_invest) {
! races[i-1]->tech +=
! log10(1.0+(double)planet->info[i-1].tech_invest) * TECH_INVEST;
planet->info[i-1].resource -= planet->info[i-1].tech_invest;
! }
/* build wc's if it's been ordered */
if (planet->info[i-1].tox_thresh>0 &&
--- 650,684 ----
if (planet->info[i-1].numsectsowned) {
! if (planet->info[i-1].fuel + prod_fuel[i-1] > 65567)
! planet->info[i-1].fuel = 65567;
else
planet->info[i-1].fuel += prod_fuel[i-1];
! if (planet->info[i-1].resource + prod_res[i-1] > 65567)
! planet->info[i-1].resource = 65567;
else
planet->info[i-1].resource += prod_res[i-1];
! if (planet->info[i-1].destruct + prod_destruct[i-1] > 65567)
! planet->info[i-1].destruct = 65567;
else
planet->info[i-1].destruct += prod_destruct[i-1];
! if (planet->info[i-1].crystals + prod_crystals[i-1] > 127)
! planet->info[i-1].crystals = 127;
! else
! planet->info[i-1].crystals += prod_crystals[i-1];
!
! /* do tech investments */
if (planet->info[i-1].resource >= planet->info[i-1].tech_invest) {
! planet->info[i-1].prod_tech =
! tech_prod((int)planet->info[i-1].tech_invest,
! (int)planet->info[i-1].popn);
planet->info[i-1].resource -= planet->info[i-1].tech_invest;
! races[i-1]->tech += planet->info[i-1].prod_tech;
! } else
! planet->info[i-1].prod_tech;
/* build wc's if it's been ordered */
if (planet->info[i-1].tox_thresh>0 &&
***************
*** 665,679 ****
s2->armor = Shipdata[OTYPE_TOXWC][ABIL_ARMOR];
s2->guns = Shipdata[OTYPE_TOXWC][ABIL_GUNS];
- s2->size = Shipdata[OTYPE_TOXWC][ABIL_TARGET];
s2->max_crew = Shipdata[OTYPE_TOXWC][ABIL_MAXCREW];
s2->max_resource = Shipdata[OTYPE_TOXWC][ABIL_CARGO];
s2->max_fuel = Shipdata[OTYPE_TOXWC][ABIL_FUELCAP];
s2->max_destruct = Shipdata[OTYPE_TOXWC][ABIL_DESTCAP];
s2->max_speed = Shipdata[OTYPE_TOXWC][ABIL_SPEED];
! s2->base_mass = getmass(s2);
s2->mass = s2->base_mass;
s2->is_alive = 1;
sprintf(s2->name,"Scum%04d",Num_ships);
insert_sh_plan(planet,s2,Num_ships);
--- 695,711 ----
s2->armor = Shipdata[OTYPE_TOXWC][ABIL_ARMOR];
s2->guns = Shipdata[OTYPE_TOXWC][ABIL_GUNS];
s2->max_crew = Shipdata[OTYPE_TOXWC][ABIL_MAXCREW];
s2->max_resource = Shipdata[OTYPE_TOXWC][ABIL_CARGO];
s2->max_fuel = Shipdata[OTYPE_TOXWC][ABIL_FUELCAP];
s2->max_destruct = Shipdata[OTYPE_TOXWC][ABIL_DESTCAP];
s2->max_speed = Shipdata[OTYPE_TOXWC][ABIL_SPEED];
! s2->build_cost = Shipdata[OTYPE_TOXWC][ABIL_COST];
! s2->size = ship_size(s2);
! s2->base_mass = 1.0; /* a hack */
s2->mass = s2->base_mass;
s2->is_alive = 1;
+ s2->active = 1;
sprintf(s2->name,"Scum%04d",Num_ships);
insert_sh_plan(planet,s2,Num_ships);
***************
*** 707,714 ****
Power[i-1].resource += planet->info[i-1].resource;
Power[i-1].destruct += planet->info[i-1].destruct;
Power[i-1].fuel += planet->info[i-1].fuel;
- Power[i-1].planets_owned += !!planet->info[i-1].numsectsowned;
Power[i-1].sectors_owned += planet->info[i-1].numsectsowned;
/* Power[i-1].sum_mob += avg_mob[i-1]; */
}
--- 739,746 ----
Power[i-1].resource += planet->info[i-1].resource;
Power[i-1].destruct += planet->info[i-1].destruct;
Power[i-1].fuel += planet->info[i-1].fuel;
Power[i-1].sectors_owned += planet->info[i-1].numsectsowned;
+ Power[i-1].planets_owned += !!planet->info[i-1].numsectsowned;
/* Power[i-1].sum_mob += avg_mob[i-1]; */
}