home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-09-18 | 55.3 KB | 1,888 lines |
- Path: uunet!zephyr.ens.tek.com!tekgen!tekred!saab!billr
- From: billr@saab.CNA.TEK.COM (Bill Randle)
- Newsgroups: comp.sources.games
- Subject: v08i026: GB2 - Galactic Bloodshed, an empire-like war game [Ver. 1.0], Patch1a
- Message-ID: <4575@tekred.CNA.TEK.COM>
- Date: 15 Sep 89 15:22:21 GMT
- Sender: nobody@tekred.CNA.TEK.COM
- Lines: 1877
- Approved: billr@saab.CNA.TEK.COM
-
- Submitted-by: VANCLEEF@mps.ohio-state.edu
- Posting-number: Volume 8, Issue 26
- Archive-name: GB2/Patch1a
- Patch-To: GB2: Volume 7, Issue 44-51
-
- [This patch brings the Ohio State version of GB upto version
- 1.1. As Garrett mentioned in another newsgroup, the complete
- source can still be obtained directly from him for a period
- of time. The original GB2 posting is, of course, available
- from any of the c.s.g. archive sites.... -br]
-
- #! /bin/sh
- # This is a shell archive. Remove anything before this line, then unpack
- # it by saving it into a file and typing "sh file". To overwrite existing
- # files, type "sh file -c". You can also feed this as standard input via
- # unshar, or by typing "sh <file", e.g.. If this archive is complete, you
- # will see the following message at the end:
- # "End of archive 1 (of 4)."
- # Contents: patches01a
- # Wrapped by billr@saab on Fri Sep 15 08:21:43 1989
- PATH=/bin:/usr/bin:/usr/ucb ; export PATH
- if test -f 'patches01a' -a "${1}" != "-c" ; then
- echo shar: Will not clobber existing file \"'patches01a'\"
- else
- echo shar: Extracting \"'patches01a'\" \(52745 characters\)
- sed "s/^X//" >'patches01a' <<'END_OF_FILE'
- X*** ../../GB2/GB.c Wed Jul 5 15:14:58 1989
- X--- GB.c Fri Sep 15 07:27:43 1989
- X***************
- X*** 23,34 ****
- X
- X main()
- X {
- X! int notified=0,s,i;
- X char c,commstr[MAXCOMMSTRSIZE];
- X int maim_handler();
- X int maim_stardata;
- X
- X-
- X setegid(PLAYER_GROUP_ID);
- X
- X srandom(getpid());
- X--- 23,33 ----
- X
- X main()
- X {
- X! int notified=0, s, i;
- X char c,commstr[MAXCOMMSTRSIZE];
- X int maim_handler();
- X int maim_stardata;
- X
- X setegid(PLAYER_GROUP_ID);
- X
- X srandom(getpid());
- X***************
- X*** 53,75 ****
- X close(maim_stardata);
- X
- X passwd = getpwuid(geteuid());
- X if (!strcmp(passwd->pw_name, PLAYER_GOD)) {
- X
- X printf("Enter password: ");
- X scanf("%s",commstr);
- X getchr();
- X
- X! if(!strcmp(commstr, GOD_PASSWORD)){
- X
- X! God = 1;
- X! printf("Login as what player? ");
- X scanf("%s",commstr);
- X getchr();
- X
- X! } else
- X! sprintf(commstr,"%s", passwd->pw_name);
- X! }else
- X! sprintf(commstr,"%s", passwd->pw_name);
- X
- X i = Getracenum(commstr);
- X
- X--- 52,72 ----
- X close(maim_stardata);
- X
- X passwd = getpwuid(geteuid());
- X+
- X if (!strcmp(passwd->pw_name, PLAYER_GOD)) {
- X
- X printf("Enter password: ");
- X scanf("%s",commstr);
- X getchr();
- X+ }
- X
- X! if(!strcmp(commstr, GOD_PASSWORD)) God = 1;
- X
- X! printf("Who are you (this is/will (be) your password)? ");
- X scanf("%s",commstr);
- X getchr();
- X
- X! /* sprintf(commstr,"%s", passwd->pw_name); */
- X
- X i = Getracenum(commstr);
- X
- X***************
- X*** 78,84 ****
- X else
- X getrace(&Race,i);
- X Playernum = Race->Playernum;
- X! if (God)
- X printf("Logging in as player %d.\n",Playernum);
- X
- X if(God) {
- X--- 75,81 ----
- X else
- X getrace(&Race,i);
- X Playernum = Race->Playernum;
- X!
- X printf("Logging in as player %d.\n",Playernum);
- X
- X if(God) {
- X*** ../../GB2/Makefile Thu Jul 6 07:32:22 1989
- X--- Makefile Fri Sep 15 07:29:04 1989
- X***************
- X*** 1,5 ****
- X # Galactic Bloodshed (Robert Chansky, smq@b)
- X! # Makefile (modified by billr@saab.cna.tek.com, 4/26/89)
- X
- X # what version of UNIX we are running on.
- X UV = VER_4_3
- X--- 1,5 ----
- X # Galactic Bloodshed (Robert Chansky, smq@b)
- X! # Makefile
- X
- X # what version of UNIX we are running on.
- X UV = VER_4_3
- X***************
- X*** 6,19 ****
- X #UV = VER_4_2
- X # You might want to get rid of the -pipe -g, since these are for development.
- X CFLAGS = -D$(UV) -pipe -g
- X! #CFLAGS = -D$(UV) -g
- X! #CFLAGS = -D$(UV) -O
- X
- X- # destination directories
- X- # GLIB should match the directory in the PATH macro of files.h
- X- GBIN = /usr/games
- X- GLIB = /usr/games/lib/GB
- X-
- X # objects for shell
- X SHOBJS = getplace.o \
- X read_teleg.o \
- X--- 6,13 ----
- X #UV = VER_4_2
- X # You might want to get rid of the -pipe -g, since these are for development.
- X CFLAGS = -D$(UV) -pipe -g
- X! #-D$(UV) -O
- X
- X # objects for shell
- X SHOBJS = getplace.o \
- X read_teleg.o \
- X***************
- X*** 20,26 ****
- X autoreport.o \
- X shootblast.o \
- X docommand.o \
- X- explore.o \
- X telegram.o \
- X mobiliz.o \
- X shlmisc.o \
- X--- 14,19 ----
- X***************
- X*** 30,36 ****
- X autoshoot.o \
- X dosector.o \
- X relation.o \
- X- enslave.o \
- X doturn.o \
- X doship.o \
- X zoom.o \
- X--- 23,28 ----
- X***************
- X*** 85,92 ****
- X makeplanet.o \
- X shootblast.o \
- X autoshoot.o \
- X- moveship.o \
- X- explore.o \
- X relation.o \
- X dosector.o \
- X declare.o \
- X--- 77,82 ----
- X***************
- X*** 114,120 ****
- X shootblast.o \
- X makeplanet.o \
- X examine.o \
- X- enslave.o \
- X launch.o \
- X build.o \
- X order.o \
- X--- 104,109 ----
- X***************
- X*** 190,200 ****
- X ${VOBJS}: vars.h
- X ${SHIPOBJS}: vars.h ships.h
- X ${FOBJS}: files.h
- X- ${NOOBJS}: tweakables.h
- X moveship.o : vars.h ships.h shipdata.h
- X doturn.o doplanet.o power.o doship.o files_shl.o makeuniv.o : power.h
- X #sizes : vars.h ships.h races.h
- X! # sizes.c
- X
- X
- X # make data files program
- X--- 179,188 ----
- X ${VOBJS}: vars.h
- X ${SHIPOBJS}: vars.h ships.h
- X ${FOBJS}: files.h
- X moveship.o : vars.h ships.h shipdata.h
- X doturn.o doplanet.o power.o doship.o files_shl.o makeuniv.o : power.h
- X #sizes : vars.h ships.h races.h
- X! # cc sizes.c
- X
- X
- X # make data files program
- X***************
- X*** 205,211 ****
- X # the daemon
- X GB_daemon : ${DOBJS}
- X cc -o GB_daemon ${DOBJS} -lm
- X! doturn.o doship.o doplanet.o moveship.o moveplanet.o : doturn.h
- X
- X # more clone
- X mor : more.c
- X--- 193,199 ----
- X # the daemon
- X GB_daemon : ${DOBJS}
- X cc -o GB_daemon ${DOBJS} -lm
- X! doturn.o doship.o doplanet.o : doturn.h
- X
- X # more clone
- X mor : more.c
- X***************
- X*** 212,218 ****
- X cc -o mor more.c
- X
- X chmod:
- X- cd $(GLIB)
- X chmod ag+xs GB
- X chmod g+rwx Data Data/* Data/Tele/*
- X chmod a+rx Docs Docs/*
- X--- 200,205 ----
- X***************
- X*** 221,227 ****
- X # chmod ga+rwx Data Data/* Data/Tele/*
- X
- X start:
- X- cd $(GLIB)
- X /bin/rm -f Data/spitup
- X GB_daemon \>\& Data/spitup
- X
- X--- 208,213 ----
- X***************
- X*** 258,271 ****
- X # install the game for public use.
- X install:
- X make
- X! cp GB $(GBIN)
- X! -mkdir $(GLIB)
- X! cp exam.dat enroll.dat $(GLIB)
- X! -mkdir $(GLIB)/Docs
- X! -cp Docs/* $(GLIB)/Docs
- X! -compress $(GLIB)/Docs/* $(GLIB)/enroll.dat
- X! make clear
- X makeuniv < planet.list
- X make chmod
- X-
- X
- X--- 244,252 ----
- X # install the game for public use.
- X install:
- X make
- X! mkdir Docs
- X! mv *.doc Docs
- X! compress Docs/* enroll.dat
- X makeuniv < planet.list
- X make chmod
- X
- X*** ../../GB2/README Wed Jul 5 15:14:27 1989
- X--- README Fri Sep 15 08:12:44 1989
- X***************
- X*** 1,3 ****
- X--- 1,8 ----
- X+ GB2 is an enhancement/bug fixed version of GB that was
- X+ originally written by Robert Chansky at the University of California
- X+ at Santa Cruz. The enhancements and modifications were written by
- X+ Garrett Van Cleef at Ohio State University. The text that
- X+ follows is from the original README file.
- X
- X This is a game of interstellar exploration/conquest. By the time I
- X realized there really wasn't going to be much fighting going on in the game, I
- X***************
- X*** 34,40 ****
- X a game keeper's satisfaction.
- X
- X
- X! GB can be found via anonymous ftp to the machine ssyx.ucsc.edu
- X (128.114.133.1). (Look in pub/games).
- X
- X
- X--- 39,45 ----
- X a game keeper's satisfaction.
- X
- X
- X! The original GB can be found via anonymous ftp to the machine ssyx.ucsc.edu
- X (128.114.133.1). (Look in pub/games).
- X
- X
- X***************
- X*** 128,138 ****
- X but have a longer range. range is proportional to your tech. These
- X were put in so people don't have to send ships out blindly. Once you've
- X surveyed someplace with one of these, you can then map and 'cs' to it.
- X- New ships: orbital mind control lasers, some ground, sea, and air
- X- transportation ships (which don't work yet).
- X-
- X- There is now an 'enslave' command. Check the docs.
- X-
- X tactical works better, it uses planets as part of its display.
- X the bug where sector maps got randomly switched around sometimes
- X halting the game, has been fixed. This was a MAJOR pain, and the main problem
- X--- 133,138 ----
- X*** ../../GB2/autoreport.c Wed Jul 5 15:15:00 1989
- X--- autoreport.c Fri Sep 15 07:27:43 1989
- X***************
- X*** 1,5 ****
- X
- X-
- X /*
- X * Galactic Bloodshed (Robert Chansky, smq@b)
- X * autoreport.c -- tell server to generate a report for each planet
- X--- 1,4 ----
- X*** ../../GB2/autoshoot.c Wed Jul 5 15:15:01 1989
- X--- autoshoot.c Fri Sep 15 07:27:44 1989
- X***************
- X*** 12,17 ****
- X--- 12,18 ----
- X extern char telegram_buf[];
- X extern racetype *races[];
- X
- X+ int fire_toshdata;
- X
- X /* ship #shipno bombards planet, then sends telegrams alerting whom it
- X * may concern.
- X***************
- X*** 21,26 ****
- X--- 22,28 ----
- X planettype *planet;
- X {
- X int x,y,oldown,numdest,found=0;
- X+ int i, stren, stren0, stren1, stren2, sh;
- X float dist;
- X char buf[200];
- X bool whocares;
- X***************
- X*** 47,53 ****
- X if (found) {
- X placetype from,to;
- X int str;
- X! str = MIN(Shipdata[ship->type][ABIL_GUNS], ship->destruct);
- X /* save owner of destroyed sector */
- X if (str) {
- X oldown = Sector(*planet,x,y).owner;
- X--- 49,55 ----
- X if (found) {
- X placetype from,to;
- X int str;
- X! str = MIN(Shipdata[ship->type][ABIL_GUNS]*(100-ship->damage)/100., ship->destruct);
- X /* save owner of destroyed sector */
- X if (str) {
- X oldown = Sector(*planet,x,y).owner;
- X***************
- X*** 86,91 ****
- X--- 88,158 ----
- X Shipnames[ship->type], shipno, x, y, numdest);
- X teleg_add(buf,telegram_buf);
- X teleg_send(TELEG_PLAYER_AUTO, oldown, telegram_buf);
- X+
- X+ /* enemy planet retaliates along with defending forces */
- X+
- X+
- X+ stren = 0;
- X+ for(i=1; i<= Numraces(); i++)
- X+ if(i!=Playernum && planet->info[i-1].numsectsowned) {
- X+ stren0 = 0;
- X+ stren1 = 0;
- X+ stren2 = 0;
- X+ openshdata(&fire_toshdata);
- X+ /* go through linked list of ships orbiting the planet */
- X+ /* only add ships ordered to defend planet */
- X+ sh = planet->ships;
- X+
- X+ while(sh) {
- X+
- X+ free(to.shipptr);
- X+ (void)getship(fire_toshdata, &(to.shipptr), sh);
- X+ if(to.shipptr->owner == i && to.shipptr->protect.planet) {
- X+
- X+ stren0 = MIN(to.shipptr->destruct,
- X+ Shipdata[to.shipptr->type][ABIL_GUNS]*(100-to.shipptr->damage)/100.);
- X+ stren1 += stren0;
- X+ to.shipptr->destruct -= stren0;
- X+ putship(fire_toshdata, to.shipptr, sh);
- X+
- X+ }
- X+ sh = to.shipptr->nextship;
- X+ }
- X+ close(fire_toshdata);
- X+ /* add planet defense strength */
- X+
- X+ stren2 = planet->info[i-1].destruct;
- X+ if(stren2 > PLAN_FIRE_LIM)
- X+ stren2 = PLAN_FIRE_LIM;
- X+ planet->info[i-1].destruct -= stren2;
- X+
- X+ stren += stren1;
- X+ stren += stren2;
- X+ /* tell the involved players about it.. */
- X+
- X+
- X+ /* execute attack */
- X+
- X+ numdest = shoot(to, &from, planet, (planettype *)NULL, x,y, stren, &dist,
- X+ &whocares,&whocares,&whocares, 0); /* (0=dont get smap) */
- X+
- X+ teleg_add("",telegram_buf);
- X+ sprintf(buf,"REPORT: Ship #%d Bombardment.\n\n",shipno);
- X+ teleg_add(buf,telegram_buf);
- X+ sprintf(buf,"Defending ships return fire total strength %d \n",stren1);
- X+ teleg_add(buf,telegram_buf);
- X+ sprintf(buf,"Planet returns fire with strength %d \n",stren2);
- X+ teleg_add(buf,telegram_buf);
- X+ sprintf(buf,"Total defense strength %d \n",stren);
- X+ teleg_add(buf,telegram_buf);
- X+ sprintf(buf,"%d percent damage to Ship #%d \n",numdest,shipno);
- X+ teleg_add(buf,telegram_buf);
- X+
- X+ teleg_send(TELEG_PLAYER_AUTO, ship->owner, telegram_buf);
- X+ teleg_send(TELEG_PLAYER_AUTO, oldown, telegram_buf);
- X+
- X+
- X+ }
- X
- X } else {
- X /* no weapons! */
- X*** ../../GB2/build.c Wed Jul 5 15:15:03 1989
- X--- build.c Fri Sep 15 07:27:46 1989
- X***************
- X*** 171,178 ****
- X /* find sector to build on (if planet) */
- X
- X if (Dir.level!=LEVEL_SHIP)
- X- do {
- X
- X if (argn>1)
- X sscanf(args[argn-1], "%d,%d", &x, &y);
- X else
- X--- 171,179 ----
- X /* find sector to build on (if planet) */
- X
- X if (Dir.level!=LEVEL_SHIP)
- X
- X+ /* do { */
- X+ {
- X if (argn>1)
- X sscanf(args[argn-1], "%d,%d", &x, &y);
- X else
- X***************
- X*** 183,198 ****
- X opensectdata(&build_sectdata);
- X getsector(build_sectdata, §, planet->sectormappos+(y*planet->Maxx+x)*sizeof(sectortype) );
- X close(build_sectdata);
- X! if (sect->owner!=Playernum) {
- X printf("You don't own that sector.\n");
- X if (argn>1)
- X build_handler();
- X exit(0);
- X }
- X free(sect);
- X
- X- } while ( sect->owner != Playernum );
- X
- X /* keep people from fucking up the data files */
- X mask = sigblock(SIGINT | SIGQUIT | SIGSTOP);
- X
- X--- 184,209 ----
- X opensectdata(&build_sectdata);
- X getsector(build_sectdata, §, planet->sectormappos+(y*planet->Maxx+x)*sizeof(sectortype) );
- X close(build_sectdata);
- X! if (sect->owner!=Playernum && i != OTYPE_REPAIR) {
- X printf("You don't own that sector.\n");
- X if (argn>1)
- X build_handler();
- X exit(0);
- X }
- X+ if (sect->owner == 0 && i == OTYPE_REPAIR)
- X+ {
- X+ sect->is_wasted = 0;
- X+ sect->eff = 10;
- X+ opensectdata(&build_sectdata);
- X+ putsector(build_sectdata, sect, planet->sectormappos+(y*planet->Maxx+x)*sizeof(sectortype) );
- X+ close(build_sectdata);
- X+ }
- X free(sect);
- X+ }
- X+ /* } while ( sect->owner != Playernum ); */ /* do while taken out by gvc */
- X
- X
- X+
- X /* keep people from fucking up the data files */
- X mask = sigblock(SIGINT | SIGQUIT | SIGSTOP);
- X
- X***************
- X*** 209,220 ****
- X }
- X
- X s.speed = 0;
- X- /* s.speed = MAX(2, Shipdata[s.type][ABIL_SPEED]); */
- X /* starting speed default */
- X s.owner = Playernum;
- X s.mass = (float)Shipdata[i][ABIL_MASS];
- X s.fuel = s.destruct = s.resource = 0;
- X s.is_docked = 1;
- X if (Dir.level==LEVEL_SHIP) {
- X s.whatdest = LEVEL_SHIP;
- X s.destshipno = Dir.shipno;
- X--- 220,232 ----
- X }
- X
- X s.speed = 0;
- X /* starting speed default */
- X s.owner = Playernum;
- X s.mass = (float)Shipdata[i][ABIL_MASS];
- X s.fuel = s.destruct = s.resource = 0;
- X s.is_docked = 1;
- X+ s.is_alive = 1;
- X+
- X if (Dir.level==LEVEL_SHIP) {
- X s.whatdest = LEVEL_SHIP;
- X s.destshipno = Dir.shipno;
- X***************
- X*** 229,255 ****
- X s.storbits = Dir.snum;
- X s.pnumorbits = Dir.pnum;
- X s.rad = 0;
- X! if (Shipdata[s.type][ABIL_MAXCREW]==0 || s.type==OTYPE_TRANSDEV)
- X! s.damage = 0;
- X! else
- X! s.damage = 50;
- X
- X! if (has_switch(&s)) {
- X s.on = 0;
- X! }
- X switch (s.type) {
- X case OTYPE_VN:
- X! s.orders.object.number = 1; /* one of them */
- X! s.orders.object.number2 = 1; /* we have an assignment */
- X s.on = 1;
- X break;
- X case STYPE_MINE:
- X! s.orders.object.number = 100; /* trigger radius */
- X printf("Mine disarmed.\nTrigger radius set to 100.\n");
- X break;
- X case OTYPE_TRANSDEV:
- X printf("Receive OFF. Change with order.\n");
- X break;
- X case OTYPE_AP:
- X printf("Processor OFF.\n");
- X break;
- X--- 241,277 ----
- X s.storbits = Dir.snum;
- X s.pnumorbits = Dir.pnum;
- X s.rad = 0;
- X! s.damage = Shipdata[s.type][ABIL_DAMAGE];
- X
- X! s.object.number = 0;
- X! s.object.number2 = 0;
- X! s.object.number3 = 0;
- X! s.object.number4 = 0;
- X!
- X! if (has_switch(&s))
- X s.on = 0;
- X! printf("Ship name: ");
- X! dots(11);
- X! gets(s.name);
- X!
- X switch (s.type) {
- X case OTYPE_VN:
- X! s.object.number = 1; /* one of them */
- X! s.object.number2 = 1; /* we have an assignment */
- X s.on = 1;
- X break;
- X case STYPE_MINE:
- X! s.object.number = 100; /* trigger radius */
- X printf("Mine disarmed.\nTrigger radius set to 100.\n");
- X break;
- X case OTYPE_TRANSDEV:
- X printf("Receive OFF. Change with order.\n");
- X break;
- X+ case OTYPE_REPAIR:
- X+ s.damage = 100;
- X+ s.is_alive = 0;
- X+ s.notified = 0;
- X+ break;
- X case OTYPE_AP:
- X printf("Processor OFF.\n");
- X break;
- X***************
- X*** 258,266 ****
- X planet->conditions[TOXIC]);
- X if (planet->conditions[TOXIC] > 20) {
- X planet->conditions[TOXIC] -= 20;
- X! s.orders.object.number = 20;
- X } else {
- X! s.orders.object.number = planet->conditions[TOXIC];
- X planet->conditions[TOXIC] = 0;
- X }
- X printf(" now %d.\n",planet->conditions[TOXIC]);
- X--- 280,288 ----
- X planet->conditions[TOXIC]);
- X if (planet->conditions[TOXIC] > 20) {
- X planet->conditions[TOXIC] -= 20;
- X! s.object.number = 20;
- X } else {
- X! s.object.number = planet->conditions[TOXIC];
- X planet->conditions[TOXIC] = 0;
- X }
- X printf(" now %d.\n",planet->conditions[TOXIC]);
- X***************
- X*** 284,295 ****
- X
- X /* check for dead ships in the data files */
- X
- X- if (Dir.level==LEVEL_SHIP)
- X- Locks(1);
- X- else
- X- openshdata(&build_shdata);
- X
- X! if ( (shipno = getdeadship(build_shdata)) == -1) {
- X /* otherwise recycle topmost dead ship in data file. */
- X /* no dead ships to recycle */
- X shipno = Numships(build_shdata) + 1;
- X--- 306,315 ----
- X
- X /* check for dead ships in the data files */
- X
- X
- X! openshdata(&build_shdata);
- X! while( (shipno = getdeadship(build_shdata)) == 0){ };
- X! if ( shipno == -1) {
- X /* otherwise recycle topmost dead ship in data file. */
- X /* no dead ships to recycle */
- X shipno = Numships(build_shdata) + 1;
- X***************
- X*** 322,328 ****
- X putship(build_shdata,&s,shipno);
- X close(build_shdata);
- X
- X- Locks(0);
- X if (Dir.level==LEVEL_SHIP && dirship->whatorbits==LEVEL_UNIV)
- X deductAPs(APcount, 0, 1);
- X else
- X--- 342,347 ----
- X*** ../../GB2/daemon.c Wed Jul 5 15:15:05 1989
- X--- daemon.c Fri Sep 15 07:27:47 1989
- X***************
- X*** 17,23 ****
- X {
- X struct tm *t;
- X long clk;
- X! int turn=0,update=0,fd2;
- X FILE *fd;
- X
- X if (fork()) exit(); /* detach from shell */
- X--- 17,23 ----
- X {
- X struct tm *t;
- X long clk;
- X! int turn=0,update=0,fd2,first;
- X FILE *fd;
- X
- X if (fork()) exit(); /* detach from shell */
- X***************
- X*** 28,33 ****
- X--- 28,34 ----
- X fd2 = open("/dev/tty", O_RDWR); /* disassociate from tty */
- X ioctl(fd2, TIOCNOTTY, 0);
- X close(fd2);
- X+ first=1;
- X
- X while (1) {
- X
- X***************
- X*** 37,43 ****
- X printf("day %d,hour %d,min %d,sec %d\n",
- X t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
- X
- X! if ( (t->tm_hour % UPDATE_TIME)==0 && update!=t->tm_hour) {
- X update = t->tm_hour;
- X doturn(0); /* not from shell */
- X fd = fopen(PROFDATAFL, "a");
- X--- 38,45 ----
- X printf("day %d,hour %d,min %d,sec %d\n",
- X t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
- X
- X! if ( (t->tm_hour % UPDATE_TIME)==0 && update!=t->tm_hour || first) {
- X! first = 0;
- X update = t->tm_hour;
- X doturn(0); /* not from shell */
- X fd = fopen(PROFDATAFL, "a");
- X*** ../../GB2/doplanet.c Wed Jul 5 15:15:08 1989
- X--- doplanet.c Fri Sep 15 07:27:51 1989
- X***************
- X*** 1,5 ****
- X /*
- X! * Galactic Bloodshed (Robert Chansky, smq@b)
- X * doplanet.c -- do one turn on a planet.
- X */
- X
- X--- 1,5 ----
- X /*
- X! * galactic Bloodshed (Robert Chansky, smq@b)
- X * doplanet.c -- do one turn on a planet.
- X */
- X
- X***************
- X*** 70,80 ****
- X {
- X int shipno,x,y,nukex,nukey;
- X int o=0,j;
- X char *nukem;
- X reg int i;
- X sectortype *p;
- X shiptype *ship;
- X! float madd,fadd;
- X int sectdata,timer=20;
- X int oldplanetpopn, oldplanetmaxpopn;
- X bool allamoeba=1,allmod=0,allexp=0;
- X--- 70,81 ----
- X {
- X int shipno,x,y,nukex,nukey;
- X int o=0,j;
- X+ int aliensects,stolenres,stolendes;
- X char *nukem;
- X reg int i;
- X sectortype *p;
- X shiptype *ship;
- X! float madd,fadd,stolenfuel;
- X int sectdata,timer=20;
- X int oldplanetpopn, oldplanetmaxpopn;
- X bool allamoeba=1,allmod=0,allexp=0;
- X***************
- X*** 99,105 ****
- X
- X shipno = planet->ships;
- X while (shipno) {
- X! if ( ((ship = ships[shipno])!=NULL) && !ship->is_dead && !ship->rad) {
- X if ( !(ship->is_docked && ship->whatdest==LEVEL_PLAN)) {
- X /* add fuel to ships orbiting gas giants */
- X if (planet->type == TYPE_GASGIANT && !is_object(ship)) {
- X--- 100,106 ----
- X
- X shipno = planet->ships;
- X while (shipno) {
- X! if ( ((ship = ships[shipno])!=NULL) && ship->is_alive && !ship->rad) {
- X if ( !(ship->is_docked && ship->whatdest==LEVEL_PLAN)) {
- X /* add fuel to ships orbiting gas giants */
- X if (planet->type == TYPE_GASGIANT && !is_object(ship)) {
- X***************
- X*** 126,138 ****
- X if (ship->type == OTYPE_VN) {
- X /* Von Neumann machine */
- X if (ship->is_docked && ship->whatdest==LEVEL_PLAN) {
- X! if (ship->orders.object.number2) {
- X /* we are currently trying to construct another
- X machine */
- X reg int x,y,a,dum;
- X /* spread VN's all over the planet */
- X! for (i=1; i<253 && i<=ship->orders.object.number; i++) {
- X! a = round_rand(sqrt((double)ship->orders.object.number));
- X x = mod(int_rand((int)(ship->xpos-a),(int)(ship->xpos+a)),(int)planet->xpos,dum);
- X y = mod(int_rand((int)(ship->ypos-a),(int)(ship->ypos+a)),(int)planet->ypos,dum);
- X
- X--- 127,139 ----
- X if (ship->type == OTYPE_VN) {
- X /* Von Neumann machine */
- X if (ship->is_docked && ship->whatdest==LEVEL_PLAN) {
- X! if (ship->object.number2) {
- X /* we are currently trying to construct another
- X machine */
- X reg int x,y,a,dum;
- X /* spread VN's all over the planet */
- X! for (i=1; i<253 && i<=ship->object.number; i++) {
- X! a = round_rand(sqrt((double)ship->object.number));
- X x = mod(int_rand((int)(ship->xpos-a),(int)(ship->xpos+a)),(int)planet->xpos,dum);
- X y = mod(int_rand((int)(ship->ypos-a),(int)(ship->ypos+a)),(int)planet->ypos,dum);
- X
- X***************
- X*** 142,148 ****
- X if (ship->resource >= Shipdata[OTYPE_VN][ABIL_COST]) {
- X ship->resource -= Shipdata[OTYPE_VN][ABIL_COST];
- X ship->mass -= Shipdata[OTYPE_VN][ABIL_COST]*MASS_RESOURCE;
- X! if (ship->orders.object.number > int_rand(3,50)) {
- X /* enough to start a new VN 'herd'. build another
- X ship. */
- X shiptype *s2;
- X--- 143,149 ----
- X if (ship->resource >= Shipdata[OTYPE_VN][ABIL_COST]) {
- X ship->resource -= Shipdata[OTYPE_VN][ABIL_COST];
- X ship->mass -= Shipdata[OTYPE_VN][ABIL_COST]*MASS_RESOURCE;
- X! if (ship->object.number > int_rand(3,50)) {
- X /* enough to start a new VN 'herd'. build another
- X ship. */
- X shiptype *s2;
- X***************
- X*** 169,184 ****
- X s2->type = OTYPE_VN;
- X s2->mass = Shipdata[OTYPE_VN][ABIL_MASS];
- X s2->owner = (random()&01) ? ship->owner : 1;
- X! s2->orders.object.number = 1;
- X /* is not building any VN's */
- X /* no assignment now */
- X! ship->orders.object.number2 = 0;
- X /* turn it on */
- X s2->on = 1;
- X } else {
- X /* we don't have too many in this herd, so make
- X some more */
- X! ship->orders.object.number++;
- X }
- X } else {
- X /* try and make some resources by ourselves.
- X--- 170,185 ----
- X s2->type = OTYPE_VN;
- X s2->mass = Shipdata[OTYPE_VN][ABIL_MASS];
- X s2->owner = (random()&01) ? ship->owner : 1;
- X! s2->object.number = 1;
- X /* is not building any VN's */
- X /* no assignment now */
- X! ship->object.number2 = 0;
- X /* turn it on */
- X s2->on = 1;
- X } else {
- X /* we don't have too many in this herd, so make
- X some more */
- X! ship->object.number++;
- X }
- X } else {
- X /* try and make some resources by ourselves.
- X***************
- X*** 191,203 ****
- X in doship */
- X }
- X } else { /* orbiting a planet */
- X! if (ship->orders.object.number2) {
- X if (ship->whatdest==LEVEL_PLAN && ship->deststar==starnum &&
- X ship->destpnum==planetnum) {
- X /* we just arrived from somewhere */
- X if (planet->type==TYPE_GASGIANT) {
- X if (ship->fuel >= Shipdata[OTYPE_VN][ABIL_FUELCAP])
- X! ship->orders.object.number2 = 0;
- X /* gas giants are of no use to us;
- X doship() will head us somewhere else */
- X } else {
- X--- 192,204 ----
- X in doship */
- X }
- X } else { /* orbiting a planet */
- X! if (ship->object.number2) {
- X if (ship->whatdest==LEVEL_PLAN && ship->deststar==starnum &&
- X ship->destpnum==planetnum) {
- X /* we just arrived from somewhere */
- X if (planet->type==TYPE_GASGIANT) {
- X if (ship->fuel >= Shipdata[OTYPE_VN][ABIL_FUELCAP])
- X! ship->object.number2 = 0;
- X /* gas giants are of no use to us;
- X doship() will head us somewhere else */
- X } else {
- X***************
- X*** 206,213 ****
- X printf(" VN finding a place to land\n");
- X Getxysect(planet,&x,&y,1);
- X while ((d=Getxysect(planet,&x,&y,0)) &&
- X! Sector(*planet,x,y).resource==0)
- X ;
- X if (d) {
- X printf(" VN landed.\n");
- X ship->is_docked = 1;
- X--- 207,215 ----
- X printf(" VN finding a place to land\n");
- X Getxysect(planet,&x,&y,1);
- X while ((d=Getxysect(planet,&x,&y,0)) &&
- X! Sector(*planet,x,y).resource == 0)
- X ;
- X+
- X if (d) {
- X printf(" VN landed.\n");
- X ship->is_docked = 1;
- X***************
- X*** 218,229 ****
- X
- X ship->xpos = x;
- X ship->ypos = y;
- X! ship->orders.object.number2 = 1;
- X /* number2 means we are currently
- X busy here */
- X } else {
- X /* head somewhere else */
- X! ship->orders.object.number2 = 0;
- X printf("turning off; can't find place 2land\n");
- X }
- X }
- X--- 220,231 ----
- X
- X ship->xpos = x;
- X ship->ypos = y;
- X! ship->object.number2 = 1;
- X /* number2 means we are currently
- X busy here */
- X } else {
- X /* head somewhere else */
- X! ship->object.number2 = 0;
- X printf("turning off; can't find place 2land\n");
- X }
- X }
- X***************
- X*** 242,248 ****
- X }
- X
- X /* bombard the planet */
- X! if (can_bombard(ship) && ship->orders.o.bombard
- X && ship->whatorbits==LEVEL_PLAN
- X && ship->whatdest==LEVEL_PLAN
- X && ship->deststar==starnum
- X--- 244,250 ----
- X }
- X
- X /* bombard the planet */
- X! if (can_bombard(ship) && ship->bombard
- X && ship->whatorbits==LEVEL_PLAN
- X && ship->whatdest==LEVEL_PLAN
- X && ship->deststar==starnum
- X***************
- X*** 281,286 ****
- X--- 283,289 ----
- X x = int_rand(0,planet->Maxx-1);
- X y = int_rand(0,planet->Maxy-1);
- X planet->info[Stinfo[starnum][planetnum].Thing_add-1].numsectsowned = 1;
- X+
- X planet->info[Stinfo[starnum][planetnum].Thing_add-1].explored = 1;
- X Sector(*planet,x,y).des =
- X races[Stinfo[starnum][planetnum].Thing_add]->likesbest;
- X***************
- X*** 320,326 ****
- X
- X /* gvc hack */
- X if (planet->info[i-1].numsectsowned) {
- X- printf("numsects %d %d \n",i,planet->info[i-1].numsectsowned);
- X Compat[i] = compatibility(planet, races[i]);
- X planet->info[i-1].numsectsowned = 0;
- X }
- X--- 323,328 ----
- X***************
- X*** 327,334 ****
- X--- 329,338 ----
- X
- X
- X printf(" while %d\n",Getxysect(planet, &x, &y, 1)); /* reset */
- X+
- X while (Getxysect(planet, &x, &y, 0)) {
- X p = &Sector(*planet,x,y);
- X+
- X if (p->amoeba) {
- X planet->info[1-1].numsectsowned++;
- X allamoeba &= 1;
- X***************
- X*** 420,429 ****
- X for (i=1; !Claims && !allexp && i<=Num_races; i++) {
- X printf("pl %d numsects %d compat %f\n",i,planet->info[i-1].numsectsowned,Compat[i]);
- X /* sectors have been modified for this player*/
- X! /* & planet is compatible enough */
- X! if (planet->info[i-1].numsectsowned && Compat[i] > 40.0)
- X! while (!Claims && !allexp && --timer) {
- X! printf("exploring ... timer=%d\n",timer);
- X o = 1;
- X Getxysect(planet, &x, &y, 1);
- X while (!Claims && Getxysect(planet, &x, &y, 0)) {
- X--- 424,433 ----
- X for (i=1; !Claims && !allexp && i<=Num_races; i++) {
- X printf("pl %d numsects %d compat %f\n",i,planet->info[i-1].numsectsowned,Compat[i]);
- X /* sectors have been modified for this player*/
- X!
- X! if (planet->info[i-1].numsectsowned)
- X! while (!Claims && !allexp && timer>0) {
- X! timer -= 1;
- X o = 1;
- X Getxysect(planet, &x, &y, 1);
- X while (!Claims && Getxysect(planet, &x, &y, 0)) {
- X***************
- X*** 433,439 ****
- X if (( (Sectinfo[x][y].explored==i) && !(random()&02) )
- X && (!p->owner && !p->is_wasted && !p->amoeba && p->des==races[i]->likesbest) ) {
- X /* explorations have found an island */
- X- printf(" got here 2\n");
- X printf("found island @ %d,%d\n",x,y);
- X Claims = i;
- X /* give them some free people there */
- X--- 437,442 ----
- X***************
- X*** 440,447 ****
- X p->popn = races[i]->number_sexes;
- X p->owner = i;
- X tot_captured = 1;
- X! } else
- X explore(planet, p, x, y, i);
- X }
- X allexp |= o; /* all sectors explored for this player */
- X
- X--- 443,452 ----
- X p->popn = races[i]->number_sexes;
- X p->owner = i;
- X tot_captured = 1;
- X! } else {
- X!
- X explore(planet, p, x, y, i);
- X+ }
- X }
- X allexp |= o; /* all sectors explored for this player */
- X
- X***************
- X*** 542,547 ****
- X--- 547,591 ----
- X
- X
- X for (i=1; i<=Num_races; i++) {
- X+
- X+ /* check to see if your guys steal all alien resources on the planet,
- X+ this requires that you be the only one inhabiting the planet */
- X+ if(planet->info[i-1].numsectsowned > 0){
- X+
- X+ aliensects = 0;
- X+ stolenres =0;
- X+ stolendes =0;
- X+ stolenfuel = 0.0;
- X+ for (j=1; j<=Num_races; j++)
- X+ if(j!=i){
- X+ aliensects += planet->info[j-1].numsectsowned;
- X+ stolenres += planet->info[j-1].resource;
- X+ stolendes += planet->info[j-1].destruct;
- X+ stolenfuel += planet->info[j-1].fuel;
- X+ }
- X+
- X+ if(aliensects ==0 && (stolenres !=0 || stolendes !=0 || stolenfuel != 0.0) ) {
- X+ for (j=1; j<=Num_races; j++)
- X+ if(j!=i)
- X+ {
- X+ planet->info[j-1].resource = 0;
- X+ planet->info[j-1].destruct = 0;
- X+ planet->info[j-1].fuel = 0.0;
- X+ }
- X+ planet->info[i-1].resource += stolenres;
- X+ planet->info[i-1].destruct += stolendes;
- X+ planet->info[i-1].fuel += stolenfuel;
- X+ /* notify player of recovered stockpiles */
- X+ teleg_add("",telegram_buf); /* clear buf */
- X+ sprintf(buf,"****** Report: Planet /%s/%s ******\n\n",
- X+ Stars[starnum]->name, Stars[starnum]->pnames[planetnum] );
- X+ teleg_add(buf,telegram_buf);
- X+ sprintf(buf," %d resources \n %d destruct \n %4.2f fuel recovered from alien stock piles",stolenres,stolendes,stolenfuel);
- X+ teleg_add(buf,telegram_buf);
- X+ teleg_send(TELEG_PLAYER_AUTO, i, telegram_buf);
- X+ }
- X+ }
- X+
- X Power[i].resource += planet->info[i-1].resource;
- X Power[i].destruct += planet->info[i-1].destruct;
- X Power[i].fuel += planet->info[i-1].fuel;
- X***************
- X*** 557,564 ****
- X }
- X
- X if(planet->maxpopn > 0)
- X! planet->conditions[TOXIC] = planet->conditions[TOXIC] +
- X planet->popn / planet->maxpopn;
- X
- X /* deal with enslaved planets */
- X if (planet->slaved_to) {
- X--- 601,609 ----
- X }
- X
- X if(planet->maxpopn > 0)
- X! planet->conditions[TOXIC] = planet->conditions[TOXIC] +
- X planet->popn / planet->maxpopn;
- X+
- X
- X /* deal with enslaved planets */
- X if (planet->slaved_to) {
- X*** ../../GB2/dosector.c Wed Jul 5 15:15:09 1989
- X--- dosector.c Fri Sep 15 07:27:52 1989
- X***************
- X*** 19,46 ****
- X reg planettype *planet;
- X reg sectortype *s;
- X {
- X reg float factor;
- X reg int eff;
- X reg struct plinfo *pinf;
- X reg int new;
- X
- X
- X- factor = logscale(s->popn) * s->resource * races[s->owner]->metabolism;
- X-
- X pinf = &planet->info[s->owner-1];
- X
- X- prod_fuel[s->owner] = round_rand( s->eff * factor * FUEL_PRODUCTION
- X- * ((planet->type==TYPE_GASGIANT)* 4+1) );
- X
- X! prod_res[s->owner] = round_rand( s->eff * factor * RESOURCE_PRODUCTION
- X! * ((planet->type==TYPE_ASTEROID) * 1 + 1) * (100 - s->mobilization)/100.);
- X
- X! prod_destruct[s->owner] = round_rand( s->eff * factor * DEST_PRODUCTION
- X! * ((planet->type==TYPE_ASTEROID) * 1 + 1) * s->mobilization /100.);
- X
- X
- X- /* deplete resources for making weapons - removed by gvc*/
- X- tot_resdep = 0;
- X
- X /* increase mobilization to planetary quota */
- X if (s->mobilization < pinf->mob_set)
- X--- 19,46 ----
- X reg planettype *planet;
- X reg sectortype *s;
- X {
- X+
- X+ int fac,ss;
- X+
- X reg float factor;
- X reg int eff;
- X reg struct plinfo *pinf;
- X reg int new;
- X
- X+ factor = .01 * log1p(1.*s->eff) * log1p(1.*s->popn) * s->resource * races[s->owner]->metabolism * ((s->des==DES_GAS)*4+1);
- X
- X pinf = &planet->info[s->owner-1];
- X
- X
- X! prod_fuel[s->owner] = round_rand( factor * FUEL_PRODUCTION
- X! * 100 * ((s->des==DES_GAS)*3+1) );
- X
- X! prod_res[s->owner] = round_rand( factor * RESOURCE_PRODUCTION
- X! * (100 - s->mobilization) );
- X
- X+ prod_destruct[s->owner] = round_rand( factor * DEST_PRODUCTION
- X+ * s->mobilization );
- X
- X
- X /* increase mobilization to planetary quota */
- X if (s->mobilization < pinf->mob_set)
- X***************
- X*** 50,55 ****
- X--- 50,62 ----
- X prod_mob++;
- X }
- X
- X+ /* decrease mobilization to planetary quota */
- X+ if (s->mobilization > pinf->mob_set)
- X+ if (pinf->resource + prod_res[s->owner] > 0) {
- X+ s->mobilization--;
- X+ prod_res[s->owner] -= round_rand(MOB_COST);
- X+ prod_mob++;
- X+ }
- X
- X
- X /* add mobilization to get average mobilization */
- X***************
- X*** 62,68 ****
- X prod_eff += s->eff = 1;
- X } else {
- X prod_eff +=
- X! (eff = round_rand(races[s->owner]->metabolism*s->popn*EFF_PROD/100.0));
- X if (s->eff+eff >= 100) {
- X s->eff=100; /* dont go past 100%*/
- X prod_eff -= s->eff+eff-100;
- X--- 69,75 ----
- X prod_eff += s->eff = 1;
- X } else {
- X prod_eff +=
- X! (eff = round_rand(races[s->owner]->metabolism*5*log1p(1.*s->popn)*EFF_PROD/100.0));
- X if (s->eff+eff >= 100) {
- X s->eff=100; /* dont go past 100%*/
- X prod_eff -= s->eff+eff-100;
- X***************
- X*** 72,85 ****
- X }
- X }
- X
- X! /* add population to sector */
- X! if (s->popn >= races[s->owner]->number_sexes)
- X! s->popn += round_rand((float)s->popn * races[s->owner]->birthrate
- X! * Compat[s->owner] / 100.0
- X! * (50.0 - planet->conditions[TOXIC]) / 50.0 );
- X else
- X s->popn = round_rand(s->popn * .099);
- X!
- X }
- X
- X
- X--- 79,101 ----
- X }
- X }
- X
- X! if (s->popn >= races[s->owner]->number_sexes) {
- X! fac =round_rand( .01 * (100. - planet->conditions[TOXIC])
- X! * maxsupport(races[s->owner],s,Compat[s->owner]) );
- X!
- X! ss = round_rand(
- X! races[s->owner]->birthrate * (1.*fac - 1.*s->popn) );
- X!
- X! s->popn = MAX(0, s->popn + ss);
- X!
- X! if(s->popn == 0) s->owner=0;
- X!
- X! }
- X else
- X+ {
- X s->popn = round_rand(s->popn * .099);
- X! if(s->popn = 0)s->owner=0;
- X! }
- X }
- X
- X
- X***************
- X*** 101,113 ****
- X reg sectortype *s;
- X reg int x,y;
- X {
- X! reg int peep;
- X
- X if (pl->is_sheep)
- X return; /* no one wants to go anywhere */
- X
- X /* peep == number of people who want to move */
- X! if (s->amoeba || (peep = round_rand((float)s->popn * races[s->owner]->nonhomebodies)) ) {
- X if (pl->type==TYPE_GASGIANT && s->des==DES_GAS && !int_rand(0,20)) {
- X /* random 'wind' sweeps people in this sector, somewhere else */
- X reg int x2,y2;
- X--- 117,132 ----
- X reg sectortype *s;
- X reg int x,y;
- X {
- X! int peep;
- X
- X if (pl->is_sheep)
- X return; /* no one wants to go anywhere */
- X
- X /* peep == number of people who want to move */
- X!
- X! peep = round_rand((float)s->popn * races[s->owner]->nonhomebodies);
- X!
- X! if (s->amoeba || peep) {
- X if (pl->type==TYPE_GASGIANT && s->des==DES_GAS && !int_rand(0,20)) {
- X /* random 'wind' sweeps people in this sector, somewhere else */
- X reg int x2,y2;
- X***************
- X*** 257,263 ****
- X
- X /* explore sectors surrounding sectors currently explored. */
- X if (Sectinfo[x][y].explored) {
- X-
- X Sectinfo[mod(x-1,planet->Maxx,d)][y].explored = p;
- X Sectinfo[mod(x+1,planet->Maxx,d)][y].explored = p;
- X if (y==0) {
- X--- 276,281 ----
- X*** ../../GB2/doship.c Wed Jul 5 15:15:11 1989
- X--- doship.c Fri Sep 15 07:27:54 1989
- X***************
- X*** 20,40 ****
- X int sh,sh2,j,shfdata;
- X char buf[300];
- X
- X- if (!ship->is_dead && (ship->owner == 0 && ship->type != OTYPE_VN
- X- && ship->type != OTYPE_AMOEBA) )
- X- /* a hack by gvc to get rid of owner 0, space pod which occasionally
- X- gets created for unknown reason (and consequentially causes problems) */
- X- {
- X- ship->is_dead = 1;
- X- ship->owner = 1;
- X
- X! } /* used to counteract bugs */
- X
- X- if (!ship->is_dead) {
- X-
- X /* add ships, popn to total count to add AP's */
- X if (ship->type==OTYPE_VN)
- X! Power[ship->owner].ships_owned += ship->orders.object.number;
- X else
- X Power[ship->owner].ships_owned++;
- X Power[ship->owner].resource += ship->resource;
- X--- 20,31 ----
- X int sh,sh2,j,shfdata;
- X char buf[300];
- X
- X
- X! if (ship->is_alive) {
- X
- X /* add ships, popn to total count to add AP's */
- X if (ship->type==OTYPE_VN)
- X! Power[ship->owner].ships_owned += ship->object.number;
- X else
- X Power[ship->owner].ships_owned++;
- X Power[ship->owner].resource += ship->resource;
- X***************
- X*** 46,52 ****
- X Sdatapopns[ship->owner] += ship->popn;
- X } else {
- X starnumships[ship->storbits][ship->owner] +=
- X! (ship->type==OTYPE_VN) ? ship->orders.object.number : 1;
- X /* add popn of ships to popn */
- X starpopns[ship->storbits][ship->owner] += ship->popn;
- X /* set inhabited for ship */
- X--- 37,43 ----
- X Sdatapopns[ship->owner] += ship->popn;
- X } else {
- X starnumships[ship->storbits][ship->owner] +=
- X! (ship->type==OTYPE_VN) ? ship->object.number : 1;
- X /* add popn of ships to popn */
- X starpopns[ship->storbits][ship->owner] += ship->popn;
- X /* set inhabited for ship */
- X***************
- X*** 55,71 ****
- X
- X /* repair radiation */
- X if (ship->rad) {
- X /* kill off some people */
- X! ship->popn = round_rand(ship->popn * .90);
- X if (ship->rad > REPAIR_RATE)
- X ship->rad -= REPAIR_RATE;
- X else
- X ship->rad = 0;
- X } else {
- X! /* irradiated ships are immobile.. */
- X!
- X /* make sure of an update if someones bombarding the planet */
- X! if (can_bombard(ship) && ship->orders.o.bombard &&
- X ship->whatorbits==LEVEL_PLAN)
- X Stinfo[ship->storbits][ship->pnumorbits].inhab = 1;
- X
- X--- 46,62 ----
- X
- X /* repair radiation */
- X if (ship->rad) {
- X+ /* irradiated ships are immobile.. */
- X /* kill off some people */
- X! ship->popn = round_rand(ship->popn * .80);
- X if (ship->rad > REPAIR_RATE)
- X ship->rad -= REPAIR_RATE;
- X else
- X ship->rad = 0;
- X } else {
- X!
- X /* make sure of an update if someones bombarding the planet */
- X! if (can_bombard(ship) && ship->bombard &&
- X ship->whatorbits==LEVEL_PLAN)
- X Stinfo[ship->storbits][ship->pnumorbits].inhab = 1;
- X
- X***************
- X*** 85,91 ****
- X
- X case OTYPE_CANIST:
- X if (ship->whatorbits == LEVEL_PLAN && !ship->is_docked) { short *t;
- X! if (--ship->orders.object.number) {
- X t = &Stinfo[ship->storbits][ship->pnumorbits].temp_add;
- X if (*t - 10 < -120)
- X *t = -120;
- X--- 76,82 ----
- X
- X case OTYPE_CANIST:
- X if (ship->whatorbits == LEVEL_PLAN && !ship->is_docked) { short *t;
- X! if (--ship->object.number) {
- X t = &Stinfo[ship->storbits][ship->pnumorbits].temp_add;
- X if (*t - 10 < -120)
- X *t = -120;
- X***************
- X*** 110,116 ****
- X case STYPE_MINE:
- X /* check around and see if we should explode. */
- X if (ship->on) {
- X! int rad=0; float xd,yd; int p;
- X if (ship->whatorbits==LEVEL_STAR)
- X sh = Stars[ship->storbits]->ships;
- X else if (ship->whatorbits==LEVEL_PLAN)
- X--- 101,107 ----
- X case STYPE_MINE:
- X /* check around and see if we should explode. */
- X if (ship->on) {
- X! int rad=0; int dam=0; float xd,yd; int p;
- X if (ship->whatorbits==LEVEL_STAR)
- X sh = Stars[ship->storbits]->ships;
- X else if (ship->whatorbits==LEVEL_PLAN)
- X***************
- X*** 125,131 ****
- X yd = ships[sh]->ypos - ship->ypos;
- X if ( (ships[sh]->type != STYPE_MINE) &&
- X (ships[sh]->owner != Playernum) &&
- X! ( xd*xd+yd*yd < ship->orders.object.number * ship->orders.object.number) )
- X rad = 1;
- X sh = ships[sh]->nextship;
- X }
- X--- 116,122 ----
- X yd = ships[sh]->ypos - ship->ypos;
- X if ( (ships[sh]->type != STYPE_MINE) &&
- X (ships[sh]->owner != Playernum) &&
- X! ( xd*xd+yd*yd < ship->object.number * ship->object.number) )
- X rad = 1;
- X sh = ships[sh]->nextship;
- X }
- X***************
- X*** 139,158 ****
- X xd = ships[sh2]->xpos - ship->xpos;
- X yd = ships[sh2]->ypos - ship->ypos;
- X
- X if ( ships[sh2]->popn != 0 ) {
- X! rad = round_rand(ship->destruct
- X! * (2500/(xd*xd + yd*yd + 1.)) );
- X if (ships[sh2]->rad + rad > 100)
- X ships[sh2]->rad = 100;
- X else
- X ships[sh2]->rad += rad;
- X
- X teleg_add("",telegram_buf);
- X! sprintf(buf, "BULLETIN!\n ship #%d irradiated by mine at system /%s - dosage %d percent",
- X! sh2, Stars[ship->storbits]->name, rad);
- X teleg_add(buf, telegram_buf);
- X teleg_send(TELEG_PLAYER_AUTO,ships[sh2]->owner,telegram_buf);
- X }
- X sh2 = ships[sh2]->nextship;
- X }
- X }
- X--- 130,178 ----
- X xd = ships[sh2]->xpos - ship->xpos;
- X yd = ships[sh2]->ypos - ship->ypos;
- X
- X+ if (!ship->mine.mode) {
- X if ( ships[sh2]->popn != 0 ) {
- X! rad = round_rand(ship->destruct *
- X! (5./(float)Shipdata[ships[sh2]->type][ABIL_ARMOR]) * (2500/(xd*xd + yd*yd + 1.)) );
- X if (ships[sh2]->rad + rad > 100)
- X ships[sh2]->rad = 100;
- X else
- X ships[sh2]->rad += rad;
- X
- X+ if(rad)
- X+ {
- X teleg_add("",telegram_buf);
- X! sprintf(buf, "BULLETIN!\n %s #%d irradiated by mine at system /%s - dosage %d percent",
- X! Shipnames[ships[sh2]->type], sh2, Stars[ship->storbits]->name, rad);
- X teleg_add(buf, telegram_buf);
- X teleg_send(TELEG_PLAYER_AUTO,ships[sh2]->owner,telegram_buf);
- X+ }
- X+
- X+ } /* ships radiated */
- X+ } else {
- X+ rad = round_rand(ship->destruct *
- X+ (5./(float)Shipdata[ships[sh2]->type][ABIL_ARMOR]) *
- X+ (2500/(xd*xd + yd*yd + 1.)) );
- X+
- X+ dam = int_rand(0,rad);
- X+
- X+ if(dam)
- X+ {
- X+ ships[sh2]->damage += dam;
- X+ teleg_add("",telegram_buf);
- X+
- X+ sprintf(buf, "BULLETIN!\n %s #%d damaged by mine at system /%s - %d %% damage",
- X+ Shipnames[ships[sh2]->type], sh2, Stars[ship->storbits]->name, dam);
- X+ teleg_add(buf, telegram_buf);
- X+ if(ships[sh2]->damage >= 100)
- X+ {
- X+ kill_ship(ships[sh2]);
- X+ sprintf(buf, " %s #%d DESTROYED",Shipnames[ships[sh2]->type],sh2);
- X }
- X+ teleg_send(TELEG_PLAYER_AUTO,ships[sh2]->owner,telegram_buf);
- X+ } /* ships attacked by explosive */
- X+ }
- X+
- X sh2 = ships[sh2]->nextship;
- X }
- X }
- X***************
- X*** 160,179 ****
- X break;
- X
- X case STYPE_MIRROR:
- X! switch (ship->orders.aimed_at.level) {
- X case LEVEL_SHIP: /* ship aimed at is a legal ship now */
- X /* if in the same system */
- X if ( (ship->whatorbits==LEVEL_STAR || ship->whatorbits==LEVEL_PLAN)
- X! && (ships[ship->orders.aimed_at.shipno]!=NULL)
- X! && (ships[ship->orders.aimed_at.shipno]->whatorbits==LEVEL_STAR ||
- X! ships[ship->orders.aimed_at.shipno]->whatorbits==LEVEL_PLAN)
- X! && ship->storbits == ships[ship->orders.aimed_at.shipno]->storbits
- X! && !ships[ship->orders.aimed_at.shipno]->is_dead )
- X! ships[ship->orders.aimed_at.shipno]->damage += 10;
- X break;
- X case LEVEL_PLAN: { reg short *t; reg int i;
- X! t = &Stinfo[ship->storbits][ship->orders.aimed_at.pnum].temp_add;
- X! i = ship->orders.aimed_at.intensity;
- X if (*t + i > 120)
- X *t = 120;
- X else if (*t + i < -120)
- X--- 180,199 ----
- X break;
- X
- X case STYPE_MIRROR:
- X! switch (ship->aimed_at.level) {
- X case LEVEL_SHIP: /* ship aimed at is a legal ship now */
- X /* if in the same system */
- X if ( (ship->whatorbits==LEVEL_STAR || ship->whatorbits==LEVEL_PLAN)
- X! && (ships[ship->aimed_at.shipno]!=NULL)
- X! && (ships[ship->aimed_at.shipno]->whatorbits==LEVEL_STAR ||
- X! ships[ship->aimed_at.shipno]->whatorbits==LEVEL_PLAN)
- X! && ship->storbits == ships[ship->aimed_at.shipno]->storbits
- X! && ships[ship->aimed_at.shipno]->is_alive )
- X! ships[ship->aimed_at.shipno]->damage += 10;
- X break;
- X case LEVEL_PLAN: { reg short *t; reg int i;
- X! t = &Stinfo[ship->storbits][ship->aimed_at.pnum].temp_add;
- X! i = ship->aimed_at.intensity;
- X if (*t + i > 120)
- X *t = 120;
- X else if (*t + i < -120)
- X***************
- X*** 183,191 ****
- X }
- X break;
- X case LEVEL_STAR:
- X! if (ship->orders.aimed_at.snum>0 &&
- X! ship->orders.aimed_at.snum<Sdata.numstars)
- X! Stars[ship->orders.aimed_at.snum]->stability += random()&01;
- X break;
- X case LEVEL_UNIV:
- X break;
- X--- 203,211 ----
- X }
- X break;
- X case LEVEL_STAR:
- X! if (ship->aimed_at.snum>0 &&
- X! ship->aimed_at.snum<Sdata.numstars)
- X! Stars[ship->aimed_at.snum]->stability += random()&01;
- X break;
- X case LEVEL_UNIV:
- X break;
- X***************
- X*** 221,227 ****
- X break;
- X
- X case OTYPE_AMOEBA: /* space amoeba */
- X! if (ship->orders.amoeba.dig) {
- X /* we are currently digesting a planet. */
- X if (planets[ship->storbits][ship->pnumorbits]->digested) {
- X reg int i,s; reg bool f=0;
- X--- 241,247 ----
- X break;
- X
- X case OTYPE_AMOEBA: /* space amoeba */
- X! if (ship->amoeba.dig) {
- X /* we are currently digesting a planet. */
- X if (planets[ship->storbits][ship->pnumorbits]->digested) {
- X reg int i,s; reg bool f=0;
- X***************
- X*** 252,264 ****
- X /*ship->whatorbits = LEVEL_STAR;
- X ship->whatdest = LEVEL_UNIV;*/
- X /* no longer digesting */
- X! ship->orders.amoeba.dig = 0;
- X /* find a new place to digest */
- X! ship->orders.amoeba.dest = 0;
- X }
- X } else {
- X /* we have a planet in mind. */
- X! if (!ship->orders.amoeba.dest || ship->whatdest==LEVEL_UNIV) {
- X /* we have orders; wait to get to destination */
- X if (ship->whatdest == LEVEL_PLAN &&
- X ship->whatorbits == LEVEL_PLAN &&
- X--- 272,284 ----
- X /*ship->whatorbits = LEVEL_STAR;
- X ship->whatdest = LEVEL_UNIV;*/
- X /* no longer digesting */
- X! ship->amoeba.dig = 0;
- X /* find a new place to digest */
- X! ship->amoeba.dest = 0;
- X }
- X } else {
- X /* we have a planet in mind. */
- X! if (!ship->amoeba.dest || ship->whatdest==LEVEL_UNIV) {
- X /* we have orders; wait to get to destination */
- X if (ship->whatdest == LEVEL_PLAN &&
- X ship->whatorbits == LEVEL_PLAN &&
- X***************
- X*** 267,273 ****
- X /* we just arrived at our destination. */
- X Stinfo[ship->storbits][ship->pnumorbits].amoeba_add = 1;
- X /* start digesting */
- X! ship->orders.amoeba.dig = 1;
- X /* telegram people */
- X teleg_add("", telegram_buf);
- X teleg_add("BULLETIN!!\n\n ",telegram_buf);
- X--- 287,293 ----
- X /* we just arrived at our destination. */
- X Stinfo[ship->storbits][ship->pnumorbits].amoeba_add = 1;
- X /* start digesting */
- X! ship->amoeba.dig = 1;
- X /* telegram people */
- X teleg_add("", telegram_buf);
- X teleg_add("BULLETIN!!\n\n ",telegram_buf);
- X***************
- X*** 310,319 ****
- X ship->destpnum =
- X int_rand(0,Stars[ship->deststar]->numplanets-1);
- X ship->whatdest = LEVEL_PLAN;
- X! ship->orders.amoeba.dest = 1;
- X } else {
- X /* no good; find someplace else. */
- X! ship->orders.amoeba.dest = 0;
- X }
- X ship->speed = 1; /* amoebae are very fastidious,too */
- X fprintf(stderr,"amoeba #%d headed for star %d, pl %d.\n",shipno,ship->deststar, ship->destpnum);
- X--- 330,339 ----
- X ship->destpnum =
- X int_rand(0,Stars[ship->deststar]->numplanets-1);
- X ship->whatdest = LEVEL_PLAN;
- X! ship->amoeba.dest = 1;
- X } else {
- X /* no good; find someplace else. */
- X! ship->amoeba.dest = 0;
- X }
- X ship->speed = 1; /* amoebae are very fastidious,too */
- X fprintf(stderr,"amoeba #%d headed for star %d, pl %d.\n",shipno,ship->deststar, ship->destpnum);
- X***************
- X*** 333,341 ****
- X
- X case OTYPE_OMCL:
- X /* orbital mind control laser */
- X! if (ship->orders.aimed_at.level==LEVEL_PLAN && ship->on &&
- X ship->speed==1) {
- X! planets[ship->orders.aimed_at.snum][ship->orders.aimed_at.pnum]
- X ->is_sheep = 1;
- X }
- X break;
- X--- 353,361 ----
- X
- X case OTYPE_OMCL:
- X /* orbital mind control laser */
- X! if (ship->aimed_at.level==LEVEL_PLAN && ship->on &&
- X ship->speed==1) {
- X! planets[ship->aimed_at.snum][ship->aimed_at.pnum]
- X ->is_sheep = 1;
- X }
- X break;
- X***************
- X*** 400,406 ****
- X
- X }
- X
- X! } else if (ship->owner ==0 || !ship->notified) {
- X /* ship is dead -- add to shipfree file, remove from all lists. */
- X /* if notified, this means it's already been deleted and written. */
- X ship->notified = 1;
- X--- 420,426 ----
- X
- X }
- X
- X! } else if (!ship->is_alive && !ship->notified) {
- X /* ship is dead -- add to shipfree file, remove from all lists. */
- X /* if notified, this means it's already been deleted and written. */
- X ship->notified = 1;
- X***************
- X*** 413,419 ****
- X
- X
- X do_VN(ship,shipno)
- X! shiptype *ship;
- X int shipno;
- X {
- X int r;
- X--- 433,440 ----
- X
- X
- X do_VN(ship,shipno)
- X! struct ship *ship;
- X! /* shiptype *ship; */
- X int shipno;
- X {
- X int r;
- X***************
- X*** 430,436 ****
- X /* make sure the planet is updated */
- X Stinfo[ship->storbits][ship->pnumorbits].inhab = 1;
- X /* try to launch it */
- X! if (ship->orders.object.number2 == 0) { /* launch if no assignment */
- X /* steal some fuel from other players,telegram */
- X int f=0;
- X if (ship->fuel < Shipdata[OTYPE_VN][ABIL_COST]) {
- X--- 451,457 ----
- X /* make sure the planet is updated */
- X Stinfo[ship->storbits][ship->pnumorbits].inhab = 1;
- X /* try to launch it */
- X! if (ship->object.number2 == 0) { /* launch if no assignment */
- X /* steal some fuel from other players,telegram */
- X int f=0;
- X if (ship->fuel < Shipdata[OTYPE_VN][ABIL_COST]) {
- X***************
- X*** 450,456 ****
- X teleg_add(buf,telegram_buf);
- X teleg_send(TELEG_PLAYER_AUTO, f, telegram_buf);
- X
- X! ship->orders.object.number2 = 0; /* no current assignment */
- X ship->xpos = Stars[ship->storbits]->xpos + planets[ship->storbits][ship->pnumorbits]->xpos + int_rand(-10,10);
- X ship->ypos = Stars[ship->storbits]->ypos + planets[ship->storbits][ship->pnumorbits]->ypos + int_rand(-10,10);
- X ship->is_docked = 0;
- X--- 471,477 ----
- X teleg_add(buf,telegram_buf);
- X teleg_send(TELEG_PLAYER_AUTO, f, telegram_buf);
- X
- X! ship->object.number2 = 0; /* no current assignment */
- X ship->xpos = Stars[ship->storbits]->xpos + planets[ship->storbits][ship->pnumorbits]->xpos + int_rand(-10,10);
- X ship->ypos = Stars[ship->storbits]->ypos + planets[ship->storbits][ship->pnumorbits]->ypos + int_rand(-10,10);
- X ship->is_docked = 0;
- X***************
- X*** 473,479 ****
- X if (p->info[nums[i]-1].resource)
- X f = nums[i];
- X if (f) {
- X! p->info[f-1].resource -= Shipdata[OTYPE_VN][ABIL_COST];
- X ship->resource += Shipdata[OTYPE_VN][ABIL_COST];
- X ship->mass += Shipdata[OTYPE_VN][ABIL_COST] * MASS_RESOURCE;
- X teleg_add("",telegram_buf);
- X--- 494,502 ----
- X if (p->info[nums[i]-1].resource)
- X f = nums[i];
- X if (f) {
- X! p->info[f-1].resource -=
- X! MIN( p->info[f-1].resource,
- X! Shipdata[OTYPE_VN][ABIL_COST]);
- X ship->resource += Shipdata[OTYPE_VN][ABIL_COST];
- X ship->mass += Shipdata[OTYPE_VN][ABIL_COST] * MASS_RESOURCE;
- X teleg_add("",telegram_buf);
- X***************
- X*** 493,499 ****
- X }
- X } else {
- X /* we are not landed */
- X! if (ship->orders.object.number2) {
- X /* we've arrived from somewhere -- look for a place to land.
- X this is done on planet turn */
- X } else {
- X--- 516,522 ----
- X }
- X } else {
- X /* we are not landed */
- X! if (ship->object.number2) {
- X /* we've arrived from somewhere -- look for a place to land.
- X this is done on planet turn */
- X } else {
- X***************
- X*** 518,527 ****
- X ship->destpnum =
- X int_rand(0,Stars[ship->deststar]->numplanets-1);
- X ship->whatdest = LEVEL_PLAN;
- X! ship->orders.object.number2 = 1;
- X } else {
- X /* no good; find someplace else. */
- X! ship->orders.object.number2 = 0;
- X }
- X ship->speed = 1; /* VN's are very fastidious */
- X fprintf(stderr,"VN #%d headed for star %d, pl %d.\n",shipno,ship->deststar, ship->destpnum);
- X--- 541,550 ----
- X ship->destpnum =
- X int_rand(0,Stars[ship->deststar]->numplanets-1);
- X ship->whatdest = LEVEL_PLAN;
- X! ship->object.number2 = 1;
- X } else {
- X /* no good; find someplace else. */
- X! ship->object.number2 = 0;
- X }
- X ship->speed = 1; /* VN's are very fastidious */
- X fprintf(stderr,"VN #%d headed for star %d, pl %d.\n",shipno,ship->deststar, ship->destpnum);
- X*** ../../GB2/doturn.c Wed Jul 5 15:15:12 1989
- X--- doturn.c Fri Sep 15 07:27:56 1989
- X***************
- X*** 62,72 ****
- X--- 62,74 ----
- X ships = (shiptype **)malloc(sizeof(shiptype *) * Num_ships);
- X for (i=1; i<=Num_ships; i++) {
- X getship(shdata,&ships[i],i);
- X+
- X if (ships[i]->whatorbits >= LEVEL_STAR)
- X StarsInhab[ships[i]->storbits] = 1;
- X }
- X close(shdata);
- X
- X+
- X /* get all stars & planets */
- X openstardata(&stardata);
- X getsdata(stardata,&Sdata);
- X***************
- X*** 86,91 ****
- X--- 88,95 ----
- X
- X
- X races[0] = (racetype *)NULL; /* for maxsupport() */
- X+
- X+
- X for (i=1; i<=Num_races; i++) {
- X getrace(&(races[i]),i);
- X /* increase tech; change to something else */
- X***************
- X*** 110,115 ****
- X--- 114,121 ----
- X
- X /* insert ship into the list of wherever it might be */
- X for (i=Num_ships; i>=1; i--) {
- X+ if( !(ships[i]->type == STYPE_FIGHTER &&
- X+ ships[i]->object.number4) )
- X insert_sh(&Sdata, Stars[ships[i]->storbits],
- X planets[ships[i]->storbits][ships[i]->pnumorbits],
- X ships[i], i);
- X***************
- X*** 135,140 ****
- X--- 141,147 ----
- X for (pppp=0; pppp<Stars[star]->numplanets; pppp++)
- X printf(" 8Pointer %d,%d= %x\n",ppp,pppp,planets[ppp][pppp]);*/
- X
- X+ printf("%s %d\n",Stars[star]->name,i);
- X if (doplanet(star, planets[star][i], i, command)) {
- X /* save smap gotten & altered by doplanet only if the planet is expl*/
- X opensectdata(§data);
- X*** ../../GB2/doturn.h Wed Jul 5 15:14:53 1989
- X--- doturn.h Fri Sep 15 07:27:36 1989
- X***************
- X*** 34,37 ****
- X extern int tot_resdep, prod_eff, prod_res[MAXPLAYERS],
- X prod_fuel[MAXPLAYERS], prod_destruct[MAXPLAYERS],
- X tot_captured, prod_mob;
- X-
- X--- 34,36 ----
- END_OF_FILE
- if test 52745 -ne `wc -c <'patches01a'`; then
- echo shar: \"'patches01a'\" unpacked with wrong size!
- fi
- # end of 'patches01a'
- fi
- echo shar: End of archive 1 \(of 4\).
- cp /dev/null ark1isdone
- MISSING=""
- for I in 1 2 3 4 ; do
- if test ! -f ark${I}isdone ; then
- MISSING="${MISSING} ${I}"
- fi
- done
- if test "${MISSING}" = "" ; then
- echo You have unpacked all 4 archives.
- rm -f ark[1-9]isdone
- else
- echo You still need to unpack the following archives:
- echo " " ${MISSING}
- fi
- ## End of shell archive.
- exit 0
-