billr@saab.CNA.TEK.COM (Bill Randle) (08/29/90)
Submitted-by: VANCLEEF@mps.ohio-state.edu Posting-number: Volume 11, Issue 40 Archive-name: gb3/Patch2b Patch-To: gb3: Volume 10, Issue 1-14 #! /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 2 (of 9)." # Contents: patches02b server/patchlevel.h # Wrapped by billr@saab on Tue Aug 28 08:54:53 1990 PATH=/bin:/usr/bin:/usr/ucb ; export PATH if test -f 'patches02b' -a "${1}" != "-c" ; then echo shar: Renaming existing file \"'patches02b'\" to \"'patches02b.orig'\" mv -f 'patches02b' 'patches02b.orig' fi echo shar: Extracting \"'patches02b'\" \(56321 characters\) sed "s/^X//" >'patches02b' <<'END_OF_FILE' X*** /usr/cna/billr/games/gb3/server/dosector.c Wed May 30 15:13:03 1990 X--- server/dosector.c Thu Aug 23 16:54:49 1990 X*************** X*** 31,41 **** X reg struct plinfo *pinf; X reg int new; X X- if(s->resource < 0) X- s->resource = -s->resource; X- X check(planet,20); X! factor = .4 * log10(1.0+(double)s->eff) * s->resource X * races[s->owner-1]->metabolism; X pinf = &planet->info[s->owner-1]; X X--- 31,38 ---- X reg struct plinfo *pinf; X reg int new; X X check(planet,20); X! factor = .4 * log10(1.0+(double)s->eff) * s->resource * (1+(planet->type==TYPE_EARTH)) X * races[s->owner-1]->metabolism; X pinf = &planet->info[s->owner-1]; X X*************** X*** 51,56 **** X--- 48,61 ---- X pdes = round_rand( factor * DEST_PRODUCTION X * s->mobilization ); X prod_destruct[s->owner-1] += pdes; X+ X+ X+ /* try to find crystals */ X+ /* chance of digging out a crystal depends on efficiency */ X+ if(s->crystals && int_rand(1,100) < s->eff) { X+ prod_crystals[s->owner-1]++; X+ s->crystals--; X+ } X X /* increase mobilization to planetary quota */ X if (s->mobilization < pinf->mob_set) { X*** /usr/cna/billr/games/gb3/server/enrol.c Wed May 30 15:13:07 1990 X--- server/enrol.c Fri Aug 24 15:10:01 1990 X*************** X*** 19,24 **** X--- 19,25 ---- X #include "buffers.h" X extern int errno; X char desshow(); X+ racetype *Race; X X struct stype { X char here; X*************** X*** 29,44 **** X X /* racial types (10 racial types ) */ X int Thing[RACIAL_TYPES] = {1, 1, 1, 0, 0, 0, 0, 0, 0, 0}; X! float db_Mass[RACIAL_TYPES] = {1.0, 1.5, 2.0, 1.25, 1.25, 1.25, 1.25, 1.25, 1.25, 1.25}; X float db_Birthrate[RACIAL_TYPES] = {0.8, 0.8, 0.9, 0.4, 0.4, 0.4, 0.4, 0.5, 0.5, 0.5}; X int db_Fighters[RACIAL_TYPES] = {6, 7, 8, 2, 3, 3, 4, 4, 5, 5}; X int db_Intelligence[RACIAL_TYPES] = {80, 70, 60, 190, 180, 170, 160, 150, 140, 130}; X! float db_Adventurism[RACIAL_TYPES] = {0.89, 0.89, 0.89, .5, .5, .5, .6, .6, .7, .8}; X int Min_Sexes[RACIAL_TYPES] = {1, 1, 1, 2, 2, 2, 2, 2, 2, 2}; X int Max_Sexes[RACIAL_TYPES] = {1, 1, 1, 2, 2, 4, 4, 4, 4, 4}; X float db_Metabolism[RACIAL_TYPES] = {1.3, 1.3, 1.3, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}; X X! #define RMass(x) (db_Mass[(x)] + .01*(float)int_rand(-25, 25)) X #define Birthrate(x) (db_Birthrate[(x)] + .01*(float)int_rand(-10, 10)) X #define Fighters(x) (db_Fighters[(x)] + int_rand(-1, 1)) X #define Intelligence(x) (db_Intelligence[(x)] + int_rand(-10, 10)) X--- 30,45 ---- X X /* racial types (10 racial types ) */ X int Thing[RACIAL_TYPES] = {1, 1, 1, 0, 0, 0, 0, 0, 0, 0}; X! float db_Mass[RACIAL_TYPES] = {.1,.15,.2,.125,.125,.125,.125,.125,.125,.125}; X float db_Birthrate[RACIAL_TYPES] = {0.8, 0.8, 0.9, 0.4, 0.4, 0.4, 0.4, 0.5, 0.5, 0.5}; X int db_Fighters[RACIAL_TYPES] = {6, 7, 8, 2, 3, 3, 4, 4, 5, 5}; X int db_Intelligence[RACIAL_TYPES] = {80, 70, 60, 190, 180, 170, 160, 150, 140, 130}; X! float db_Adventurism[RACIAL_TYPES] = {0.89, 0.89, 0.89, .6, .65, .7, .7, .75, .75, .8}; X int Min_Sexes[RACIAL_TYPES] = {1, 1, 1, 2, 2, 2, 2, 2, 2, 2}; X int Max_Sexes[RACIAL_TYPES] = {1, 1, 1, 2, 2, 4, 4, 4, 4, 4}; X float db_Metabolism[RACIAL_TYPES] = {1.3, 1.3, 1.3, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0}; X X! #define RMass(x) (db_Mass[(x)] + .001*(float)int_rand(-25, 25)) X #define Birthrate(x) (db_Birthrate[(x)] + .01*(float)int_rand(-10, 10)) X #define Fighters(x) (db_Fighters[(x)] + int_rand(-1, 1)) X #define Intelligence(x) (db_Intelligence[(x)] + int_rand(-10, 10)) X*************** X*** 90,107 **** X Two[i]=2*Two[i-1]; X X if ( (Playernum=Numraces()+1) >= MAXPLAYERS) { X! printf("There are already %d players; No more allowed.\n",MAXPLAYERS); X exit(-1); X } X X /*printf("Enter racial type to be created (1-%d):", RACIAL_TYPES); X scanf("%d", &idx); X getchr(); X idx -= 1; X */ X! idx = int_rand(3,10); X X! if(idx < 0 || idx > RACIAL_TYPES-1) { X printf("Bad racial index.\n"); X exit(1); X } X--- 91,109 ---- X Two[i]=2*Two[i-1]; X X if ( (Playernum=Numraces()+1) >= MAXPLAYERS) { X! printf("There are already %d players; No more allowed.\n",MAXPLAYERS-1); X exit(-1); X } X X+ X /*printf("Enter racial type to be created (1-%d):", RACIAL_TYPES); X scanf("%d", &idx); X getchr(); X idx -= 1; X */ X! idx = int_rand(3,9); X X! if(idx < 0 || idx >= RACIAL_TYPES) { X printf("Bad racial index.\n"); X exit(1); X } X*************** X*** 134,140 **** X X bzero((char *)not_found, sizeof(not_found)); X do { X- /* X printf("\nLive on what type planet:(e)arth, (g)asgiant, (a)irless, (i)ce, (w)ater? "); X c=getchr(); X getchr(); X--- 136,141 ---- X*************** X*** 154,162 **** X exit(-1); X break; X } X- */ X X! switch(int_rand(1,4)) { X case 1 : ppref = TYPE_EARTH; break; X case 2 : ppref = TYPE_AIRLESS; break; X case 3 : ppref = TYPE_ICEBALL; break; X--- 155,162 ---- X exit(-1); X break; X } X X! /* switch(int_rand(1,4)) { X case 1 : ppref = TYPE_EARTH; break; X case 2 : ppref = TYPE_AIRLESS; break; X case 3 : ppref = TYPE_ICEBALL; break; X*************** X*** 165,171 **** X exit(-1); X break; X } X! X printf("Looking for type %d planet...\n", ppref); X X /* find first planet of right type */ X--- 165,172 ---- X exit(-1); X break; X } X! */ X! X printf("Looking for type %d planet...\n", ppref); X X /* find first planet of right type */ X*************** X*** 175,185 **** X for (star=0; star<Sdata.numstars && !found && count < 100; ) { X X check = 1; X! /* skip over uninhabited stars */ X if (Stars[star]->inhabited) X check = 0; X X! /* look for unihabited planets */ X if (check) { X pnum = 0; X while (!found && pnum<Stars[star]->numplanets) { X--- 176,186 ---- X for (star=0; star<Sdata.numstars && !found && count < 100; ) { X X check = 1; X! /* skip over inhabited stars */ X if (Stars[star]->inhabited) X check = 0; X X! /* look for uninhabited planets */ X if (check) { X pnum = 0; X while (!found && pnum<Stars[star]->numplanets) { X*************** X*** 238,248 **** X c=getchr(); X getchr(); X X- if (c=='y') X- Race->God=1; X- else X- Race->God=0; X X X printf("\n\nEnter a name for your race:"); X dots(RNAMESIZE); X--- 239,246 ---- X c=getchr(); X getchr(); X X X+ Race->God = (c=='y'); X X printf("\n\nEnter a name for your race:"); X dots(RNAMESIZE); X*************** X*** 254,259 **** X--- 252,258 ---- X Race->homelevel = Race->deflevel = LEVEL_PLAN; X Race->homesystem = Race->defsystem = star; X Race->homeplanetnum = Race->defplanetnum = pnum; X+ Race->highlight = Playernum; X X /* make conditions preferred by your people set to (more or less) X those of the planet : higher the concentration of gas, the higher X*************** X*** 274,279 **** X--- 273,279 ---- X /* assign racial characteristics */ X X Race->tech = 0; X+ do { X Race->overbirthrate = float_rand() * 0.01; X /* your race is like "the Thing" */ X Race->Thing = Thing[idx]; X*************** X*** 294,299 **** X--- 294,304 ---- X printf(" Mass: %.2f\n",Race->mass); X printf(" Number of sexes: %d (min req'd for colonization)\n",Race->number_sexes); X X+ printf("\n\nLook OK(y/n)\?"); X+ if(gets(str)==NULL) X+ exit(1); X+ } while (str[0] != 'y'); X+ X bzero((char *)secttypes, sizeof(secttypes)); X X opensectdata(&enroll_sectdata); X*************** X*** 369,375 **** X s.build_type = OTYPE_GOV; X s.armor = Shipdata[OTYPE_GOV][ABIL_ARMOR]; X s.guns = Shipdata[OTYPE_GOV][ABIL_GUNS]; X- s.size = Shipdata[OTYPE_GOV][ABIL_TARGET]; X s.max_crew = Shipdata[OTYPE_GOV][ABIL_MAXCREW]; X s.max_destruct = Shipdata[OTYPE_GOV][ABIL_DESTCAP]; X s.max_resource = Shipdata[OTYPE_GOV][ABIL_CARGO]; X--- 374,379 ---- X*************** X*** 376,381 **** X--- 380,388 ---- X s.max_fuel = Shipdata[OTYPE_GOV][ABIL_FUELCAP]; X s.max_speed = Shipdata[OTYPE_GOV][ABIL_SPEED]; X s.build_cost = Shipdata[OTYPE_GOV][ABIL_COST]; X+ s.size = 0.1*s.guns + .1*s.max_crew + .03*s.max_resource + .03*s.max_fuel X+ + .03*s.max_destruct; X+ ; X s.base_mass = MAX(1.0, (float)s.armor + (float)s.size/10.0 + (float)s.guns/10.0); X sprintf(s.class, "Standard"); X X*************** X*** 401,407 **** X s.rad = 0; X s.damage = 0; /*Shipdata[s.type][ABIL_DAMAGE];*/ X /* (first capitol is 100% efficient */ X! X s.object.number = 0; X s.object.number2 = 0; X s.object.number3 = 0; X--- 408,415 ---- X s.rad = 0; X s.damage = 0; /*Shipdata[s.type][ABIL_DAMAGE];*/ X /* (first capitol is 100% efficient */ X! s.retaliate = 0; X! X s.object.number = 0; X s.object.number2 = 0; X s.object.number3 = 0; X*************** X*** 410,416 **** X s.on = 1; X X s.name[0] = '\0'; X! X putship(enroll_shdata, &s, shipno); X close_file(enroll_shdata); X X--- 418,425 ---- X s.on = 1; X X s.name[0] = '\0'; X! s.mission[0] = '\0'; X! X putship(enroll_shdata, &s, shipno); X close_file(enroll_shdata); X X*************** X*** 487,492 **** X--- 496,508 ---- X X void notify(who, msg) X int who; X+ char *msg; X+ { X+ /* this is a dummy routine */ X+ } X+ X+ void push_message(what, who, msg) X+ int what, who; X char *msg; X { X /* this is a dummy routine */ X*** /usr/cna/billr/games/gb3/server/enslave.c Wed May 30 15:13:08 1990 X--- server/enslave.c Thu Aug 23 16:54:54 1990 X*************** X*** 25,30 **** X--- 25,31 ---- X planettype *p; X int sh,shipno,i,mask,aliens=0,def=0,attack=0; X double Dist; X+ racetype *Race; X X enslave_shdata = enslave_pdata = NEUTRAL_FD; X X*************** X*** 39,48 **** X--- 40,51 ---- X X if (s->owner!=Playernum) { X DontOwnErr(Playernum,shipno); X+ free(s); X return; X } X X if (testship(Playernum,s, shipno)) { X+ free(s); X return; X } X X*************** X*** 49,77 **** X if (s->type != STYPE_ASS) { X sprintf(buf,"This ship is not an %s.\n", Shipnames[STYPE_ASS]); X notify(Playernum, buf); X return; X } X if (s->whatorbits!=LEVEL_PLAN) { X sprintf(buf,"%s #%d doesn't orbit a planet.\n", Shipnames[s->type],shipno); X notify(Playernum, buf); X return; X } X X if (!enufAP(Playernum,Stars[s->storbits]->AP[Playernum-1], APcount)) { X! return; X } X X! free(Race); X! openracedata(&enslave_racedata); X! getrace(enslave_racedata, &Race, Playernum); X! close_file(enslave_racedata); X X- openpdata(&enslave_pdata); X- getplanet(enslave_pdata,&p,Stars[s->storbits]->planetpos[s->pnumorbits]); X- close_file(enslave_pdata); X if (p->info[Playernum-1].numsectsowned==0) { X sprintf(buf,"You don't have a garrison on the planet.\n"); X notify(Playernum, buf); X return; X } X X--- 52,82 ---- X if (s->type != STYPE_ASS) { X sprintf(buf,"This ship is not an %s.\n", Shipnames[STYPE_ASS]); X notify(Playernum, buf); X+ free(s); X return; X } X+ X if (s->whatorbits!=LEVEL_PLAN) { X sprintf(buf,"%s #%d doesn't orbit a planet.\n", Shipnames[s->type],shipno); X notify(Playernum, buf); X+ free(s); X return; X } X X if (!enufAP(Playernum,Stars[s->storbits]->AP[Playernum-1], APcount)) { X! free(s); X! return; X } X X! openpdata(&enslave_pdata); X! getplanet(enslave_pdata,&p,Stars[s->storbits]->planetpos[s->pnumorbits]); X! close_file(enslave_pdata); X X if (p->info[Playernum-1].numsectsowned==0) { X sprintf(buf,"You don't have a garrison on the planet.\n"); X notify(Playernum, buf); X+ free(s); X+ free(p); X return; X } X X*************** X*** 86,94 **** X--- 91,105 ---- X if (!aliens) { X sprintf(buf,"There is no one else on this planet to enslave!\n"); X notify(Playernum, buf); X+ free(s); X+ free(p); X return; X } X X+ openracedata(&enslave_racedata); X+ getrace(enslave_racedata, &Race, Playernum); X+ close_file(enslave_racedata); X+ X sh = p->ships; X openshdata(&enslave_shdata); X while (sh) { X*************** X*** 164,171 **** X if (p->info[i-1].numsectsowned && i!=Playernum) X notify(i, telegram_buf); X X! free(p); X! X } X X X--- 175,183 ---- X if (p->info[i-1].numsectsowned && i!=Playernum) X notify(i, telegram_buf); X X! free(p); X! free(s); X! free(Race); X } X X X*** /usr/cna/billr/games/gb3/server/examine.c Wed May 30 15:13:09 1990 X--- server/examine.c Thu Aug 23 16:54:55 1990 X*************** X*** 41,51 **** X--- 41,53 ---- X if (ship->whatorbits==LEVEL_UNIV || isclr(Stars[ship->storbits]->inhabited, Playernum)) { X sprintf(buf,"That ship it not visible to you.\n"); X notify(Playernum, buf); X+ free(ship); X return; X } X X if ((fd=fopen(EXAM_FL, "r"))==NULL) { X perror(EXAM_FL); X+ free(ship); X return; X } X X*** /usr/cna/billr/games/gb3/server/explore.c Wed May 30 15:13:10 1990 X--- server/explore.c Thu Aug 23 16:54:56 1990 X*************** X*** 25,34 **** X int inhab = 0; X int stardata,pdata; X char str[200]; X X Num_races = Numraces(); X X- free(Race); X openracedata(&explore_racedata); X getrace(explore_racedata, &Race, Playernum); X close_file(explore_racedata); X--- 25,34 ---- X int inhab = 0; X int stardata,pdata; X char str[200]; X+ racetype *Race; X X Num_races = Numraces(); X X openracedata(&explore_racedata); X getrace(explore_racedata, &Race, Playernum); X close_file(explore_racedata); X*************** X*** 38,47 **** X openpdata(&pdata); X sprintf(buf," ========== Colonization Report ==========\n\n"); X notify(Playernum, buf); X! sprintf(buf," Planet res des fuel tox sects tech mob Type Aliens\n"); X notify(Playernum, buf); X for (star=0; star<Sdata.numstars; star++) { X! getstar(stardata, &(Stars[star]), star); X if (isset(Stars[star]->explored,Playernum)) { X for (i=0; i<Stars[star]->numplanets; i++) { X getplanet(pdata,&pl,Stars[star]->planetpos[i]); X--- 38,48 ---- X openpdata(&pdata); X sprintf(buf," ========== Colonization Report ==========\n\n"); X notify(Playernum, buf); X! sprintf(buf," Planet xtl res des fuel tox sects tech mob Type Aliens\n"); X notify(Playernum, buf); X for (star=0; star<Sdata.numstars; star++) { X! free(Stars[star]); X! getstar(stardata, &(Stars[star]), star); X if (isset(Stars[star]->explored,Playernum)) { X for (i=0; i<Stars[star]->numplanets; i++) { X getplanet(pdata,&pl,Stars[star]->planetpos[i]); X*************** X*** 54,61 **** X Stars[star]->pnames[i], X (pl->info[Playernum-1].autorep ? "*" : "")); X X! sprintf(buf,"%19s%5d%5d%5d %3d%% %4d %3d %2d(%2d)", X! str,pl->info[Playernum-1].resource, X pl->info[Playernum-1].destruct, X pl->info[Playernum-1].fuel,pl->conditions[TOXIC], X pl->info[Playernum-1].numsectsowned, X--- 55,64 ---- X Stars[star]->pnames[i], X (pl->info[Playernum-1].autorep ? "*" : "")); X X! sprintf(buf,"%16.16s %2d%5d%5d%5d %3d%% %4d %3d %2d(%2d)", X! str, X! pl->info[Playernum-1].crystals, X! pl->info[Playernum-1].resource, X pl->info[Playernum-1].destruct, X pl->info[Playernum-1].fuel,pl->conditions[TOXIC], X pl->info[Playernum-1].numsectsowned, X*************** X*** 92,97 **** X--- 95,101 ---- X } X close_file(stardata); X close_file(pdata); X+ free(Race); X } X X X*************** X*** 105,114 **** X placetype where; X int inhab = 0; X int stardata,pdata; X X Num_races = Numraces(); X X! starq = 0; X X if(argn==2) { X where = Getplace(Playernum,args[1],0); X--- 109,119 ---- X placetype where; X int inhab = 0; X int stardata,pdata; X+ racetype *Race; X X Num_races = Numraces(); X X! starq = -1; X X if(argn==2) { X where = Getplace(Playernum,args[1],0); X*************** X*** 120,126 **** X starq = where.snum; X } X X- free(Race); X openracedata(&explore_racedata); X getrace(explore_racedata, &Race, Playernum); X close_file(explore_racedata); X--- 125,130 ---- X*************** X*** 135,141 **** X sprintf(buf," Star (stability)[AP] # Planet [Attributes] Type (Compatibility)\n"); X notify(Playernum, buf); X for (star=0; star<Sdata.numstars; star++) X! if((starq ==0) || (starq && starq == star)) { X getstar(stardata, &(Stars[star]), star); X if (isset(Stars[star]->explored,Playernum)) { X for (i=0; i<Stars[star]->numplanets; i++) { X--- 139,146 ---- X sprintf(buf," Star (stability)[AP] # Planet [Attributes] Type (Compatibility)\n"); X notify(Playernum, buf); X for (star=0; star<Sdata.numstars; star++) X! if((starq == -1) || (starq == star)) { X! free(Stars[star]); X getstar(stardata, &(Stars[star]), star); X if (isset(Stars[star]->explored,Playernum)) { X for (i=0; i<Stars[star]->numplanets; i++) { X*************** X*** 142,163 **** X getplanet(pdata,&pl,Stars[star]->planetpos[i]); X if (i == 0) X if (Race->tech >= TECH_SEE_STABILITY){ X! sprintf(buf,"\n%13s (%2d)[%2d]",Stars[star]->name,Stars[star]->stability,Stars[star]->AP[Playernum-1]); X notify(Playernum, buf); X } else { X! sprintf(buf,"\n%13s (??)[%2d]",Stars[star]->name,Stars[star]->stability,Stars[star]->AP[Playernum-1]); X notify(Playernum, buf); X! } else { X! sprintf(buf,"\t\t "); X! notify(Playernum, buf); X! } X sprintf(buf," #%d. %-15s [ ",i+1,Stars[star]->pnames[i]); X notify(Playernum, buf); X if (pl->info[Playernum-1].explored) { X! sprintf(buf,"Expl "); X notify(Playernum, buf); X if (pl->info[Playernum-1].autorep) { X! sprintf(buf,"Report "); X notify(Playernum, buf); X } X if (pl->info[Playernum-1].numsectsowned) { X--- 147,169 ---- X getplanet(pdata,&pl,Stars[star]->planetpos[i]); X if (i == 0) X if (Race->tech >= TECH_SEE_STABILITY){ X! sprintf(buf,"\n%13s (%2d)[%2d]\n",Stars[star]->name,Stars[star]->stability,Stars[star]->AP[Playernum-1]); X notify(Playernum, buf); X } else { X! sprintf(buf,"\n%13s (??)[%2d]\n",Stars[star]->name,Stars[star]->stability,Stars[star]->AP[Playernum-1]); X notify(Playernum, buf); X! } X! X! sprintf(buf,"\t\t "); X! notify(Playernum, buf); X! X sprintf(buf," #%d. %-15s [ ",i+1,Stars[star]->pnames[i]); X notify(Playernum, buf); X if (pl->info[Playernum-1].explored) { X! sprintf(buf,"Ex "); X notify(Playernum, buf); X if (pl->info[Playernum-1].autorep) { X! sprintf(buf,"Rep "); X notify(Playernum, buf); X } X if (pl->info[Playernum-1].numsectsowned) { X*************** X*** 197,204 **** X free(pl); X } X } X! } X close_file(stardata); X close_file(pdata); X } X X--- 203,212 ---- X free(pl); X } X } X! } X close_file(stardata); X close_file(pdata); X+ free(Race); X } X+ X X*** /usr/cna/billr/games/gb3/server/files.c Wed May 30 15:13:10 1990 X--- server/files.c Thu Aug 23 16:54:56 1990 X*************** X*** 27,31 **** X DFILE(Tele), X DFILE(Tele/tele), X DFILE(power), X! DFILE(LOCK) X! }; X--- 27,36 ---- X DFILE(Tele), X DFILE(Tele/tele), X DFILE(power), X! DFILE(LOCK), X! DFILE(News), X! DFILE(News/declaration), X! DFILE(News/transfer), X! DFILE(News/combat), X! DFILE(News/announce) X! }; X*** /usr/cna/billr/games/gb3/server/files_rw.c Wed May 30 15:13:11 1990 X--- server/files_rw.c Thu Aug 23 16:54:57 1990 X*************** X*** 65,75 **** X int n2; X int i; X X- Num_races=Numraces(); X- X- X- /* printf(" fd =%d writing %d bytes to %s posn %d.\n",fd,num,file,posn); */ X- X if (lseek(fd, posn, L_SET) < 0) { X char buf[100]; X sprintf(buf,"%s: err %d",file,errno); X--- 65,70 ---- X*** /usr/cna/billr/games/gb3/server/files_shl.c Wed May 30 15:13:13 1990 X--- server/files_shl.c Fri Aug 24 15:14:32 1990 X*************** X*** 37,42 **** X--- 37,43 ---- X #include "ships.h" X #include "races.h" X #include "power.h" X+ #include "buffers.h" X #include <strings.h> X #include <sys/stat.h> X #include <signal.h> X*************** X*** 109,119 **** X } X X X! getrace(fd, r,rnum) X int fd; X racetype **r; X int rnum; X { X *r = (racetype *)malloc(sizeof(racetype)); X Fileread(fd, (char *)*r, sizeof(racetype), RACEDATAFL, X (rnum-1)*sizeof(racetype) ); X--- 110,121 ---- X } X X X! getrace(fd, r, rnum) X int fd; X racetype **r; X int rnum; X { X+ X *r = (racetype *)malloc(sizeof(racetype)); X Fileread(fd, (char *)*r, sizeof(racetype), RACEDATAFL, X (rnum-1)*sizeof(racetype) ); X*************** X*** 295,302 **** X struct stat buf; X X fstat(fd,&buf); X- X- /* printf("numships %d\n",(int)(buf.st_size / sizeof(shiptype)) ); */ X return( (int)(buf.st_size / sizeof(shiptype)) ); X } X X--- 297,302 ---- X*** /usr/cna/billr/games/gb3/server/fix.c Wed May 30 15:13:16 1990 X--- server/fix.c Fri Aug 24 15:15:15 1990 X*************** X*** 29,36 **** X #include <signal.h> X int fix_stardata,fix_shdata,fix_pdata,fix_sectdata, fix_racedata; X char s[40]; X! X! boolean fix_mod; X int Playernum; X X main(argc, argv) X--- 29,37 ---- X #include <signal.h> X int fix_stardata,fix_shdata,fix_pdata,fix_sectdata, fix_racedata; X char s[40]; X! char z; /*nicgj3*/ X! racetype *Race; X! int fix_mod; X int Playernum; X X main(argc, argv) X*************** X*** 45,65 **** X sectortype *sect; X shiptype *sh; X int fix_handler(); X X fix_mod = 0; X fix_stardata = fix_shdata = fix_pdata = fix_sectdata = NEUTRAL_FD; X /* so closure does not cause wanted files to close (like stdin X or stdout) -- should not cause probs most vers. of UNIX */ X- X printf("Enter race number: "); X scanf("%d", &Playernum); X X! openracedata(&fix_racedata); X! free(Race); X! getrace(fix_racedata, &Race, Playernum); X! close_file(fix_racedata); X X! if (!strcmp(argv[1], "race", strlen(argv[1]))) { X query(FLOAT,"tech",&Race->tech,0,0,0,0); X query(FLOAT,"birthrate",&Race->birthrate,0,0,0,0); X query(FLOAT,"mass",&Race->mass,0,0,0,0); X--- 46,80 ---- X sectortype *sect; X shiptype *sh; X int fix_handler(); X+ int numraces; /*nicgj3*/ X X fix_mod = 0; X fix_stardata = fix_shdata = fix_pdata = fix_sectdata = NEUTRAL_FD; X /* so closure does not cause wanted files to close (like stdin X or stdout) -- should not cause probs most vers. of UNIX */ X printf("Enter race number: "); X scanf("%d", &Playernum); X X! openracedata(&fix_racedata); /*nicgj3*/ X! /*free(Race); (freeing a pointer never allocated??) */ X! getrace(fix_racedata, &Race, Playernum); /*nicgj3*/ X! close_file(fix_racedata); /*nicgj3*/ X! numraces=Numraces(); /*nicgj3*/ X X! if(argc < 2) { X! printf("You have to do 'fix <what>'!\n"); X! exit(0); X! } X! X! if ((argc==2) && (!strcmp(argv[1], "race"))) { /*nicgj3*/ X! getchr(); /*nicgj3*/ X! for(i=1;i<=numraces;i++){ /*nicgj3*/ X! if (i!=Playernum) { /*nicgj3*/ X! printf("Player %d ",i); /*nicgj3*/ X! query(CHAR,"Relations",0,0,&Race->translate[i-1],0,0); /*nicgj3*/ X! } X! } X! query(SHORT,"God",0,0,0,&Race->God,0); /*nicgj3*/ X query(FLOAT,"tech",&Race->tech,0,0,0,0); X query(FLOAT,"birthrate",&Race->birthrate,0,0,0,0); X query(FLOAT,"mass",&Race->mass,0,0,0,0); X*************** X*** 90,101 **** X query(CHAR, "Sulfur",0,0,&Race->conditions[SULFUR],0,0); X query(CHAR, "Helium",0,0,&Race->conditions[HELIUM],0,0); X query(CHAR, "Other",0,0,&Race->conditions[OTHER],0,0); X! if (fix_mod){ X printf("saving"); X! putrace(Race);} X } else { X! where = Getplace(Playernum,argv[1],0); /* do not ignore the fact that you've not X! explored the place */ X if (where.err) { X sprintf(buf,"cs: bad scope.\n"); X notify(Playernum, buf); X--- 105,125 ---- X query(CHAR, "Sulfur",0,0,&Race->conditions[SULFUR],0,0); X query(CHAR, "Helium",0,0,&Race->conditions[HELIUM],0,0); X query(CHAR, "Other",0,0,&Race->conditions[OTHER],0,0); X! if (fix_mod!=0){ X printf("saving"); X! openracedata(&fix_racedata); /*nicgj3*/ X! putrace(fix_racedata,Race); /*nicgj3*/ X! close_file(fix_racedata); /*nicgj3*/ X! } X } else { X! openstardata(&fix_stardata); /*nicgj3*/ X! getsdata(fix_stardata, &Sdata); /*nicgj3*/ X! for (z=0; z<Sdata.numstars; z++) { /*nicgj3*/ X! getstar(fix_stardata,&(Stars[z]),z); /*nicgj3*/ X! } /*nicgj3*/ X! close(fix_stardata); /*nicgj3*/ X! X! where = Getplace(Playernum,argv[1],1); X if (where.err) { X sprintf(buf,"cs: bad scope.\n"); X notify(Playernum, buf); X*************** X*** 106,112 **** X case LEVEL_UNIV: X openstardata(&fix_stardata); X getsdata(fix_stardata, &Sdata); X! X query(CHAR, "ActionPoints",0,0,&Sdata.AP[Playernum-1],0,0); X query(SHORT, "shiplist start",0,0,0,&Sdata.ships,0); X /*for (ch=MAXUSHIPS-1; ch>1 && Sdata.shipnums[ch]; ch--) ; X--- 130,136 ---- X case LEVEL_UNIV: X openstardata(&fix_stardata); X getsdata(fix_stardata, &Sdata); X! getchr(); /*nicgj3*/ X query(CHAR, "ActionPoints",0,0,&Sdata.AP[Playernum-1],0,0); X query(SHORT, "shiplist start",0,0,0,&Sdata.ships,0); X /*for (ch=MAXUSHIPS-1; ch>1 && Sdata.shipnums[ch]; ch--) ; X*************** X*** 128,133 **** X--- 152,158 ---- X X printf("Star #%d : %s\n\n", where.snum, Stars[where.snum]->name ); X X+ getchr(); /*nicgj3*/ X query(SHORT, "shiplist start",0,0,0,&Stars[where.snum]->ships,0); X query(CHAR, "ActionPoints",0,0,&Stars[where.snum]->AP[Playernum-1],0,0); X X*************** X*** 146,152 **** X ch = Stars[where.snum]->nova_stage; X query(CHAR, "nova stage",0,0,&ch,0,0); X Stars[where.snum]->nova_stage = ch; X! printf("(limit %d) ",MAXPLANETS); X query(CHAR, "# planets",0,0,&Stars[where.snum]->numplanets,0,0); X for (i=0; i<Stars[where.snum]->numplanets; i++) { X printf("Planet #%d (%s) ", i, Stars[where.snum]->pnames[i]); X--- 171,177 ---- X ch = Stars[where.snum]->nova_stage; X query(CHAR, "nova stage",0,0,&ch,0,0); X Stars[where.snum]->nova_stage = ch; X! printf("(limit %d) ",MAXPLANETS); X query(CHAR, "# planets",0,0,&Stars[where.snum]->numplanets,0,0); X for (i=0; i<Stars[where.snum]->numplanets; i++) { X printf("Planet #%d (%s) ", i, Stars[where.snum]->pnames[i]); X*************** X*** 170,175 **** X--- 195,201 ---- X printf("\nPlanet / %s / %s\n", Stars[where.snum]->name, X Stars[where.snum]->pnames[where.pnum]); X unl = p->info[Playernum-1].resource; X+ getchr(); /*nicgj3*/ X query(LONG, "\nstockpile resources",0,0,0,0,&unl); X p->info[Playernum-1].resource = unl; X unl = p->info[Playernum-1].destruct; X*************** X*** 287,293 **** X query(CHAR, "owner",0,0,&ch,0,0); X sh->owner = ch; X X! unl = sh->type; X query(LONG, "type",0,0,0,0,&unl); X sh->type = unl; X query(FLOAT,"technology",&sh->tech,0,0,0,0); X--- 313,320 ---- X query(CHAR, "owner",0,0,&ch,0,0); X sh->owner = ch; X X! unl = sh->type; X! getchr(); /*nicgj3*/ X query(LONG, "type",0,0,0,0,&unl); X sh->type = unl; X query(FLOAT,"technology",&sh->tech,0,0,0,0); X*************** X*** 297,314 **** X X query(FLOAT,"fuel",&sh->fuel,0,0,0,0); X unl = sh->destruct; X! query(LONG, "destruct cap",0,0,0,0,&unl); X sh->destruct = unl; X unl = sh->resource; X! query(LONG, "resource",0,0,0,0,&unl); X sh->resource = unl; X unl = sh->popn; X query(LONG, "crew",0,0,0,0,&unl); X sh->popn = unl; X X unl = sh->rad; X query(LONG, "irradiated",0,0,0,0,&unl); X sh->rad = unl; X X unl = sh->damage; X query(LONG, "damage",0,0,0,0,&unl); X--- 324,366 ---- X X query(FLOAT,"fuel",&sh->fuel,0,0,0,0); X unl = sh->destruct; X! query(LONG, "destruct",0,0,0,0,&unl); X sh->destruct = unl; X unl = sh->resource; X! query(LONG, "resources",0,0,0,0,&unl); X sh->resource = unl; X unl = sh->popn; X query(LONG, "crew",0,0,0,0,&unl); X sh->popn = unl; X+ unl = sh->crystals; X+ query(LONG, "crystals",0,0,0,0,&unl); X+ sh->crystals = unl; X+ unl = sh->hyper_drive.has; X+ query(LONG, "hyper drive?",0,0,0,0,&unl); X+ sh->hyper_drive.has = unl; X X+ unl = sh->max_destruct; X+ query(LONG, "max destruct",0,0,0,0,&unl); X+ sh->max_destruct = unl; X+ unl = sh->max_fuel; X+ query(LONG, "max fuel",0,0,0,0,&unl); X+ sh->max_fuel = unl; X+ unl = sh->max_resource; X+ query(LONG, "max resources",0,0,0,0,&unl); X+ sh->max_resource = unl; X+ unl = sh->max_crew; X+ query(LONG, "max crew",0,0,0,0,&unl); X+ sh->max_crew = unl; X+ unl = sh->build_cost; X+ query(LONG, "build cost",0,0,0,0,&unl); X+ sh->build_cost = unl; X+ X unl = sh->rad; X query(LONG, "irradiated",0,0,0,0,&unl); X sh->rad = unl; X+ unl = sh->active; X+ query(LONG, "active",0,0,0,0,&unl); X+ sh->active = unl; X X unl = sh->damage; X query(LONG, "damage",0,0,0,0,&unl); X*************** X*** 351,360 **** X query(SHORT, "abil_max crew",0,0,0,&sh->abils[ABIL_MAXCREW],0); X query(SHORT, "abil_armor",0,0,0,&sh->abils[ABIL_ARMOR],0);*/ X X! query(SHORT, "object:number",0,0,0,&sh->object.number,0); X! query(SHORT, "object:number2",0,0,0,&sh->object.number2,0); X! query(SHORT, "object:number3",0,0,0,&sh->object.number3,0); X! query(SHORT, "object:number4",0,0,0,&sh->object.number4,0); X X X if (fix_mod) { X--- 403,412 ---- X query(SHORT, "abil_max crew",0,0,0,&sh->abils[ABIL_MAXCREW],0); X query(SHORT, "abil_armor",0,0,0,&sh->abils[ABIL_ARMOR],0);*/ X X! query(SHORT, "object:number1",0,0,0,&sh->object.number,0); X! query(SHORT, "object:number2",0,0,0,&sh->object.number2,0); X! query(SHORT, "object:number3",0,0,0,&sh->object.number3,0); X! query(SHORT, "object:number4",0,0,0,&sh->object.number4,0); X X X if (fix_mod) { X*************** X*** 365,377 **** X break; X X X } X } X X X- } X- X- X query( kind, quest, fprev, iprev, cprev, sprev, lprev) X int kind; X char *quest; X--- 417,427 ---- X break; X X X+ } X } X } X X X query( kind, quest, fprev, iprev, cprev, sprev, lprev) X int kind; X char *quest; X*************** X*** 441,446 **** X--- 491,504 ---- X printf("%s\n", temp); X } X X+ void push_message(what, who, msg, type) X+ int what, who; X+ char *msg; X+ int type; X+ { X+ /* this is a dummy routine */ X+ } X+ X fix_handler() X { X close_file(fix_stardata); X*************** X*** 448,454 **** X close_file(fix_pdata); X close_file(fix_sectdata); X } X- X- X- X X--- 506,509 ---- X*** /usr/cna/billr/games/gb3/server/getplace.c Wed May 30 15:13:18 1990 X--- server/getplace.c Thu Aug 23 16:55:04 1990 X*************** X*** 29,42 **** X boolean error; X int getplace_shdata; X placetype where; /* return value */ X! X Bzero(where); X X! free(Race); X openracedata(&getplace_racedata); X getrace(getplace_racedata, &Race, Playernum); X close_file(getplace_racedata); X! X where.err = 0; X X switch (*string) { X--- 29,46 ---- X boolean error; X int getplace_shdata; X placetype where; /* return value */ X! racetype *Race; X! int God; X! X Bzero(where); X X! X openracedata(&getplace_racedata); X getrace(getplace_racedata, &Race, Playernum); X close_file(getplace_racedata); X! God = Race->God; X! free(Race); X! X where.err = 0; X X switch (*string) { X*************** X*** 44,50 **** X where.level=LEVEL_UNIV; /* scope = root (universe) */ X where.snum=0; X where.pnum= where.shipno=0; X! return(Getplace2(Playernum, string+1,&where,ignoreexpl,Race->God)); X case '#': X sscanf(++string,"%hd",&where.shipno); X openshdata(&getplace_shdata); X--- 48,54 ---- X where.level=LEVEL_UNIV; /* scope = root (universe) */ X where.snum=0; X where.pnum= where.shipno=0; X! return(Getplace2(Playernum, string+1,&where,ignoreexpl,God)); X case '#': X sscanf(++string,"%hd",&where.shipno); X openshdata(&getplace_shdata); X*************** X*** 55,62 **** X return where; X } X close_file(getplace_shdata); X! if ( (where.shipptr->owner==Playernum || ignoreexpl || Race->God) X! && (where.shipptr->is_alive || Race->God)) { X /* if (!where.shipptr->is_alive) X printf("Ship is dead.\n"); */ X where.level = LEVEL_SHIP; X--- 59,67 ---- X return where; X } X close_file(getplace_shdata); X! if ( (where.shipptr->owner==Playernum || ignoreexpl X! || God) X! && (where.shipptr->is_alive || God)) { X /* if (!where.shipptr->is_alive) X printf("Ship is dead.\n"); */ X where.level = LEVEL_SHIP; X*************** X*** 65,79 **** X /* where.shipno already taken care of */ X while (isdigit(*string)) X string++; X! if (*string=='/') X! return Getplace2(Playernum, string+1,&where, ignoreexpl,Race->God); X! else X! return where; X! } else { X where.err = 1; X if (where.shipptr->is_alive) X DontOwnErr(Playernum,where.shipno); X- X return where; X } X X--- 70,84 ---- X /* where.shipno already taken care of */ X while (isdigit(*string)) X string++; X! if (*string=='/') { X! return Getplace2(Playernum, string+1,&where, ignoreexpl,God); X! } else { X! return where; X! } X! } else { X where.err = 1; X if (where.shipptr->is_alive) X DontOwnErr(Playernum,where.shipno); X return where; X } X X*************** X*** 80,86 **** X case '-': X /* no destination */ X where.level = LEVEL_UNIV; X! return where; X X default: X /* copy current scope to scope */ X--- 85,91 ---- X case '-': X /* no destination */ X where.level = LEVEL_UNIV; X! return where; X X default: X /* copy current scope to scope */ X*************** X*** 93,104 **** X getship(getplace_shdata,&(where.shipptr),where.shipno); X close_file(getplace_shdata); X } X! if (*string==CHAR_CURR_SCOPE) X! return where; X! else X! return Getplace2(Playernum, string,&where, ignoreexpl,Race->God); X! } X! X } X X X--- 98,109 ---- X getship(getplace_shdata,&(where.shipptr),where.shipno); X close_file(getplace_shdata); X } X! if (*string==CHAR_CURR_SCOPE) { X! return where; X! } else { X! return Getplace2(Playernum, string,&where, ignoreexpl,God); X! } X! } X } X X X*************** X*** 117,124 **** X int shdata,tick; X int getplace2_pdata; X X- /* printf("getplace2:looking for '%s'\n",string); */ X- X if (where->err || *string=='\0' || *string=='\n') X return(*where); /* base cases */ X X--- 122,127 ---- X*************** X*** 139,147 **** X } X } else { X /* is a char string, name of something */ X! /*printf("before scanf str=`%s`\n",string);*/ X! sscanf(string,"%[^/ \n]",substr); X! /*printf("after scanf sub=`%s`\n",substr);*/ X X do { X /*if (isupper(*string) ) X--- 142,148 ---- X } X } else { X /* is a char string, name of something */ X! sscanf(string,"%[^/ \n]",substr); X X do { X /*if (isupper(*string) ) X*************** X*** 155,161 **** X if (!strncmp(substr,Stars[i]->name,l)) { X where->level=LEVEL_STAR; X where->snum = i; X! if (ignoreexpl || isset(Stars[where->snum]->explored, Playernum) || God) { X tick = (*string=='/'); X return(Getplace2(Playernum, string+tick, where, ignoreexpl, God)); X } X--- 156,163 ---- X if (!strncmp(substr,Stars[i]->name,l)) { X where->level=LEVEL_STAR; X where->snum = i; X! if (ignoreexpl || X! isset(Stars[where->snum]->explored, Playernum) || God) { X tick = (*string=='/'); X return(Getplace2(Playernum, string+tick, where, ignoreexpl, God)); X } X*************** X*** 196,202 **** X where->err=1; X return(*where); X } X! } else if (where->level==LEVEL_PLAN) { X sprintf(buf,"Can't descend to %s.\n",substr); X notify(Playernum, buf); X where->err=1; X--- 198,204 ---- X where->err=1; X return(*where); X } X! } else { X sprintf(buf,"Can't descend to %s.\n",substr); X notify(Playernum, buf); X where->err=1; X*************** X*** 256,262 **** X notify(Playernum, buf); X r = 1; X } X! if (!s->popn && Max_crew(s)) { X sprintf(buf,"%s #%d %s has no crew and is not a robotic ship.\n", X Shipnames[s->type], n, s->name ); X notify(Playernum, buf); X--- 258,264 ---- X notify(Playernum, buf); X r = 1; X } X! if (!s->popn && s->max_crew) { X sprintf(buf,"%s #%d %s has no crew and is not a robotic ship.\n", X Shipnames[s->type], n, s->name ); X notify(Playernum, buf); X*** /usr/cna/billr/games/gb3/server/makeplanet.c Wed May 30 15:13:26 1990 X--- server/makeplanet.c Thu Aug 23 16:55:10 1990 X*************** X*** 334,339 **** X--- 334,349 ---- X X } X X+ /* make crystal deposits */ X+ for (y=0; y<planet.Maxy; y++) X+ for (x=0; x<planet.Maxx; x++) { X+ s = &Sector(planet,x,y); X+ if(!int_rand(0, 200)) X+ s->crystals=int_rand(1,5); X+ else X+ s->crystals = 0; X+ } X+ X return planet; X X } X*** /usr/cna/billr/games/gb3/server/orbit.c Wed May 30 15:13:38 1990 X--- server/orbit.c Thu Aug 23 16:55:20 1990 X*************** X*** 27,32 **** X--- 27,33 ---- X float Lastx, Lasty, Zoom; X int SCALE = 100; X int orbit_racedata; X+ racetype *Race; X X orbit(Playernum, APcount, argn, args) X int Playernum; X*************** X*** 47,57 **** X X DontDispPlanets = DontDispShips = DontDispStars = 0; X X- free(Race); X- openracedata(&orbit_racedata); X- getrace(orbit_racedata, &Race, Playernum); X- close_file(orbit_racedata); X- X /* find options, set flags accordingly */ X for (flag=1; flag<=argn-1; flag++) X if (*args[flag]=='-') { X--- 48,53 ---- X*************** X*** 93,98 **** X--- 89,98 ---- X /* orbit type of map */ X sprintf(output, "#"); X X+ openracedata(&orbit_racedata); X+ getrace(orbit_racedata, &Race, Playernum); X+ close_file(orbit_racedata); X+ X switch (where.level) { X case LEVEL_UNIV: X for (i=0; i<Sdata.numstars; i++) X*************** X*** 123,130 **** X str_cat(output, buf); X X openpdata(&orbit_pdata); X- X- X for (i=0; i<Stars[where.snum]->numplanets; i++) X if (DontDispNum!=i) { X getplanet(orbit_pdata,&p,Stars[where.snum]->planetpos[i]); X--- 123,128 ---- X*************** X*** 133,140 **** X str_cat(output, buf); X free(p); X } X! X! close_file(orbit_pdata); X X /* check to see if you have ships at orbiting the star, if so you can X see enemy ships */ X--- 131,137 ---- X str_cat(output, buf); X free(p); X } X! close_file(orbit_pdata); X X /* check to see if you have ships at orbiting the star, if so you can X see enemy ships */ X*************** X*** 143,149 **** X openshdata(&orbit_shdata); X while (sh && !iq) { X (void)getship(orbit_shdata, &s, sh); X! if(s->owner == Playernum && Shipdata[s->type][ABIL_SIGHT]) X iq = 1; /* you are there to sight, need a crew */ X sh = s->nextship; X free(s); X--- 140,146 ---- X openshdata(&orbit_shdata); X while (sh && !iq) { X (void)getship(orbit_shdata, &s, sh); X! if(s->owner == Playernum && Sight(s)) X iq = 1; /* you are there to sight, need a crew */ X sh = s->nextship; X free(s); X*************** X*** 188,194 **** X openshdata(&orbit_shdata); X while (sh && !iq) { X (void)getship(orbit_shdata, &s, sh); X! if(s->owner == Playernum && Shipdata[s->type][ABIL_SIGHT]) X iq = 1; /* you are there to sight, need a crew */ X sh = s->nextship; X free(s); X--- 185,191 ---- X openshdata(&orbit_shdata); X while (sh && !iq) { X (void)getship(orbit_shdata, &s, sh); X! if(s->owner == Playernum && Sight(s)) X iq = 1; /* you are there to sight, need a crew */ X sh = s->nextship; X free(s); X*************** X*** 220,229 **** X X default: X notify(Playernum,"Bad scope.\n"); X! return; X } X X notify(Playernum, output); X } X X X--- 217,229 ---- X X default: X notify(Playernum,"Bad scope.\n"); X! free(Race); X! return; X! break; X } X X notify(Playernum, output); X+ free(Race); X } X X X*************** X*** 285,291 **** X /* check to see if the any planets are populated here. If so, X standout() the name of it */ X X! sprintf(temp, "%d %s ;",isset(star->inhabited, Playernum), star->name); X str_cat(string, temp); X } X } X--- 285,291 ---- X /* check to see if the any planets are populated here. If so, X standout() the name of it */ X X! sprintf(temp, "%d %s ;",!!isset(star->inhabited, Playernum), star->name); X str_cat(string, temp); X } X } X*************** X*** 436,445 **** X X /* (magnification) */ X if (x>=0 && y>=0) { X! if(ship->owner==Playernum)stand=1; X else stand = 0; X X sprintf(string, "%d %d %d %d %c %d %d;",stand,x,y,wm,Shipltrs[ship->type],stand,shipno); X } X break; X X--- 436,451 ---- X X /* (magnification) */ X if (x>=0 && y>=0) { X! X! if(Race->color) { X! sprintf(string, "%c %d %d %d %c %c %d;",(char)(ship->owner+48),x,y,wm, X! Shipltrs[ship->type],(char)(ship->owner+48),shipno); X! } else { X! if(ship->owner==Race->highlight)stand=1; X else stand = 0; X X sprintf(string, "%d %d %d %d %c %d %d;",stand,x,y,wm,Shipltrs[ship->type],stand,shipno); X+ } X } X break; X X*************** X*** 459,469 **** X xa = int_rand(x - (int)fac, x + (int)fac); X ya = int_rand(y - (int)fac, y + (int)fac); X if (xa>=0 && ya>=0) { X! if(ship->owner==Playernum)stand=1; X else stand = 0; X sprintf(temp, "%d %d %d %d %c %d %d;",stand,xa,ya,wm,Shipltrs[ship->type], X stand,shipno); X! X str_cat(string, temp); X } X } X--- 465,480 ---- X xa = int_rand(x - (int)fac, x + (int)fac); X ya = int_rand(y - (int)fac, y + (int)fac); X if (xa>=0 && ya>=0) { X! X! if(Race->color) { X! sprintf(temp, "%c %d %d %d %c %c %d;",(char)(ship->owner+48),xa,ya,wm, X! Shipltrs[ship->type], (char)(ship->owner+48),shipno); X! } else { X! if(ship->owner==Race->highlight)stand=1; X else stand = 0; X sprintf(temp, "%d %d %d %d %c %d %d;",stand,xa,ya,wm,Shipltrs[ship->type], X stand,shipno); X! } X str_cat(string, temp); X } X } X*************** X*** 476,485 **** X wm=0; X if (ship->whatorbits!=LEVEL_UNIV || (ship->owner == Playernum || God)) X if (x>=0 && y>=0) { X! if(ship->owner==Playernum)stand=1; X else stand = 0; X sprintf(string, "%d %d %d %d %c %d %d;",stand,x,y,wm,Shipltrs[ship->type],stand,shipno); X! X } X break; X } X--- 487,501 ---- X wm=0; X if (ship->whatorbits!=LEVEL_UNIV || (ship->owner == Playernum || God)) X if (x>=0 && y>=0) { X! X! if(Race->color) { X! sprintf(string, "%c %d %d %d %c %c %d;",(char)(ship->owner+48),x,y,wm, X! Shipltrs[ship->type],(char)(ship->owner+48),shipno); X! } else { X! if(ship->owner==Race->highlight)stand=1; X else stand = 0; X sprintf(string, "%d %d %d %d %c %d %d;",stand,x,y,wm,Shipltrs[ship->type],stand,shipno); X! } X } X break; X } X*** /usr/cna/billr/games/gb3/server/order.c Wed May 30 15:13:40 1990 X--- server/order.c Thu Aug 23 16:55:22 1990 X*************** X*** 115,121 **** X Stars[Dir[Playernum-1].snum]->planetpos[Dir[Playernum-1].pnum]); X close_file(pdata); X shipno = p->ships; X! break; X case LEVEL_STAR: X shipno = Stars[Dir[Playernum-1].snum]->ships; X break; X--- 115,122 ---- X Stars[Dir[Playernum-1].snum]->planetpos[Dir[Playernum-1].pnum]); X close_file(pdata); X shipno = p->ships; X! free(p); X! break; X case LEVEL_STAR: X shipno = Stars[Dir[Playernum-1].snum]->ships; X break; X*************** X*** 204,210 **** X i=strlen(args[2]); X X if (!strncmp(args[2],"defense",i)) { X! if (can_bombard(ship) || ship->type == OTYPE_GR) { X if(!strncmp(args[3],"off", strlen(args[3]))) { X ship->protect.planet = 0; X notify(Playernum, "Planetary defense canceled.\n"); X--- 205,211 ---- X i=strlen(args[2]); X X if (!strncmp(args[2],"defense",i)) { X! if (can_bombard(ship)) { X if(!strncmp(args[3],"off", strlen(args[3]))) { X ship->protect.planet = 0; X notify(Playernum, "Planetary defense canceled.\n"); X*************** X*** 218,224 **** X return; X } X } else if (!strncmp(args[2],"jump",i)) { X! if(Shipdata[ship->type][ABIL_JUMP]) { X if(!strncmp(args[3],"off", strlen(args[3]))) { X ship->hyper_drive.on = 0; X notify(Playernum, "Hyper drive turned off.\n"); X--- 219,225 ---- X return; X } X } else if (!strncmp(args[2],"jump",i)) { X! if(ship->hyper_drive.has) { X if(!strncmp(args[3],"off", strlen(args[3]))) { X ship->hyper_drive.on = 0; X notify(Playernum, "Hyper drive turned off.\n"); X*************** X*** 230,235 **** X--- 231,242 ---- X } X ship->hyper_drive.on = 1; X ship->navigate.on = 0; X+ X+ if(ship->hyper_drive.mounted) { X+ ship->hyper_drive.charge = 1; X+ ship->hyper_drive.ready = 1; X+ } X+ X notify(Playernum, "Hyper drive engine's activated.\n"); X /* estimate how much fuel it will cost for this ship to get there */ X } X*************** X*** 241,247 **** X X } else if (!strncmp(args[2],"protect",i)) { X X! sscanf(args[3]+(args[3][0]=='#'),"%d",&j); X X if(j < 0 || j > n_ships || j==shipno) { X notify(Playernum, "You can't protect that!\n"); X--- 248,257 ---- X X } else if (!strncmp(args[2],"protect",i)) { X X! if(argn>3) X! sscanf(args[3]+(args[3][0]=='#'),"%d",&j); X! else X! j = 0; X X if(j < 0 || j > n_ships || j==shipno) { X notify(Playernum, "You can't protect that!\n"); X*************** X*** 248,254 **** X free(ship); X return; X } X! if (can_bombard(ship) || ship->type==OTYPE_GR) { X if(!j) { X ship->protect.on = 0; X notify(Playernum, "Protection orders halted.\n"); X--- 258,264 ---- X free(ship); X return; X } X! if (can_bombard(ship)) { X if(!j) { X ship->protect.on = 0; X notify(Playernum, "Protection orders halted.\n"); X*************** X*** 324,329 **** X--- 334,347 ---- X ship->destshipno = where.shipno; X ship->whatdest = LEVEL_SHIP; X } else { X+ /* to foil cheaters */ X+ if(((ship->storbits != where.snum) && where.level != LEVEL_STAR) X+ && isclr(Stars[where.snum]->explored, ship->owner)){ X+ notify(Playernum, "You haven't explored this system.\n"); X+ free(ship); X+ return; X+ } X+ X ship->whatdest = where.level; X ship->deststar = where.snum; X ship->destpnum = where.pnum; X*************** X*** 375,381 **** X } X } else if (!strncmp(args[2],"retaliate",i)) { X if (ship->type!=OTYPE_OMCL) { X! if (can_bombard(ship) || ship->type==OTYPE_GR) { X if(!strncmp(args[3],"off",strlen(args[3]))) { X ship->protect.self = 0; X notify(Playernum, "Retaliation option turned off.\n"); X--- 393,399 ---- X } X } else if (!strncmp(args[2],"retaliate",i)) { X if (ship->type!=OTYPE_OMCL) { X! if (can_bombard(ship)) { X if(!strncmp(args[3],"off",strlen(args[3]))) { X ship->protect.self = 0; X notify(Playernum, "Retaliation option turned off.\n"); X*************** X*** 388,393 **** X--- 406,430 ---- X notify(Playernum, "This type of ship cannot be set to retaliate.\n"); X } X } X+ } else if (!strncmp(args[2],"laser",i)) { X+ if(ship->laser) { X+ if (can_bombard(ship)) { X+ if(ship->hyper_drive.mounted) { X+ if(!strncmp(args[3],"on",strlen(args[3]))) { X+ ship->fire_laser = atoi(args[4]); X+ sprintf(buf, "Combat lasers activated to attack with strength %d\n", X+ ship->fire_laser); X+ notify(Playernum, buf); X+ } else { X+ ship->fire_laser = 0; X+ notify(Playernum, "Combat lasers deactivated.\n"); X+ } X+ } else X+ notify(Playernum, "You do not have a crystal mounted.\n"); X+ } else X+ notify(Playernum, "This type of ship cannot be set to retaliate.\n"); X+ } else X+ notify(Playernum, "This ship is not equipped with combat lasers.\n"); X } else if (!strncmp(args[2],"speed",i)) { X if (speed_rating(ship)) { X j = atoi(args[3]); X*************** X*** 408,431 **** X return; X } X X! } else if(!strncmp(args[2], "explosive", i)) { X! if(ship->type==STYPE_MINE) { X! ship->mine.mode = 1; X! notify(Playernum, "This mine is set for explosive mode.\n"); X } else { X! notify(Playernum, "This ship cannot be set for this.\n"); X free(ship); X return; X } X } else if(!strncmp(args[2], "radiative", i)) { X! if(ship->type==STYPE_MINE) { X! ship->mine.mode = 0; X! notify(Playernum, "This mine is set for radiation mode.\n"); X! } else { X! notify(Playernum, "This ship cannot be set for this.\n"); X! free(ship); X! return; X! } X } else if(!strncmp(args[2], "move", i)) { X if (ship->type==OTYPE_TERRA) { X ship->object.number = atoi(args[3]); X--- 445,500 ---- X return; X } X X! } else if(!strncmp(args[2], "salvo", i)) { X! if (can_bombard(ship)) { X! j = atoi(args[3]); X! if(j < 0) { X! notify(Playernum, "Specify a positive number of guns.\n"); X! free(ship); X! return; X! } else { X! if(j > ship->guns) j = ship->guns; X! ship->retaliate = j; X! sprintf(buf, "Retaliation strength set at %d.\n", j); X! notify(Playernum, buf); X! } X! X } else { X! notify(Playernum, "This ship cannot be set to retaliate.\n"); X free(ship); X return; X } X+ X+ } else if(!strncmp(args[2], "explosive", i)) { X+ switch(ship->type) { X+ case STYPE_MINE: X+ ship->mode = 1; X+ notify(Playernum, "This mine is set for explosive mode.\n"); X+ break; X+ case OTYPE_GR: X+ ship->mode = 1; X+ notify(Playernum, "Will inflict structural damage.\n"); X+ break; X+ default: X+ notify(Playernum, "This ship cannot be set for this.\n"); X+ free(ship); X+ return; X+ } X } else if(!strncmp(args[2], "radiative", i)) { X! switch(ship->type) { X! case STYPE_MINE: X! ship->mode = 0; X! notify(Playernum, "This mine is set for radiative mode.\n"); X! break; X! case OTYPE_GR: X! ship->mode = 0; X! notify(Playernum, "Will inflict radiation damage.\n"); X! break; X! default: X! notify(Playernum, "This ship cannot be set for this.\n"); X! free(ship); X! return; X! } X } else if(!strncmp(args[2], "move", i)) { X if (ship->type==OTYPE_TERRA) { X ship->object.number = atoi(args[3]); X*************** X*** 534,540 **** X close_file(order_pdata); X X if(planet->info[Playernum-1].resource < 2*ship->build_cost) { X! sprintf(buf, "You don't have %s resources on the planet to activate this factory.\n", X 2*ship->build_cost); X notify(Playernum, buf); X free(ship); X--- 603,609 ---- X close_file(order_pdata); X X if(planet->info[Playernum-1].resource < 2*ship->build_cost) { X! sprintf(buf, "You don't have %d resources on the planet to activate this factory.\n", X 2*ship->build_cost); X notify(Playernum, buf); X free(ship); X*************** X*** 655,661 **** X close_file(sdata); /* don't need to care about Stars */ X sprintf(buf, "Surveyed, distance %g.\n",dist); X notify(Playernum, buf); X! } else { X sprintf(buf, "Too far to see (%g, max %g).\n", X dist, tele_range(s->type, s->tech) ); X notify(Playernum, buf); X--- 724,731 ---- X close_file(sdata); /* don't need to care about Stars */ X sprintf(buf, "Surveyed, distance %g.\n",dist); X notify(Playernum, buf); X! free(str); X! } else { X sprintf(buf, "Too far to see (%g, max %g).\n", X dist, tele_range(s->type, s->tech) ); X notify(Playernum, buf); X*************** X*** 672,679 **** X p->info[Playernum-1].explored = 1; X openpdata(&pdata); X putplanet(pdata, p, str->planetpos[s->aimed_at.pnum]); X! close_file(pdata); X! free(p); X sprintf(buf, "Surveyed, distance %g.\n", dist); X notify(Playernum, buf); X } else { X--- 742,748 ---- X p->info[Playernum-1].explored = 1; X openpdata(&pdata); X putplanet(pdata, p, str->planetpos[s->aimed_at.pnum]); X! close_file(pdata); X sprintf(buf, "Surveyed, distance %g.\n", dist); X notify(Playernum, buf); X } else { X*************** X*** 681,686 **** X--- 750,756 ---- X dist, tele_range(s->type, s->tech) ); X notify(Playernum, buf); X } X+ free(p); X break; X case LEVEL_SHIP: X sprintf(buf, "You can't see anything of use there.\n"); X*************** X*** 692,698 **** X DispOrdersHeader(Playernum) X int Playernum; X { X! notify(Playernum, " name destination orbits spd options\n"); X } X X DispOrders(Playernum, sh, next, check) X--- 762,768 ---- X DispOrdersHeader(Playernum) X int Playernum; X { X! notify(Playernum, " name orbits destination spd options\n"); X } X X DispOrders(Playernum, sh, next, check) X*************** X*** 703,708 **** X--- 773,779 ---- X { X int order_shdata, in_list; X shiptype *ship; X+ float distfac; X char temp[128]; X X openshdata(&order_shdata); X*************** X*** 732,739 **** X } X } X X! sprintf(buf, "%4d %c %14s %15s %15s %1d ", sh, Shipltrs[ship->type], ship->name, X! prin_ship_dest(Playernum, ship), prin_ship_orbits(ship), ship->speed); X X if(ship->hyper_drive.on) { X sprintf(temp, "/jump %s %d", (ship->hyper_drive.ready ? "ready" : "charging"), X--- 803,810 ---- X } X } X X! sprintf(buf, "%4d %c %14.14s %15.15s %15.15s %1d ", sh, Shipltrs[ship->type], ship->name, X! prin_ship_orbits(ship), prin_ship_dest(Playernum, ship), ship->speed); X X if(ship->hyper_drive.on) { X sprintf(temp, "/jump %s %d", (ship->hyper_drive.ready ? "ready" : "charging"), X*************** X*** 740,746 **** X ship->hyper_drive.charge); X strcat(buf, temp); X } X! if(ship->protect.self) strcat(buf, "/retal"); X if(ship->protect.planet) strcat(buf, "/defense"); X if(ship->protect.on) { X sprintf(temp, "/prot %d", ship->protect.ship); X--- 811,830 ---- X ship->hyper_drive.charge); X strcat(buf, temp); X } X! if(ship->protect.self) { X! sprintf(temp, "/retal"); X! strcat(buf, temp); X! } X! X! if(ship->fire_laser) { X! sprintf(temp, "/laser %d", ship->fire_laser); X! strcat(buf, temp); X! } X! X! if(ship->retaliate) { X! sprintf(temp, "/salvo %d", ship->retaliate); X! strcat(buf, temp); X! } X if(ship->protect.planet) strcat(buf, "/defense"); X if(ship->protect.on) { X sprintf(temp, "/prot %d", ship->protect.ship); X*************** X*** 756,763 **** X } X if(ship->protect.evade) strcat(buf, "/evade"); X if(ship->bombard) strcat(buf, "/bomb"); X! if(ship->type==STYPE_MINE) { X! if(ship->mine.mode) strcat(buf, "/explode"); X else strcat(buf, "/radiate"); X } X if(ship->type==OTYPE_TERRA) { X--- 840,847 ---- X } X if(ship->protect.evade) strcat(buf, "/evade"); X if(ship->bombard) strcat(buf, "/bomb"); X! if(ship->type==STYPE_MINE || ship->type==OTYPE_GR) { X! if(ship->mode) strcat(buf, "/explode"); X else strcat(buf, "/radiate"); X } X if(ship->type==OTYPE_TERRA) { X*************** X*** 781,793 **** X notify(Playernum, buf); X /* if hyper space is on estimate how much fuel it will cost to get to the destination */ X if(ship->hyper_drive.on) { X! double dist, fuse; X X dist = sqrt( Distsq(ship->xpos, ship->ypos, Stars[ship->deststar]->xpos, X Stars[ship->deststar]->ypos)); X! fuse = HYPER_DRIVE_FUEL_USE * ship->mass X! * (dist/HYPER_DIST_FACTOR) * (dist/HYPER_DIST_FACTOR); X! sprintf(buf, " *** jump will cost %.1ff ***\n", fuse); X notify(Playernum, buf); X if(ship->max_fuel < fuse) X notify(Playernum, "Your ship cannot carry enough fuel to do this jump.\n"); X--- 865,884 ---- X notify(Playernum, buf); X /* if hyper space is on estimate how much fuel it will cost to get to the destination */ X if(ship->hyper_drive.on) { X! float dist, fuse; X X dist = sqrt( Distsq(ship->xpos, ship->ypos, Stars[ship->deststar]->xpos, X Stars[ship->deststar]->ypos)); X! distfac = HYPER_DIST_FACTOR * (ship->tech + 100.0); X! if(ship->hyper_drive.mounted && dist > distfac) { X! fuse = HYPER_DRIVE_FUEL_USE * sqrt(ship->mass) X! * (dist/distfac); X! } else { X! fuse = HYPER_DRIVE_FUEL_USE * sqrt(ship->mass) X! * (dist/distfac) * (dist/distfac); X! } X! X! sprintf(buf, " *** distance %.0f - jump will cost %.1ff ***\n", dist, fuse); X notify(Playernum, buf); X if(ship->max_fuel < fuse) X notify(Playernum, "Your ship cannot carry enough fuel to do this jump.\n"); END_OF_FILE if test 56321 -ne `wc -c <'patches02b'`; then echo shar: \"'patches02b'\" unpacked with wrong size! fi # end of 'patches02b' if test -f 'server/patchlevel.h' -a "${1}" != "-c" ; then echo shar: Renaming existing file \"'server/patchlevel.h'\" to \"'server/patchlevel.h.orig'\" mv -f 'server/patchlevel.h' 'server/patchlevel.h.orig' fi echo shar: Extracting \"'server/patchlevel.h'\" \(21 characters\) sed "s/^X//" >'server/patchlevel.h' <<'END_OF_FILE' X#define PATCHLEVEL 2 END_OF_FILE if test 21 -ne `wc -c <'server/patchlevel.h'`; then echo shar: \"'server/patchlevel.h'\" unpacked with wrong size! fi # end of 'server/patchlevel.h' echo shar: End of archive 2 \(of 9\). cp /dev/null ark2isdone MISSING="" for I in 1 2 3 4 5 6 7 8 9 ; do if test ! -f ark${I}isdone ; then MISSING="${MISSING} ${I}" fi done if test "${MISSING}" = "" ; then echo You have unpacked all 9 archives. rm -f ark[1-9]isdone ark[1-9][0-9]isdone else echo You still need to unpack the following archives: echo " " ${MISSING} fi ## End of shell archive. exit 0