From: Eric S. Raymond Date: Sun, 31 Oct 2004 20:05:04 +0000 (+0000) Subject: Next step towards structure merge. X-Git-Tag: 2.0~456 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=e1d80424873d901a732bf81c3a7ecc564636375e;p=super-star-trek.git Next step towards structure merge. Change state variables to names that will be easy to replace. --- diff --git a/ai.c b/ai.c index 8f4bb98..e34eabc 100644 --- a/ai.c +++ b/ai.c @@ -6,14 +6,14 @@ static int tryexit(int lookx, int looky, int ienm, int loccom, int irun) { iqx = quadx+(lookx+9)/10 - 1; iqy = quady+(looky+9)/10 - 1; if (iqx < 1 || iqx > 8 || iqy < 1 || iqy > 8 || - d.galaxy[iqx][iqy] > 899) + state.galaxy[iqx][iqy] > 899) return 0; /* no can do -- neg energy, supernovae, or >8 Klingons */ if (ienm == IHR) return 0; /* Romulans cannot escape! */ if (irun == 0) { /* avoid intruding on another commander's territory */ if (ienm == IHC) { - for (l = 1; l <= d.remcom; l++) - if (d.cx[l]==iqx && d.cy[l]==iqy) return 0; + for (l = 1; l <= state.remcom; l++) + if (state.cx[l]==iqx && state.cy[l]==iqy) return 0; /* refuse to leave if currently attacking starbase */ if (batx==quadx && baty==quady) return 0; } @@ -40,23 +40,23 @@ static int tryexit(int lookx, int looky, int ienm, int loccom, int irun) { nenhere--; if (condit != IHDOCKED) newcnd(); /* Handle global matters related to escape */ - d.galaxy[quadx][quady] -= 100; - d.galaxy[iqx][iqy] += 100; + state.galaxy[quadx][quady] -= 100; + state.galaxy[iqx][iqy] += 100; if (ienm==IHS) { ishere=0; iscate=0; ientesc=0; isatb=0; - future[FSCMOVE]=0.2777+d.date; + future[FSCMOVE]=0.2777+state.date; future[FSCDBAS]=1e30; - d.isx=iqx; - d.isy=iqy; + state.isx=iqx; + state.isy=iqy; } else { - for (l=1; l<=d.remcom; l++) { - if (d.cx[l]==quadx && d.cy[l]==quady) { - d.cx[l]=iqx; - d.cy[l]=iqy; + for (l=1; l<=state.remcom; l++) { + if (state.cx[l]==quadx && state.cy[l]==quady) { + state.cx[l]=iqx; + state.cy[l]=iqy; break; } } @@ -311,18 +311,18 @@ static int checkdest(int iqx, int iqy, int flag, int *ipage) { if ((iqx==quadx && iqy==quady) || iqx < 1 || iqx > 8 || iqy < 1 || iqy > 8 || - d.galaxy[iqx][iqy] > 899) return 1; + state.galaxy[iqx][iqy] > 899) return 1; if (flag) { /* Avoid quadrants with bases if we want to avoid Enterprise */ - for (i = 1; i <= d.rembase; i++) - if (d.baseqx[i]==iqx && d.baseqy[i]==iqy) return 1; + for (i = 1; i <= state.rembase; i++) + if (state.baseqx[i]==iqx && state.baseqy[i]==iqy) return 1; } /* do the move */ - d.galaxy[d.isx][d.isy] -= 100; - d.isx = iqx; - d.isy = iqy; - d.galaxy[d.isx][d.isy] += 100; + state.galaxy[state.isx][state.isy] -= 100; + state.isx = iqx; + state.isy = iqy; + state.galaxy[state.isx][state.isy] += 100; if (iscate) { /* SC has scooted, Remove him from current quadrant */ iscate=0; @@ -345,17 +345,17 @@ static int checkdest(int iqx, int iqy, int flag, int *ipage) { } /* check for a helpful planet */ for (i = 1; i <= inplan; i++) { - if (d.plnets[i].x==d.isx && d.plnets[i].y==d.isy && - d.plnets[i].crystals == 1) { + if (state.plnets[i].x==state.isx && state.plnets[i].y==state.isy && + state.plnets[i].crystals == 1) { /* destroy the planet */ - d.plnets[i] = nulplanet; - d.newstuf[d.isx][d.isy] -= 1; + state.plnets[i] = nulplanet; + state.newstuf[state.isx][state.isy] -= 1; if (damage[DRADIO] == 0.0 || condit == IHDOCKED) { if (*ipage==0) pause(1); *ipage = 1; prout("Lt. Uhura- \"Captain, Starfleet Intelligence reports"); proutn(" a planet in"); - cramlc(1, d.isx, d.isy); + cramlc(1, state.isx, state.isy); prout(" has been destroyed"); prout(" by the Super-commander.\""); } @@ -380,39 +380,39 @@ void scom(int *ipage) { #endif /* Decide on being active or passive */ - flag = ((d.killc+d.killk)/(d.date+0.01-indate) < 0.1*skill*(skill+1.0) || - (d.date-indate) < 3.0); + flag = ((state.killc+state.killk)/(state.date+0.01-indate) < 0.1*skill*(skill+1.0) || + (state.date-indate) < 3.0); if (iscate==0 && flag) { /* compute move away from Enterprise */ - ideltax = d.isx-quadx; - ideltay = d.isy-quady; + ideltax = state.isx-quadx; + ideltay = state.isy-quady; if (sqrt(ideltax*(double)ideltax+ideltay*(double)ideltay) > 2.0) { /* circulate in space */ - ideltax = d.isy-quady; - ideltay = quadx-d.isx; + ideltax = state.isy-quady; + ideltay = quadx-state.isx; } } else { /* compute distances to starbases */ - if (d.rembase <= 0) { + if (state.rembase <= 0) { /* nothing left to do */ future[FSCMOVE] = 1e30; return; } - sx = d.isx; - sy = d.isy; - for (i = 1; i <= d.rembase; i++) { + sx = state.isx; + sy = state.isy; + for (i = 1; i <= state.rembase; i++) { basetbl[i] = i; - ibqx = d.baseqx[i]; - ibqy = d.baseqy[i]; + ibqx = state.baseqx[i]; + ibqy = state.baseqy[i]; bdist[i] = sqrt(square(ibqx-sx) + square(ibqy-sy)); } - if (d.rembase > 1) { + if (state.rembase > 1) { /* sort into nearest first order */ int iswitch; do { iswitch = 0; - for (i=1; i < d.rembase-1; i++) { + for (i=1; i < state.rembase-1; i++) { if (bdist[i] > bdist[i+1]) { int ti = basetbl[i]; double t = bdist[i]; @@ -429,34 +429,34 @@ void scom(int *ipage) { without too many Klingons, and not already under attack. */ ifindit = iwhichb = 0; - for (i2 = 1; i2 <= d.rembase; i2++) { + for (i2 = 1; i2 <= state.rembase; i2++) { i = basetbl[i2]; /* bug in original had it not finding nearest*/ - ibqx = d.baseqx[i]; - ibqy = d.baseqy[i]; + ibqx = state.baseqx[i]; + ibqy = state.baseqy[i]; if ((ibqx == quadx && ibqy == quady) || (ibqx == batx && ibqy == baty) || - d.galaxy[ibqx][ibqy] > 899) continue; + state.galaxy[ibqx][ibqy] > 899) continue; /* if there is a commander, an no other base is appropriate, we will take the one with the commander */ - for (j = 1; j <= d.remcom; j++) { - if (ibqx==d.cx[j] && ibqy==d.cy[j] && ifindit!= 2) { + for (j = 1; j <= state.remcom; j++) { + if (ibqx==state.cx[j] && ibqy==state.cy[j] && ifindit!= 2) { ifindit = 2; iwhichb = i; break; } } - if (j > d.remcom) { /* no commander -- use this one */ + if (j > state.remcom) { /* no commander -- use this one */ ifindit = 1; iwhichb = i; break; } } if (ifindit==0) return; /* Nothing suitable -- wait until next time*/ - ibqx = d.baseqx[iwhichb]; - ibqy = d.baseqy[iwhichb]; + ibqx = state.baseqx[iwhichb]; + ibqy = state.baseqy[iwhichb]; /* decide how to move toward base */ - ideltax = ibqx - d.isx; - ideltay = ibqy - d.isy; + ideltax = ibqx - state.isx; + ideltay = ibqy - state.isy; } /* Maximum movement is 1 quadrant in either or both axis */ if (ideltax > 1) ideltax = 1; @@ -465,58 +465,58 @@ void scom(int *ipage) { if (ideltay < -1) ideltay = -1; /* try moving in both x and y directions */ - iqx = d.isx + ideltax; - iqy = d.isy + ideltax; + iqx = state.isx + ideltax; + iqy = state.isy + ideltax; if (checkdest(iqx, iqy, flag, ipage)) { /* failed -- try some other maneuvers */ if (ideltax==0 || ideltay==0) { /* attempt angle move */ if (ideltax != 0) { - iqy = d.isy + 1; + iqy = state.isy + 1; if (checkdest(iqx, iqy, flag, ipage)) { - iqy = d.isy - 1; + iqy = state.isy - 1; checkdest(iqx, iqy, flag, ipage); } } else { - iqx = d.isx + 1; + iqx = state.isx + 1; if (checkdest(iqx, iqy, flag, ipage)) { - iqx = d.isx - 1; + iqx = state.isx - 1; checkdest(iqx, iqy, flag, ipage); } } } else { /* try moving just in x or y */ - iqy = d.isy; + iqy = state.isy; if (checkdest(iqx, iqy, flag, ipage)) { - iqy = d.isy + ideltay; - iqx = d.isx; + iqy = state.isy + ideltay; + iqx = state.isx; checkdest(iqx, iqy, flag, ipage); } } } /* check for a base */ - if (d.rembase == 0) { + if (state.rembase == 0) { future[FSCMOVE] = 1e30; } - else for (i=1; i<=d.rembase; i++) { - ibqx = d.baseqx[i]; - ibqy = d.baseqy[i]; - if (ibqx==d.isx && ibqy == d.isy && d.isx != batx && d.isy != baty) { + else for (i=1; i<=state.rembase; i++) { + ibqx = state.baseqx[i]; + ibqy = state.baseqy[i]; + if (ibqx==state.isx && ibqy == state.isy && state.isx != batx && state.isy != baty) { /* attack the base */ if (flag) return; /* no, don't attack base! */ iseenit = 0; isatb=1; - future[FSCDBAS] = d.date + 1.0 +2.0*Rand(); - if (batx != 0) future[FSCDBAS] += future[FCDBAS]-d.date; + future[FSCDBAS] = state.date + 1.0 +2.0*Rand(); + if (batx != 0) future[FSCDBAS] += future[FCDBAS]-state.date; if (damage[DRADIO] > 0 && condit != IHDOCKED) return; /* no warning */ iseenit = 1; if (*ipage == 0) pause(1); *ipage=1; proutn("Lt. Uhura- \"Captain, the starbase in"); - cramlc(1, d.isx, d.isy); + cramlc(1, state.isx, state.isy); skip(1); prout(" reports that it is under attack from the Klingon Super-commander."); proutn(" It can survive until stardate "); @@ -537,13 +537,13 @@ void scom(int *ipage) { #endif (Rand() > 0.2 || (damage[DRADIO] > 0.0 && condit != IHDOCKED) || - starch[d.isx][d.isy] > 0)) + starch[state.isx][state.isy] > 0)) return; if (*ipage==0) pause(1); *ipage = 1; prout("Lt. Uhura- \"Captain, Starfleet Intelligence reports"); proutn(" the Super-commander is in"); - cramlc(1, d.isx, d.isy); + cramlc(1, state.isx, state. isy); prout(".\""); return; } diff --git a/battle.c b/battle.c index 9a83fba..184bc7c 100644 --- a/battle.c +++ b/battle.c @@ -163,7 +163,7 @@ void ram(int ibumpd, int ienm, int ix, int iy) { damage[l] += Time + extradm; /* Damage for at least time of travel! */ } shldup = 0; - if (d.remkl) { + if (state.remkl) { pause(2); dreprt(); } @@ -292,26 +292,26 @@ void torpedo(double course, double r, int inx, int iny, double *hit) { case IHB: /* Hit a base */ prout("***STARBASE DESTROYED.."); if (starch[quadx][quady] < 0) starch[quadx][quady] = 0; - for (ll=1; ll<=d.rembase; ll++) { - if (d.baseqx[ll]==quadx && d.baseqy[ll]==quady) { - d.baseqx[ll]=d.baseqx[d.rembase]; - d.baseqy[ll]=d.baseqy[d.rembase]; + for (ll=1; ll<=state.rembase; ll++) { + if (state.baseqx[ll]==quadx && state.baseqy[ll]==quady) { + state.baseqx[ll]=state.baseqx[state.rembase]; + state.baseqy[ll]=state.baseqy[state.rembase]; break; } } quad[ix][iy]=IHDOT; - d.rembase--; + state.rembase--; basex=basey=0; - d.galaxy[quadx][quady] -= 10; - d.basekl++; + state.galaxy[quadx][quady] -= 10; + state.basekl++; newcnd(); return; case IHP: /* Hit a planet */ crmena(1, iquad, 2, ix, iy); prout(" destroyed."); - d.nplankl++; - d.newstuf[quadx][quady] -= 1; - d.plnets[iplnet] = nulplanet; + state.nplankl++; + state.newstuf[quadx][quady] -= 1; + state.plnets[iplnet] = nulplanet; iplnet = 0; plnetx = plnety = 0; quad[ix][iy] = IHDOT; @@ -495,8 +495,8 @@ void attack(int k) { r = (Rand()+Rand())*0.5 -0.5; r += 0.002*kpower[l]*r; torpedo(course, r, jx, jy, &hit); - if (d.remkl==0) finish(FWON); /* Klingons did themselves in! */ - if (d.galaxy[quadx][quady] == 1000 || + if (state.remkl==0) finish(FWON); /* Klingons did themselves in! */ + if (state.galaxy[quadx][quady] == 1000 || alldone) return; /* Supernova or finished */ if (hit == 0) continue; } @@ -590,10 +590,10 @@ void deadkl(int ix, int iy, int type, int ixx, int iyy) { /* Decide what kind of enemy it is and update approriately */ if (type == IHR) { /* chalk up a Romulan */ - d.newstuf[quadx][quady] -= 10; + state.newstuf[quadx][quady] -= 10; irhere--; - d.nromkl++; - d.nromrem--; + state.nromkl++; + state.nromrem--; } else if (type == IHT) { /* Killed a Tholian */ @@ -601,41 +601,41 @@ void deadkl(int ix, int iy, int type, int ixx, int iyy) { } else { /* Some type of a Klingon */ - d.galaxy[quadx][quady] -= 100; + state.galaxy[quadx][quady] -= 100; klhere--; - d.remkl--; + state.remkl--; switch (type) { case IHC: comhere = 0; - for (i=1; i<=d.remcom; i++) - if (d.cx[i]==quadx && d.cy[i]==quady) break; - d.cx[i] = d.cx[d.remcom]; - d.cy[i] = d.cy[d.remcom]; - d.cx[d.remcom] = 0; - d.cy[d.remcom] = 0; - d.remcom--; + for (i=1; i<=state.remcom; i++) + if (state.cx[i]==quadx && state.cy[i]==quady) break; + state.cx[i] = state.cx[state.remcom]; + state.cy[i] = state.cy[state.remcom]; + state.cx[state.remcom] = 0; + state.cy[state.remcom] = 0; + state.remcom--; future[FTBEAM] = 1e30; - if (d.remcom != 0) - future[FTBEAM] = d.date + expran(1.0*incom/d.remcom); - d.killc++; + if (state.remcom != 0) + future[FTBEAM] = state.date + expran(1.0*incom/state.remcom); + state.killc++; break; case IHK: - d.killk++; + state.killk++; break; case IHS: - d.nscrem = ishere = d.isx = d.isy = isatb = iscate = 0; - d.nsckill = 1; + state.nscrem = ishere = state.isx = state.isy = isatb = iscate = 0; + state.nsckill = 1; future[FSCMOVE] = future[FSCDBAS] = 1e30; break; } } /* For each kind of enemy, finish message to player */ - prout(" destroyed."); + prout(" destroyestate."); quad[ix][iy] = IHDOT; - if (d.remkl==0) return; + if (state.remkl==0) return; - d.remtime = d.remres/(d.remkl + 4*d.remcom); + state.remtime = state.remres/(state.remkl + 4*state.remcom); if (type == IHT) return; @@ -814,9 +814,9 @@ void photon(void) { proutn("Torpedo track- "); } torpedo(course[i], r, sectx, secty, &dummy); - if (alldone || d.galaxy[quadx][quady]==1000) return; + if (alldone || state.galaxy[quadx][quady]==1000) return; } - if (d.remkl==0) finish(FWON); + if (state.remkl==0) finish(FWON); } @@ -1195,7 +1195,7 @@ void hittem(double *hits) { skip(1); if (kpow == 0) { deadkl(ii, jj, ienm, ii, jj); - if (d.remkl==0) finish(FWON); + if (state.remkl==0) finish(FWON); if (alldone) return; kk--; /* don't do the increment */ } diff --git a/events.c b/events.c index 84ce49b..098c4a2 100644 --- a/events.c +++ b/events.c @@ -4,7 +4,7 @@ void events(void) { int ictbeam=0, ipage=0, istract=0, line, i, j, k, l, ixhold, iyhold; - double fintim = d.date + Time, datemin, xtime, repair, yank; + double fintim = state.date + Time, datemin, xtime, repair, yank; #ifdef DEBUG @@ -13,10 +13,10 @@ void events(void) { if (stdamtim == 1e30 && damage[DRADIO] != 0.0) { /* chart will no longer be updated because radio is dead */ - stdamtim = d.date; + stdamtim = state.date; for (i=1; i <= 8 ; i++) for (j=1; j <= 8; j++) - if (starch[i][j] == 1) starch[i][j] = d.galaxy[i][j]+1000; + if (starch[i][j] == 1) starch[i][j] = state.galaxy[i][j]+1000; } for (;;) { @@ -29,12 +29,12 @@ void events(void) { line = l; datemin = future[l]; } - xtime = datemin-d.date; - d.date = datemin; + xtime = datemin-state.date; + state.date = datemin; /* Decrement Federation resources and recompute remaining time */ - d.remres -= (d.remkl+4*d.remcom)*xtime; - d.remtime = d.remres/(d.remkl+4*d.remcom); - if (d.remtime <=0) { + state.remres -= (state.remkl+4*state.remcom)*xtime; + state.remtime = state.remres/(state.remkl+4*state.remcom); + if (state.remtime <=0) { finish(FDEPLETE); return; } @@ -78,11 +78,11 @@ void events(void) { if (ipage==0) pause(1); ipage=1; snova(0,0); - future[FSNOVA] = d.date + expran(0.5*intime); - if (d.galaxy[quadx][quady] == 1000) return; + future[FSNOVA] = state.date + expran(0.5*intime); + if (state.galaxy[quadx][quady] == 1000) return; break; case FSPY: /* Check with spy to see if S.C. should tractor beam */ - if (d.nscrem == 0 || + if (state.nscrem == 0 || ictbeam+istract > 0 || condit==IHDOCKED || isatb==1 || iscate==1) return; if (ientesc || @@ -93,22 +93,22 @@ void events(void) { (torps < 5 || damage[DPHOTON] > 0))) { /* Tractor-beam her! */ istract=1; - yank = square(d.isx-quadx) + square(d.isy-quady); + yank = square(state.isx-quadx) + square(state.isy-quady); /*********TBEAM CODE***********/ } else return; case FTBEAM: /* Tractor beam */ if (line==FTBEAM) { - if (d.remcom == 0) { + if (state.remcom == 0) { future[FTBEAM] = 1e30; break; } - i = Rand()*d.remcom+1.0; - yank = square(d.cx[i]-quadx) + square(d.cy[i]-quady); + i = Rand()*state.remcom+1.0; + yank = square(state.cx[i]-quadx) + square(state.cy[i]-quady); if (istract || condit == IHDOCKED || yank == 0) { /* Drats! Have to reschedule */ - future[FTBEAM] = d.date + Time + - expran(1.5*intime/d.remcom); + future[FTBEAM] = state.date + Time + + expran(1.5*intime/state.remcom); break; } } @@ -143,12 +143,12 @@ void events(void) { } } if (line==0) { - quadx = d.isx; - quady = d.isy; + quadx = state.isx; + quady = state.isy; } else { - quadx = d.cx[i]; - quady = d.cy[i]; + quadx = state.cx[i]; + quady = state.cy[i]; } iran10(§x, §y); crmshp(); @@ -158,7 +158,7 @@ void events(void) { cramlc(2, sectx, secty); skip(1); if (resting) { - prout("(Remainder of rest/repair period cancelled.)"); + prout("(Remainder of rest/repair period cancellestate.)"); resting = 0; } if (shldup==0) { @@ -170,44 +170,44 @@ void events(void) { } newqad(0); /* Adjust finish time to time of tractor beaming */ - fintim = d.date+Time; - if (d.remcom <= 0) future[FTBEAM] = 1e30; - else future[FTBEAM] = d.date+Time+expran(1.5*intime/d.remcom); + fintim = state.date+Time; + if (state.remcom <= 0) future[FTBEAM] = 1e30; + else future[FTBEAM] = state.date+Time+expran(1.5*intime/state.remcom); break; case FSNAP: /* Snapshot of the universe (for time warp) */ - snapsht = d; - d.snap = 1; - future[FSNAP] = d.date + expran(0.5 * intime); + snapsht = state; + state.snap = 1; + future[FSNAP] = state.date + expran(0.5 * intime); break; case FBATTAK: /* Commander attacks starbase */ - if (d.remcom==0 || d.rembase==0) { + if (state.remcom==0 || state.rembase==0) { /* no can do */ future[FBATTAK] = future[FCDBAS] = 1e30; break; } i = 0; - for (j=1; j<=d.rembase; j++) { - for (k=1; k<=d.remcom; k++) - if (d.baseqx[j]==d.cx[k] && d.baseqy[j]==d.cy[k] && - (d.baseqx[j]!=quadx || d.baseqy[j]!=quady) && - (d.baseqx[j]!=d.isx || d.baseqy[j]!=d.isy)) { + for (j=1; j<=state.rembase; j++) { + for (k=1; k<=state.remcom; k++) + if (state.baseqx[j]==state.cx[k] && state.baseqy[j]==state.cy[k] && + (state.baseqx[j]!=quadx || state.baseqy[j]!=quady) && + (state.baseqx[j]!=state.isx || state.baseqy[j]!=state.isy)) { i = 1; break; } if (i == 1) break; } - if (j>d.rembase) { + if (j>state.rembase) { /* no match found -- try later */ - future[FBATTAK] = d.date + expran(0.3*intime); + future[FBATTAK] = state.date + expran(0.3*intime); future[FCDBAS] = 1e30; break; } /* commander + starbase combination found -- launch attack */ - batx = d.baseqx[j]; - baty = d.baseqy[j]; - future[FCDBAS] = d.date+1.0+3.0*Rand(); + batx = state.baseqx[j]; + baty = state.baseqy[j]; + future[FCDBAS] = state.date+1.0+3.0*Rand(); if (isatb) /* extra time if SC already attacking */ - future[FCDBAS] += future[FSCDBAS]-d.date; + future[FCDBAS] += future[FSCDBAS]-state.date; future[FBATTAK] = future[FCDBAS] +expran(0.3*intime); iseenit = 0; if (damage[DRADIO] != 0.0 && @@ -236,19 +236,19 @@ void events(void) { case FSCDBAS: /* Supercommander destroys base */ future[FSCDBAS] = 1e30; isatb = 2; - if (d.galaxy[d.isx][d.isy]%100 < 10) break; /* WAS RETURN! */ + if (state.galaxy[state.isx][state.isy]%100 < 10) break; /* WAS RETURN! */ ixhold = batx; iyhold = baty; - batx = d.isx; - baty = d.isy; + batx = state.isx; + baty = state.isy; case FCDBAS: /* Commander succeeds in destroying base */ if (line==FCDBAS) { future[FCDBAS] = 1e30; /* find the lucky pair */ - for (i = 1; i <= d.remcom; i++) - if (d.cx[i]==batx && d.cy[i]==baty) break; - if (i > d.remcom || d.rembase == 0 || - d.galaxy[batx][baty] % 100 < 10) { + for (i = 1; i <= state.remcom; i++) + if (state.cx[i]==batx && state.cy[i]==baty) break; + if (i > state.remcom || state.rembase == 0 || + state.galaxy[batx][baty] % 100 < 10) { /* No action to take after all */ batx = baty = 0; break; @@ -264,9 +264,9 @@ void events(void) { basex=basey=0; newcnd(); skip(1); - prout("Spock- \"Captain, I believe the starbase has been destroyed.\""); + prout("Spock- \"Captain, I believe the starbase has been destroyestate.\""); } - else if (d.rembase != 1 && + else if (state.rembase != 1 && (damage[DRADIO] <= 0.0 || condit == IHDOCKED)) { /* Get word via subspace radio */ if (ipage==0) pause(1); @@ -280,13 +280,13 @@ void events(void) { else prout("a Klingon Commander"); } /* Remove Starbase from galaxy */ - d.galaxy[batx][baty] -= 10; - for (i=1; i <= d.rembase; i++) - if (d.baseqx[i]==batx && d.baseqy[i]==baty) { - d.baseqx[i]=d.baseqx[d.rembase]; - d.baseqy[i]=d.baseqy[d.rembase]; + state.galaxy[batx][baty] -= 10; + for (i=1; i <= state.rembase; i++) + if (state.baseqx[i]==batx && state.baseqy[i]==baty) { + state.baseqx[i]=state.baseqx[state.rembase]; + state.baseqy[i]=state.baseqy[state.rembase]; } - d.rembase--; + state.rembase--; if (isatb == 2) { /* reinstate a commander's base attack */ batx = ixhold; @@ -298,13 +298,13 @@ void events(void) { } break; case FSCMOVE: /* Supercommander moves */ - future[FSCMOVE] = d.date+0.2777; + future[FSCMOVE] = state.date+0.2777; if (ientesc+istract==0 && isatb!=1 && (iscate!=1 || justin==1)) scom(&ipage); break; case FDSPROB: /* Move deep space probe */ - future[FDSPROB] = d.date + 0.01; + future[FDSPROB] = state.date + 0.01; probex += probeinx; probey += probeiny; i = (int)(probex/10 +0.05); @@ -313,7 +313,7 @@ void events(void) { probecx = i; probecy = j; if (i < 1 || i > 8 || j < 1 || j > 8 || - d.galaxy[probecx][probecy] == 1000) { + state.galaxy[probecx][probecy] == 1000) { // Left galaxy or ran into supernova if (damage[DRADIO]==0.0 || condit == IHDOCKED) { if (ipage==0) pause(1); @@ -342,14 +342,14 @@ void events(void) { radio. */ if (damage[DRADIO] == 0.0 || condit == IHDOCKED) starch[probecx][probecy] = damage[DRADIO] > 0.0 ? - d.galaxy[probecx][probecy]+1000 : 1; + state.galaxy[probecx][probecy]+1000 : 1; proben--; // One less to travel if (proben == 0 && isarmed && - d.galaxy[probecx][probecy] % 10 > 0) { + state.galaxy[probecx][probecy] % 10 > 0) { /* lets blow the sucker! */ snova(1,0); future[FDSPROB] = 1e30; - if (d.galaxy[quadx][quady] == 1000) return; + if (state.galaxy[quadx][quady] == 1000) return; } break; } @@ -374,7 +374,7 @@ void wait(void) { } origTime = delay = aaitem; if (delay <= 0.0) return; - if (delay >= d.remtime || nenhere != 0) { + if (delay >= state.remtime || nenhere != 0) { prout("Are you sure? "); if (ja() == 0) return; } @@ -385,7 +385,7 @@ void wait(void) { do { if (delay <= 0) resting = 0; if (resting == 0) { - cramf(d.remtime, 0, 2); + cramf(state.remtime, 0, 2); prout(" stardates left."); return; } @@ -406,7 +406,7 @@ void wait(void) { /* Repair Deathray if long rest at starbase */ if (origTime-delay >= 9.99 && condit == IHDOCKED) damage[DDRAY] = 0.0; - } while (d.galaxy[quadx][quady] != 1000); // leave if quadrant supernovas + } while (state.galaxy[quadx][quady] != 1000); // leave if quadrant supernovas resting = 0; Time = 0; @@ -427,8 +427,8 @@ void nova(int ix, int iy) { quad[ix][iy] = IHDOT; crmena(1, IHSTAR, 2, ix, iy); prout(" novas."); - d.galaxy[quadx][quady] -= 1; - d.starkl++; + state.galaxy[quadx][quady] -= 1; + state.starkl++; /* Set up stack to recursively trigger adjacent stars */ bot = top = top2 = 1; @@ -462,18 +462,18 @@ void nova(int ix, int iy) { top2++; hits[top2][1]=ii; hits[top2][2]=jj; - d.galaxy[quadx][quady] -= 1; - d.starkl++; + state.galaxy[quadx][quady] -= 1; + state.starkl++; crmena(1, IHSTAR, 2, ii, jj); prout(" novas."); quad[ii][jj] = IHDOT; break; case IHP: /* Destroy planet */ - d.newstuf[quadx][quady] -= 1; - d.nplankl++; + state.newstuf[quadx][quady] -= 1; + state.nplankl++; crmena(1, IHP, 2, ii, jj); prout(" destroyed."); - d.plnets[iplnet] = nulplanet; + state.plnets[iplnet] = nulplanet; iplnet = plnetx = plnety = 0; if (landed == 1) { finish(FPNOVA); @@ -482,14 +482,14 @@ void nova(int ix, int iy) { quad[ii][jj] = IHDOT; break; case IHB: /* Destroy base */ - d.galaxy[quadx][quady] -= 10; - for (i = 1; i <= d.rembase; i++) - if (d.baseqx[i]==quadx && d.baseqy[i]==quady) break; - d.baseqx[i] = d.baseqx[d.rembase]; - d.baseqy[i] = d.baseqy[d.rembase]; - d.rembase--; + state.galaxy[quadx][quady] -= 10; + for (i = 1; i <= state.rembase; i++) + if (state.baseqx[i]==quadx && state.baseqy[i]==quady) break; + state.baseqx[i] = state.baseqx[state.rembase]; + state.baseqy[i] = state.baseqy[state.rembase]; + state.rembase--; basex = basey = 0; - d.basekl++; + state.basekl++; newcnd(); crmena(1, IHB, 2, ii, jj); prout(" destroyed."); @@ -610,14 +610,14 @@ void snova(int insx, int insy) { left of universe */ for (nqx = 1; nqx<=8; nqx++) { for (nqy = 1; nqy<=8; nqy++) { - stars += d.galaxy[nqx][nqy] % 10; + stars += state.galaxy[nqx][nqy] % 10; } } if (stars == 0) return; /* nothing to supernova exists */ num = Rand()*stars + 1; for (nqx = 1; nqx<=8; nqx++) { for (nqy = 1; nqy<=8; nqy++) { - num -= d.galaxy[nqx][nqy] % 10; + num -= state.galaxy[nqx][nqy] % 10; if (num <= 0) break; } if (num <=0) break; @@ -638,7 +638,7 @@ void snova(int insx, int insy) { if (damage[DRADIO] == 0.0 || condit == IHDOCKED) { skip(1); proutn("Message from Starfleet Command Stardate "); - cramf(d.date, 0, 1); + cramf(state.date, 0, 1); skip(1); proutn(" Supernova in"); cramlc(1, nqx, nqy); @@ -648,7 +648,7 @@ void snova(int insx, int insy) { else { /* we are in the quadrant! */ insipient = 1; - num = Rand()* (d.galaxy[nqx][nqy]%10) + 1; + num = Rand()* (state.galaxy[nqx][nqy]%10) + 1; for (nsx=1; nsx < 10; nsx++) { for (nsy=1; nsy < 10; nsy++) { if (quad[nsx][nsy]==IHSTAR) { @@ -682,75 +682,75 @@ void snova(int insx, int insy) { } } /* destroy any Klingons in supernovaed quadrant */ - num=d.galaxy[nqx][nqy]; + num=state.galaxy[nqx][nqy]; kldead = num/100; comdead = iscdead = 0; - if (nqx==d.isx && nqy == d.isy) { + if (nqx==state.isx && nqy == state.isy) { /* did in the Supercommander! */ - d.nscrem = d.isx = d.isy = isatb = iscate = 0; + state.nscrem = state.isx = state.isy = isatb = iscate = 0; iscdead = 1; future[FSCMOVE] = future[FSCDBAS] = 1e30; } - d.remkl -= kldead; - if (d.remcom) { - int maxloop = d.remcom, l; + state.remkl -= kldead; + if (state.remcom) { + int maxloop = state.remcom, l; for (l = 1; l <= maxloop; l++) { - if (d.cx[l] == nqx && d.cy[l] == nqy) { - d.cx[l] = d.cx[d.remcom]; - d.cy[l] = d.cy[d.remcom]; - d.cx[d.remcom] = d.cy[d.remcom] = 0; - d.remcom--; + if (state.cx[l] == nqx && state.cy[l] == nqy) { + state.cx[l] = state.cx[state.remcom]; + state.cy[l] = state.cy[state.remcom]; + state.cx[state.remcom] = state.cy[state.remcom] = 0; + state.remcom--; kldead--; comdead++; - if (d.remcom==0) future[FTBEAM] = 1e30; + if (state.remcom==0) future[FTBEAM] = 1e30; break; } } } /* destroy Romulans and planets in supernovaed quadrant */ - num = d.newstuf[nqx][nqy]; - d.newstuf[nqx][nqy] = 0; + num = state.newstuf[nqx][nqy]; + state.newstuf[nqx][nqy] = 0; nrmdead = num/10; - d.nromrem -= nrmdead; + state.nromrem -= nrmdead; npdead = num - nrmdead*10; if (npdead) { int l; for (l = 1; l <= inplan; l++) - if (d.plnets[l].x == nqx && d.plnets[l].y == nqy) { - d.plnets[l] = nulplanet; + if (state.plnets[l].x == nqx && state.plnets[l].y == nqy) { + state.plnets[l] = nulplanet; } } /* Destroy any base in supernovaed quadrant */ - if (d.rembase) { - int maxloop = d.rembase, l; + if (state.rembase) { + int maxloop = state.rembase, l; for (l = 1; l <= maxloop; l++) - if (d.baseqx[l]==nqx && d.baseqy[l]==nqy) { - d.baseqx[l] = d.baseqx[d.rembase]; - d.baseqy[l] = d.baseqy[d.rembase]; - d.baseqx[d.rembase] = d.baseqy[d.rembase] = 0; - d.rembase--; + if (state.baseqx[l]==nqx && state.baseqy[l]==nqy) { + state.baseqx[l] = state.baseqx[state.rembase]; + state.baseqy[l] = state.baseqy[state.rembase]; + state.baseqx[state.rembase] = state.baseqy[state.rembase] = 0; + state.rembase--; break; } } /* If starship caused supernova, tally up destruction */ if (insx) { - num = d.galaxy[nqx][nqy] % 100; - d.starkl += num % 10; - d.basekl += num/10; - d.killk += kldead; - d.killc += comdead; - d.nromkl += nrmdead; - d.nplankl += npdead; - d.nsckill += iscdead; + num = state.galaxy[nqx][nqy] % 100; + state.starkl += num % 10; + state.basekl += num/10; + state.killk += kldead; + state.killc += comdead; + state.nromkl += nrmdead; + state.nplankl += npdead; + state.nsckill += iscdead; } /* mark supernova in galaxy and in star chart */ if ((quadx == nqx && quady == nqy) || damage[DRADIO] == 0 || condit == IHDOCKED) starch[nqx][nqy] = 1; - d.galaxy[nqx][nqy] = 1000; + state.galaxy[nqx][nqy] = 1000; /* If supernova destroys last klingons give special message */ - if (d.remkl==0 && (nqx != quadx || nqy != quady)) { + if (state.remkl==0 && (nqx != quadx || nqy != quady)) { skip(2); if (insx == 0) prout("Lucky you!"); proutn("A supernova in"); diff --git a/finish.c b/finish.c index 1d58840..c9d6aa4 100644 --- a/finish.c +++ b/finish.c @@ -68,26 +68,26 @@ void finish(FINTYPE ifin) { int igotit = 0; alldone = 1; skip(3); - printf("It is stardate %.1f .\n\n", d.date); + printf("It is stardate %.1f .\n\n", state.date); switch (ifin) { case FWON: // Game has been won - if (d.nromrem != 0) + if (state.nromrem != 0) printf("The remaining %d Romulans surrender to Starfleet Command.\n", - d.nromrem); + state.nromrem); prout("You have smashed the Klingon invasion fleet and saved"); prout("the Federation."); gamewon=1; if (alive) { double badpt; - badpt = 5.*d.starkl + casual + 10.*d.nplankl + - 45.*nhelp+100.*d.basekl; + badpt = 5.*state.starkl + casual + 10.*state.nplankl + + 45.*nhelp+100.*state.basekl; if (ship == IHF) badpt += 100.0; else if (ship == 0) badpt += 200.0; if (badpt < 100.0) badpt = 0.0; // Close enough! - if (d.date-indate < 5.0 || + if (state.date-indate < 5.0 || // killsPerDate >= RateMax - (d.killk+d.killc+d.nsckill)/(d.date-indate) >= + (state.killk+state.killc+state.nsckill)/(state.date-indate) >= 0.1*skill*(skill+1.0) + 0.1 + 0.008*badpt) { skip(1); prout("In fact, you have done so well that Starfleet Command"); @@ -105,7 +105,7 @@ void finish(FINTYPE ifin) { prout("promotes you to Commodore Emeritus."); skip(1); prout("Now that you think you're really good, try playing"); - prout("the \"Emeritus\" game. It will splatter your ego."); + prout("the \"Emeritus\" frozen. It will splatter your ego."); break; case 5: skip(1); @@ -150,7 +150,7 @@ void finish(FINTYPE ifin) { prout("conquered. Your starship is now Klingon property,"); prout("and you are put on trial as a war criminal. On the"); proutn("basis of your record, you are "); - if (d.remkl*3.0 > inkling) { + if (state.remkl*3.0 > inkling) { prout("aquitted."); skip(1); prout("LIVE LONG AND PROSPER."); @@ -275,9 +275,9 @@ void finish(FINTYPE ifin) { if (ship==IHF) ship= 0; else if (ship == IHE) ship = IHF; alive = 0; - if (d.remkl != 0) { - double goodies = d.remres/inresor; - double baddies = (d.remkl + 2.0*d.remcom)/(inkling+2.0*incom); + if (state.remkl != 0) { + double goodies = state.remres/inresor; + double baddies = (state.remkl + 2.0*state.remcom)/(inkling+2.0*incom); if (goodies/baddies >= 1.0+0.5*Rand()) { prout("As a result of your actions, a treaty with the Klingon"); prout("Empire has been signed. The terms of the treaty are"); @@ -303,54 +303,54 @@ void finish(FINTYPE ifin) { } void score(void) { - double timused = d.date - indate; + double timused = state.date - indate; int ithperd, iwon, klship; pause(0); iskill = skill; - if ((timused == 0 || d.remkl != 0) && timused < 5.0) timused = 5.0; - perdate = (d.killc + d.killk + d.nsckill)/timused; + if ((timused == 0 || state.remkl != 0) && timused < 5.0) timused = 5.0; + perdate = (state.killc + state.killk + state.nsckill)/timused; ithperd = 500*perdate + 0.5; iwon = 0; if (gamewon) iwon = 100*skill; if (ship == IHE) klship = 0; else if (ship == IHF) klship = 1; else klship = 2; - if (gamewon == 0) d.nromrem = 0; // None captured if no win - iscore = 10*d.killk + 50*d.killc + ithperd + iwon - - 100*d.basekl - 100*klship - 45*nhelp -5*d.starkl - casual - + 20*d.nromkl + 200*d.nsckill - 10*d.nplankl + d.nromrem; + if (gamewon == 0) state.nromrem = 0; // None captured if no win + iscore = 10*state.killk + 50*state.killc + ithperd + iwon + - 100*state.basekl - 100*klship - 45*nhelp -5*state.starkl - casual + + 20*state.nromkl + 200*state.nsckill - 10*state.nplankl + state.nromrem; if (alive == 0) iscore -= 200; skip(2); prout("Your score --"); - if (d.nromkl) + if (state.nromkl) printf("%6d Romulans destroyed %5d\n", - d.nromkl,20*d.nromkl); - if (d.nromrem) + state.nromkl,20*state.nromkl); + if (state.nromrem) printf("%6d Romulans captured %5d\n", - d.nromrem, d.nromrem); - if (d.killk) + state.nromrem, state.nromrem); + if (state.killk) printf("%6d ordinary Klingons destroyed %5d\n", - d.killk, 10*d.killk); - if (d.killc) + state.killk, 10*state.killk); + if (state.killc) printf("%6d Klingon commanders destroyed %5d\n", - d.killc, 50*d.killc); - if (d.nsckill) + state.killc, 50*state.killc); + if (state.nsckill) printf("%6d Super-Commander destroyed %5d\n", - d.nsckill, 200*d.nsckill); + state.nsckill, 200*state.nsckill); if (ithperd) printf("%6.2f Klingons per stardate %5d\n", perdate, ithperd); - if (d.starkl) + if (state.starkl) printf("%6d stars destroyed by your action %5d\n", - d.starkl, -5*d.starkl); - if (d.nplankl) + state.starkl, -5*state.starkl); + if (state.nplankl) printf("%6d planets destroyed by your action %5d\n", - d.nplankl, -10*d.nplankl); - if (d.basekl) + state.nplankl, -10*state.nplankl); + if (state.basekl) printf("%6d bases destroyed by your action %5d\n", - d.basekl, -100*d.basekl); + state.basekl, -100*state.basekl); if (nhelp) printf("%6d calls for help from starbase %5d\n", nhelp, -45*nhelp); diff --git a/moving.c b/moving.c index 47bb598..9eb7096 100644 --- a/moving.c +++ b/moving.c @@ -24,11 +24,11 @@ void move(void) { deltax /= bigger; /* If tractor beam is to occur, don't move full distance */ - if (d.date+Time >= future[FTBEAM]) { + if (state.date+Time >= future[FTBEAM]) { trbeam = 1; condit = IHRED; - dist = dist*(future[FTBEAM]-d.date)/Time + 0.1; - Time = future[FTBEAM] - d.date + 1e-5; + dist = dist*(future[FTBEAM]-state.date)/Time + 0.1; + Time = future[FTBEAM] - state.date + 1e-5; } /* Move within the quadrant */ quad[sectx][secty] = IHDOT; @@ -50,7 +50,7 @@ void move(void) { (iy-ky[l])*(double)(iy-ky[l])); kavgd[l] = 0.5 * (finald+kdist[l]); } - if (d.galaxy[quadx][quady] != 1000) attack(0); + if (state.galaxy[quadx][quady] != 1000) attack(0); if (alldone) return; } /* compute final position -- new quadrant and sector */ @@ -179,7 +179,7 @@ label100: kdist[l] = finald; } sortkl(); - if (d.galaxy[quadx][quady] != 1000 && iattak == 0) + if (state.galaxy[quadx][quady] != 1000 && iattak == 0) attack(0); for (l = 1 ; l <= nenhere; l++) kavgd[l] = kdist[l]; } @@ -443,7 +443,7 @@ void impuls(void) { } /* Make sure enough time is left for the trip */ Time = dist/0.095; - if (Time >= d.remtime) { + if (Time >= state.remtime) { prout("First Officer Spock- \"Captain, our speed under impulse"); prout("power is only 0.95 sectors per stardate. Are you sure"); prout("we dare spend the time?\""); @@ -515,11 +515,11 @@ void warp(int i) { /* Make sure enough time is left for the trip */ Time = 10.0*dist/wfacsq; - if (Time >= 0.8*d.remtime) { + if (Time >= 0.8*state.remtime) { skip(1); prout("First Officer Spock- \"Captain, I compute that such"); proutn(" a trip would require approximately "); - cramf(100.0*Time/d.remtime, 0, 2); + cramf(100.0*Time/state.remtime, 0, 2); prout(" percent of our"); prout(" remaining time. Are you sure this is wise?\""); if (ja() == 0) { ididit = 0; return;} @@ -703,7 +703,7 @@ void atover(int igrab) { crmshp(); skip(1); prout("safely out of quadrant."); - starch[quadx][quady] = damage[DRADIO] > 0.0 ? d.galaxy[quadx][quady]+1000:1; + starch[quadx][quady] = damage[DRADIO] > 0.0 ? state.galaxy[quadx][quady]+1000:1; /* Try to use warp engines */ if (damage[DWARPEN]) { @@ -735,28 +735,28 @@ void atover(int igrab) { return; } /* Repeat if another snova */ - } while (d.galaxy[quadx][quady] == 1000); - if (d.remkl==0) finish(FWON); /* Snova killed remaining enemy. */ + } while (state.galaxy[quadx][quady] == 1000); + if (state.remkl==0) finish(FWON); /* Snova killed remaining enemy. */ } void timwrp() { int l, ll, gotit; prout("***TIME WARP ENTERED."); - if (d.snap && Rand() < 0.5) { + if (state.snap && Rand() < 0.5) { /* Go back in time */ proutn("You are traveling backwards in time "); - cramf(d.date-snapsht.date, 0, 2); + cramf(state.date-snapsht.date, 0, 2); prout(" stardates."); - d = snapsht; - d.snap = 0; - if (d.remcom) { - future[FTBEAM] = d.date + expran(intime/d.remcom); - future[FBATTAK] = d.date + expran(0.3*intime); - } - future[FSNOVA] = d.date + expran(0.5*intime); - future[FSNAP] = d.date +expran(0.25*d.remtime); /* next snapshot will + state = snapsht; + state.snap = 0; + if (state.remcom) { + future[FTBEAM] = state.date + expran(intime/state.remcom); + future[FBATTAK] = state.date + expran(0.3*intime); + } + future[FSNOVA] = state.date + expran(0.5*intime); + future[FSNAP] = state.date +expran(0.25*state.remtime); /* next snapshot will be sooner */ - if (d.nscrem) future[FSCMOVE] = 0.2777; + if (state.nscrem) future[FSCMOVE] = 0.2777; isatb = 0; future[FCDBAS] = future[FSCDBAS] = 1e30; batx = baty = 0; @@ -765,7 +765,7 @@ void timwrp() { when on planet, which would give us two Galileos! */ gotit = 0; for (l = 1; l <= inplan; l++) { - if (d.plnets[l].known == 2) { + if (state.plnets[l].known == 2) { gotit = 1; if (iscraft==1 && ship==IHE) { prout("Checkov- \"Security reports the Galileo has disappeared, Sir!"); @@ -781,13 +781,13 @@ void timwrp() { } /* Revert star chart to earlier era, if it was known then*/ - if (damage[DRADIO]==0.0 || stdamtim > d.date) { + if (damage[DRADIO]==0.0 || stdamtim > state.date) { for (l = 1; l <= 8; l++) for (ll = 1; ll <= 8; ll++) if (starch[l][ll] > 1) - starch[l][ll]=damage[DRADIO]>0.0 ? d.galaxy[l][ll]+1000 :1; + starch[l][ll]=damage[DRADIO]>0.0 ? state.galaxy[l][ll]+1000 :1; prout("Spock has reconstructed a correct star chart from memory"); - if (damage[DRADIO] > 0.0) stdamtim = d.date; + if (damage[DRADIO] > 0.0) stdamtim = state.date; } } else { @@ -870,7 +870,7 @@ void probe(void) { probey = quady*10 + secty - 1; probecx = quadx; probecy = quady; - future[FDSPROB] = d.date + 0.01; // Time to move one sector + future[FDSPROB] = state.date + 0.01; // Time to move one sector prout("Ensign Chekov- \"The deep space probe is launched, Captain.\""); return; } @@ -890,7 +890,7 @@ void help(void) { prout("Subspace radio damaged."); return; } - if (d.rembase==0) { + if (state.rembase==0) { prout("Lt. Uhura- \"Captain, I'm not getting any response from Starbase.\""); return; } @@ -908,16 +908,16 @@ void help(void) { } else { ddist = 1e30; - for (l = 1; l <= d.rembase; l++) { - xdist=10.0*sqrt(square(d.baseqx[l]-quadx)+square(d.baseqy[l]-quady)); + for (l = 1; l <= state.rembase; l++) { + xdist=10.0*sqrt(square(state.baseqx[l]-quadx)+square(state.baseqy[l]-quady)); if (xdist < ddist) { ddist = xdist; line = l; } } /* Since starbase not in quadrant, set up new quadrant */ - quadx = d.baseqx[line]; - quady = d.baseqy[line]; + quadx = state.baseqx[line]; + quady = state.baseqy[line]; newqad(1); } /* dematerialize starship */ diff --git a/planets.c b/planets.c index a816863..fefa8a4 100644 --- a/planets.c +++ b/planets.c @@ -11,7 +11,7 @@ static int consumeTime(void) { ididit = 1; #if 0 /* Don't wory about this */ - if (future[FTBEAM] <= d.date+Time && d.remcom != 0 && condit != IHDOCKED) { + if (future[FTBEAM] <= state.date+Time && state.remcom != 0 && condit != IHDOCKED) { /* We are about to be tractor beamed -- operation fails */ return 1; } @@ -21,7 +21,7 @@ static int consumeTime(void) { events(); /* Used to avoid if future[FSCMOVE] within time */ // future[FSNOVA] = asave; /*fails if game over, quadrant super-novas or we've moved to new quadrant*/ - if (alldone || d.galaxy[quadx][quady] == 1000 || justin != 0) return 1; + if (alldone || state.galaxy[quadx][quady] == 1000 || justin != 0) return 1; return 0; } @@ -32,22 +32,22 @@ void preport(void) { prout("Spock- \"Planet report follows, Captain.\""); skip(1); for (i = 1; i <= inplan; i++) { - if (d.plnets[i].known + if (state.plnets[i].known #ifdef DEBUG - || ( idebug && d.plnets[i].x !=0) + || ( idebug && state.plnets[i].x !=0) #endif ) { iknow = 1; #ifdef DEBUG - if (idebug && d.plnets[i].known==0) proutn("(Unknown) "); + if (idebug && state.plnets[i].known==0) proutn("(Unknown) "); #endif - cramlc(1, d.plnets[i].x, d.plnets[i].y); + cramlc(1, state.plnets[i].x, state.plnets[i].y); proutn(" class "); - proutn(classes[d.plnets[i].pclass]); + proutn(classes[state.plnets[i].pclass]); proutn(" "); - if (d.plnets[i].crystals == 0) proutn("no "); + if (state.plnets[i].crystals == 0) proutn("no "); prout("dilithium crystals present."); - if (d.plnets[i].known==2) + if (state.plnets[i].known==2) prout(" Shuttle Craft Galileo on surface."); } } @@ -102,14 +102,14 @@ void sensor(void) { proutn(" Planet at"); cramlc(2, plnetx, plnety); proutn(" is of class "); - proutn(classes[d.plnets[iplnet].pclass]); + proutn(classes[state.plnets[iplnet].pclass]); prout("."); - if (d.plnets[iplnet].known==2) + if (state.plnets[iplnet].known==2) prout(" Sensors show Galileo still on surface."); proutn(" Readings indicate"); - if (d.plnets[iplnet].crystals == 0) proutn(" no"); + if (state.plnets[iplnet].crystals == 0) proutn(" no"); prout(" dilithium crystals present.\""); - if (d.plnets[iplnet].known == 0) d.plnets[iplnet].known = 1; + if (state.plnets[iplnet].known == 0) state.plnets[iplnet].known = 1; return; } @@ -118,7 +118,7 @@ void beam(void) { skip(1); if (damage[DTRANSP] != 0) { prout("Transporter damaged."); - if (damage[DSHUTTL]==0 && (d.plnets[iplnet].known==2 || iscraft == 1)) { + if (damage[DSHUTTL]==0 && (state.plnets[iplnet].known==2 || iscraft == 1)) { skip(1); prout("Spock- \"May I suggest the shuttle craft, Sir?\" "); if (ja() != 0) shuttle(); @@ -134,7 +134,7 @@ void beam(void) { prout("Impossible to transport through shields."); return; } - if (d.plnets[iplnet].known==0) { + if (state.plnets[iplnet].known==0) { prout("Spock- \"Captain, we have no information on this planet"); prout(" and Starfleet Regulations clearly state that in this situation"); prout(" you may not go down.\""); @@ -142,7 +142,7 @@ void beam(void) { } if (landed==1) { /* Coming from planet */ - if (d.plnets[iplnet].known==2) { + if (state.plnets[iplnet].known==2) { proutn("Spock- \"Wouldn't you rather take the Galileo?\" "); if (ja() != 0) { chew(); @@ -159,7 +159,7 @@ void beam(void) { } else { /* Going to planet */ - if (d.plnets[iplnet].crystals==0) { + if (state.plnets[iplnet].crystals==0) { prout("Spock- \"Captain, I fail to see the logic in"); prout(" exploring a planet with no dilithium crystals."); proutn(" Are you sure this is wise?\" "); @@ -188,7 +188,7 @@ void beam(void) { skip(2); prout("Transport complete."); landed = -landed; - if (landed==1 && d.plnets[iplnet].known==2) { + if (landed==1 && state.plnets[iplnet].known==2) { prout("The shuttle craft Galileo is here!"); } if (landed!=1 && imine==1) { @@ -208,7 +208,7 @@ void mine(void) { prout("Mining party not on planet."); return; } - if (d.plnets[iplnet].crystals == 0) { + if (state.plnets[iplnet].crystals == 0) { prout("No dilithium crystals on this planet."); return; } @@ -223,7 +223,7 @@ void mine(void) { prout("there's no reason to mine more at this time."); return; } - Time = (0.1+0.2*Rand())*d.plnets[iplnet].pclass; + Time = (0.1+0.2*Rand())*state.plnets[iplnet].pclass; if (consumeTime()) return; prout("Mining operation complete."); imine = 1; @@ -287,7 +287,7 @@ void shuttle(void) { ididit = 0; if(damage[DSHUTTL] != 0.0) { if (damage[DSHUTTL] == -1.0) { - if (inorbit && d.plnets[iplnet].known == 2) + if (inorbit && state.plnets[iplnet].known == 2) prout("Ye Faerie Queene has no shuttle craft bay to dock it at."); else prout("Ye Faerie Queene had no shuttle craft."); @@ -302,11 +302,11 @@ void shuttle(void) { prout(" not in standard orbit."); return; } - if ((d.plnets[iplnet].known != 2) && iscraft != 1) { + if ((state.plnets[iplnet].known != 2) && iscraft != 1) { prout("Shuttle craft not currently available."); return; } - if (landed==-1 && d.plnets[iplnet].known==2) { + if (landed==-1 && state.plnets[iplnet].known==2) { prout("You will have to beam down to retrieve the shuttle craft."); return; } @@ -314,17 +314,17 @@ void shuttle(void) { prout("Shuttle craft cannot pass through shields."); return; } - if (d.plnets[iplnet].known==0) { + if (state.plnets[iplnet].known==0) { prout("Spock- \"Captain, we have no information on this planet"); prout(" and Starfleet Regulations clearly state that in this situation"); prout(" you may not fly down.\""); return; } Time = 3.0e-5*height; - if (Time >= 0.8*d.remtime) { + if (Time >= 0.8*state.remtime) { prout("First Officer Spock- \"Captain, I compute that such"); prout(" a maneuver would require approximately "); - cramf(100*Time/d.remtime,0,4); + cramf(100*Time/state.remtime,0,4); prout("% of our"); prout("remaining time."); prout("Are you sure this is wise?\" "); @@ -351,7 +351,7 @@ void shuttle(void) { iscraft = 0; skip(1); if (consumeTime()) return; - d.plnets[iplnet].known=2; + state.plnets[iplnet].known=2; prout("Trip complete."); return; } @@ -361,7 +361,7 @@ void shuttle(void) { prout("shuttle craft for the trip back to the Enterprise."); skip(1); prout("The short hop begins . . ."); - d.plnets[iplnet].known=1; + state.plnets[iplnet].known=1; icraft = 1; skip(1); landed = -1; @@ -388,7 +388,7 @@ void shuttle(void) { icraft = 1; iscraft = 0; if (consumeTime()) return; - d.plnets[iplnet].known = 2; + state.plnets[iplnet].known = 2; landed = 1; icraft = 0; prout("Trip complete"); @@ -439,7 +439,7 @@ void deathray(void) { while (nenhere > 0) deadkl(kx[1],ky[1],quad[kx[1]][ky[1]],kx[1],ky[1]); prout("Ensign Chekov- \"Congratulations, Captain!\""); - if (d.remkl == 0) finish(FWON); + if (state.remkl == 0) finish(FWON); prout("Spock- \"Captain, I believe the `Experimental Death Ray'"); if (Rand() <= 0.05) { prout(" is still operational.\""); diff --git a/reports.c b/reports.c index 0c8f606..afed60a 100644 --- a/reports.c +++ b/reports.c @@ -14,7 +14,7 @@ void attakreport(void) { } if (isatb == 1) { proutn("Starbase in "); - cramlc(1, d.isx, d.isy); + cramlc(1, state.isx, state.isy); prout(" is under Super-commander attack."); proutn("It can hold out until Stardate "); cramf(future[FSCDBAS], 0, 1); @@ -42,28 +42,28 @@ void report(int f) { case 5: s3="emeritus"; break; default: s3="skilled"; break; } - printf("\nYou %s playing a %s%s %s game.\n", + printf("\nYou %s playing a %s%s %s frozen.\n", alldone? "were": "are now", s1, s2, s3); if (skill>3 && thawed && !alldone) prout("No plaque is allowed."); if (tourn) printf("This is tournament game %d.\n", tourn); if (f) printf("Your secret password is \"%s\"\n",passwd); printf("%d of %d Klingons have been killed", - d.killk+d.killc+d.nsckill, inkling); - if (d.killc) printf(", including %d Commander%s.\n", d.killc, d.killc==1?"":"s"); - else if (d.killk+d.nsckill > 0) prout(", but no Commanders."); + state.killk+state.killc+state.nsckill, inkling); + if (state.killc) printf(", including %d Commander%s.\n", state.killc, state.killc==1?"":"s"); + else if (state.killk+state.nsckill > 0) prout(", but no Commanders."); else prout("."); if (skill > 2) printf("The Super Commander has %sbeen destroyed.\n", - d.nscrem?"not ":""); - if (d.rembase != inbase) { + state.nscrem?"not ":""); + if (state.rembase != inbase) { proutn("There "); - if (inbase-d.rembase==1) proutn("has been 1 base"); + if (inbase-state.rembase==1) proutn("has been 1 base"); else { proutn("have been "); - crami(inbase-d.rembase, 1); + crami(inbase-state.rembase, 1); proutn(" bases"); } proutn(" destroyed, "); - crami(d.rembase, 1); + crami(state.rembase, 1); prout(" remaining."); } else printf("There are %d bases.\n", inbase); @@ -134,8 +134,8 @@ void lrscan(void) { if (x == 0 || x > 8 || y == 0 || y > 8) printf(" -1"); else { - printf("%5d", d.galaxy[x][y]); - starch[x][y] = damage[DRADIO] > 0 ? d.galaxy[x][y]+1000 :1; + printf("%5d", state.galaxy[x][y]); + starch[x][y] = damage[DRADIO] > 0 ? state.galaxy[x][y]+1000 :1; } } putchar('\n'); @@ -170,7 +170,7 @@ void chart(int nn) { chew(); skip(1); - if (stdamtim != 1e30 && stdamtim != d.date && condit == IHDOCKED) { + if (stdamtim != 1e30 && stdamtim != state.date && condit == IHDOCKED) { prout("Spock- \"I revised the Star Chart from the"); prout(" starbase's records.\""); skip(1); @@ -179,14 +179,14 @@ void chart(int nn) { if (stdamtim != 1e30) { if (condit == IHDOCKED) { /* We are docked, so restore chart from base information */ - stdamtim = d.date; + stdamtim = state.date; for (i=1; i <= 8 ; i++) for (j=1; j <= 8; j++) - if (starch[i][j] == 1) starch[i][j] = d.galaxy[i][j]+1000; + if (starch[i][j] == 1) starch[i][j] = state.galaxy[i][j]+1000; } else { proutn("(Last surveillance update "); - cramf(d.date-stdamtim, 0, 1); + cramf(state.date-stdamtim, 0, 1); prout(" stardates ago.)"); } } @@ -205,7 +205,7 @@ void chart(int nn) { else if (starch[i][j] > 999) printf("%5d", starch[i][j]-1000); else - printf("%5d", d.galaxy[i][j]); + printf("%5d", state.galaxy[i][j]); } prout(" -"); } @@ -238,7 +238,7 @@ void srscan(int l) { } if (goodScan) starch[quadx][quady] = damage[DRADIO]>0.0 ? - d.galaxy[quadx][quady]+1000:1; + state.galaxy[quadx][quady]+1000:1; scan(); if (isit("chart")) nn = TRUE; if (isit("no")) rightside = FALSE; @@ -278,7 +278,7 @@ void srscan(int l) { if (rightside) { switch (jj) { case 1: - printf(" Stardate %.1f", d.date); + printf(" Stardate %.1f", state.date); break; case 2: if (condit != IHDOCKED) newcnd(); @@ -328,10 +328,10 @@ void srscan(int l) { (int)((100.0*shield)/inshld + 0.5), shield); break; case 9: - printf(" Klingons Left %d", d.remkl); + printf(" Klingons Left %d", state.remkl); break; case 10: - printf(" Time Left %.2f", d.remtime); + printf(" Time Left %.2f", state.remtime); break; } @@ -397,7 +397,7 @@ void eta(void) { proutn("Time or arrival date? "); if (scan()==IHREAL) { ttime = aaitem; - if (ttime > d.date) ttime -= d.date; // Actually a star date + if (ttime > state.date) ttime -= state.date; // Actually a star date if (ttime <= 1e-10 || (twarp=(floor(sqrt((10.0*dist)/ttime)*10.0)+1.0)/10.0) > 10) { prout("We'll never make it, sir."); @@ -455,7 +455,7 @@ void eta(void) { prout("."); if (wfl) { proutn("And we will arrive at stardate "); - cramf(d.date+ttime, 1, 1); + cramf(state.date+ttime, 1, 1); prout("."); } else if (twarp==1.0) @@ -465,16 +465,16 @@ void eta(void) { cramf(twarp, 1, 2); skip(1); proutn("and we will arrive at stardate "); - cramf(d.date+ttime, 1, 2); + cramf(state.date+ttime, 1, 2); prout("."); } - if (d.remtime < ttime) + if (state.remtime < ttime) prout("Unfortunately, the Federation will be destroyed by then."); if (twarp > 6.0) prout("You'll be taking risks at that speed, Captain"); - if ((isatb==1 && d.isy == ix1 && d.isx == iy1 && - future[FSCDBAS]< ttime+d.date)|| - (future[FCDBAS]= 10); + while (state.galaxy[ix][iy] >= 10); contflag = FALSE; for (j = i-1; j > 0; j--) { /* Improved placement algorithm to spread out bases */ - double distq = square(ix-d.baseqx[j]) + square(iy-d.baseqy[j]); + double distq = square(ix-state.baseqx[j]) + square(iy-state.baseqy[j]); if (distq < 6.0*(6-inbase) && Rand() < 0.75) { contflag = TRUE; #ifdef DEBUG @@ -275,13 +275,13 @@ void setup(void) { } } while (contflag); - d.baseqx[i] = ix; - d.baseqy[i] = iy; + state.baseqx[i] = ix; + state.baseqy[i] = iy; starch[ix][iy] = -1; - d.galaxy[ix][iy] += 10; + state.galaxy[ix][iy] += 10; } // Position ordinary Klingon Battle Cruisers - krem = inkling - incom - d.nscrem; + krem = inkling - incom - state.nscrem; klumper = 0.25*skill*(9.0-length)+1.0; if (klumper > 9) klumper = 9; // Can't have more than 9 in quadrant do { @@ -291,8 +291,8 @@ void setup(void) { krem -= klump; klump *= 100; do iran8(&ix, &iy); - while (d.galaxy[ix][iy] + klump >= 1000); - d.galaxy[ix][iy] += klump; + while (state.galaxy[ix][iy] + klump >= 1000); + state.galaxy[ix][iy] += klump; } while (krem > 0); // Position Klingon Commander Ships #ifdef DEBUG @@ -303,47 +303,47 @@ void setup(void) { do { /* IF debugging, put commanders by bases, always! */ #ifdef DEBUG if (idebug && klumper <= inbase) { - ix = d.baseqx[klumper]; - iy = d.baseqy[klumper]; + ix = state.baseqx[klumper]; + iy = state.baseqy[klumper]; klumper++; } else #endif iran8(&ix, &iy); } - while ((d.galaxy[ix][iy] < 99 && Rand() < 0.75)|| - d.galaxy[ix][iy]>899); + while ((state.galaxy[ix][iy] < 99 && Rand() < 0.75)|| + state.galaxy[ix][iy]>899); // check for duplicate for (j = 1; j < i; j++) - if (d.cx[j]==ix && d.cy[j]==iy) break; + if (state.cx[j]==ix && state.cy[j]==iy) break; } while (j < i); - d.galaxy[ix][iy] += 100; - d.cx[i] = ix; - d.cy[i] = iy; + state.galaxy[ix][iy] += 100; + state.cx[i] = ix; + state.cy[i] = iy; } // Locate planets in galaxy for (i = 1; i <= inplan; i++) { do iran8(&ix, &iy); - while (d.newstuf[ix][iy] > 0); - d.newstuf[ix][iy] = 1; - d.plnets[i].x = ix; - d.plnets[i].y = iy; - d.plnets[i].pclass = Rand()*3.0 + 1.0; // Planet class M N or O - d.plnets[i].crystals = 1.5*Rand(); // 1 in 3 chance of crystals - d.plnets[i].known = 0; + while (state.newstuf[ix][iy] > 0); + state.newstuf[ix][iy] = 1; + state.plnets[i].x = ix; + state.plnets[i].y = iy; + state.plnets[i].pclass = Rand()*3.0 + 1.0; // Planet class M N or O + state.plnets[i].crystals = 1.5*Rand(); // 1 in 3 chance of crystals + state.plnets[i].known = 0; } // Locate Romulans - for (i = 1; i <= d.nromrem; i++) { + for (i = 1; i <= state.nromrem; i++) { iran8(&ix, &iy); - d.newstuf[ix][iy] += 10; + state.newstuf[ix][iy] += 10; } // Locate the Super Commander - if (d.nscrem > 0) { + if (state.nscrem > 0) { do iran8(&ix, &iy); - while (d.galaxy[ix][iy] >= 900); - d.isx = ix; - d.isy = iy; - d.galaxy[ix][iy] += 100; + while (state.galaxy[ix][iy] >= 900); + state.isx = ix; + state.isy = iy; + state.galaxy[ix][iy] += 100; } // Place thing (in tournament game, thingx == -1, don't want one!) if (Rand() < 0.1 && thingx != -1) { @@ -355,11 +355,11 @@ void setup(void) { // idate = date; skip(3); - d.snap = 0; + state.snap = 0; if (skill == 1) { printf("It is stardate %d. The Federation is being attacked by\n", - (int)d.date); + (int)state.date); printf("a deadly Klingon invasion force. As captain of the United\n" "Starship U.S.S. Enterprise, it is your mission to seek out\n" "and destroy this invasion force of %d battle cruisers.\n", @@ -373,12 +373,12 @@ void setup(void) { else { printf("Stardate %d.\n\n" "%d Klingons.\nAn unknown number of Romulans\n", - (int)d.date, inkling); - if (d.nscrem) printf("and one (GULP) Super-Commander.\n"); + (int)state.date, inkling); + if (state.nscrem) printf("and one (GULP) Super-Commander.\n"); printf("%d stardates\n%d starbases in ",(int)intime, inbase); } for (i = 1; i <= inbase; i++) { - cramlc(0, d.baseqx[i], d.baseqy[i]); + cramlc(0, state.baseqx[i], state.baseqy[i]); if (i < inbase) proutn(" "); } skip(2); @@ -388,7 +388,7 @@ void setup(void) { cramlc(2, sectx, secty); skip(2); prout("Good Luck!"); - if (d.nscrem) proutn(" YOU'LL NEED IT."); + if (state.nscrem) proutn(" YOU'LL NEED IT."); skip(1); newqad(0); if (nenhere) shldup=1.0; @@ -476,22 +476,22 @@ int choose(void) { // Use parameters to generate initial values of things damfac = 0.5 * skill; - d.rembase = 3.0*Rand()+2.0; - inbase = d.rembase; + state.rembase = 3.0*Rand()+2.0; + inbase = state.rembase; inplan = (PLNETMAX/2) + (PLNETMAX/2+1)*Rand(); - d.nromrem = (2.0+Rand())*skill; - d.nscrem = (skill > 2? 1 : 0); - d.remtime = 7.0 * length; - intime = d.remtime; - d.remkl = 2.0*intime*((skill+1 - 2*Rand())*skill*0.1+.15); - inkling = d.remkl; + state.nromrem = (2.0+Rand())*skill; + state.nscrem = (skill > 2? 1 : 0); + state.remtime = 7.0 * length; + intime = state.remtime; + state.remkl = 2.0*intime*((skill+1 - 2*Rand())*skill*0.1+.15); + inkling = state.remkl; incom = skill + 0.0625*inkling*Rand(); - d.remcom= min(10, incom); - incom = d.remcom; - d.remres = (inkling+4*incom)*intime; - inresor = d.remres; + state.remcom= min(10, incom); + incom = state.remcom; + state.remres = (inkling+4*incom)*intime; + inresor = state.remres; if (inkling > 50) { - inbase = (d.rembase += 1); + inbase = (state.rembase += 1); } return FALSE; } @@ -505,14 +505,14 @@ void dropin(int iquad, int *ix, int *iy) { void newcnd(void) { condit = IHGREEN; if (energy < 1000.0) condit = IHYELLOW; - if (d.galaxy[quadx][quady] > 99 || d.newstuf[quadx][quady] > 9) + if (state.galaxy[quadx][quady] > 99 || state.newstuf[quadx][quady] > 9) condit = IHRED; } void newqad(int shutup) { - int quadnum = d.galaxy[quadx][quady]; - int newnum = d.newstuf[quadx][quady]; + int quadnum = state.galaxy[quadx][quady]; + int newnum = state.newstuf[quadx][quady]; int i, j, ix, iy, nplan; iattak = 1; @@ -583,17 +583,17 @@ void newqad(int shutup) { kpower[i] = Rand()*150.0 +300.0 +25.0*skill; } // If we need a commander, promote a Klingon - for (i = 1; i <= d.remcom ; i++) - if (d.cx[i]==quadx && d.cy[i]==quady) break; + for (i = 1; i <= state.remcom ; i++) + if (state.cx[i]==quadx && state.cy[i]==quady) break; - if (i <= d.remcom) { + if (i <= state.remcom) { quad[ix][iy] = IHC; kpower[klhere] = 950.0+400.0*Rand()+50.0*skill; comhere = 1; } // If we need a super-commander, promote a Klingon - if (quadx == d.isx && quady == d.isy) { + if (quadx == state.isx && quady == state.isy) { quad[kx[1]][ky[1]] = IHS; kpower[1] = 1175.0 + 400.0*Rand() + 125.0*skill; iscate = 1; @@ -618,7 +618,7 @@ void newqad(int shutup) { if (nplan) { // If quadrant needs a planet, put it in for (i=1; i <= inplan; i++) - if (d.plnets[i].x == quadx && d.plnets[i].y == quady) break; + if (state.plnets[i].x == quadx && state.plnets[i].y == quady) break; if (i <= inplan) { iplnet = i; dropin(IHP, &plnetx, &plnety); diff --git a/sst.c b/sst.c index e4fe2af..55066eb 100644 --- a/sst.c +++ b/sst.c @@ -323,7 +323,7 @@ static void makemoves(void) { events(); if (alldone) break; // Events did us in } - if (d.galaxy[quadx][quady] == 1000) { // Galaxy went Nova! + if (state.galaxy[quadx][quady] == 1000) { // Galaxy went Nova! atover(0); continue; } @@ -331,7 +331,7 @@ static void makemoves(void) { if (hitme && justin==0) { attack(2); if (alldone) break; - if (d.galaxy[quadx][quady] == 1000) { // went NOVA! + if (state.galaxy[quadx][quady] == 1000) { // went NOVA! atover(0); hitme = TRUE; continue; @@ -657,7 +657,7 @@ void debugme(void) { key = scan(); if (key == IHALPHA && isit("y")) { damage[i] = 10.0; - if (i == DRADIO) stdamtim = d.date; + if (i == DRADIO) stdamtim = state.date; } } } @@ -676,12 +676,12 @@ void debugme(void) { case FSCMOVE: proutn("SC Move "); break; case FSCDBAS: proutn("SC Base Destroy "); break; } - cramf(future[i]-d.date, 8, 2); + cramf(future[i]-state.date, 8, 2); chew(); proutn(" ?"); key = scan(); if (key == IHREAL) { - future[i] = d.date + aaitem; + future[i] = state.date + aaitem; } } chew(); diff --git a/sst.h b/sst.h index b343120..78b8ca4 100644 --- a/sst.h +++ b/sst.h @@ -47,7 +47,7 @@ EXTERN struct foo { double date, // stardate remres, // remaining resources remtime; // remaining time -} d, snapsht; // Data that is snapshot +} state, snapsht; // Data that is snapshot EXTERN char quad[11][11]; // contents of our quadrant @@ -145,95 +145,95 @@ EXTERN struct foo2 { probey, probeinx, probeiny; -} game; +} frozen; -#define inkling game.inkling // Initial number of klingons -#define inbase game.inbase // Initial number of bases -#define incom game.incom // Initian number of commanders -#define instar game.instar // Initial stars -#define intorps game.intorps // Initial/Max torpedoes -#define condit game.condit // Condition (red, yellow, green docked) -#define torps game.torps // number of torpedoes -#define ship game.ship // Ship type -- 'E' is Enterprise -#define quadx game.quadx // where we are -#define quady game.quady // -#define sectx game.sectx // where we are -#define secty game.secty // -#define length game.length // length of game -#define skill game.skill // skill level -#define basex game.basex // position of base in current quad -#define basey game.basey // -#define klhere game.klhere // klingons here -#define comhere game.comhere // commanders here -#define casual game.casual // causalties -#define nhelp game.nhelp // calls for help -#define nkinks game.nkinks // -#define ididit game.ididit // Action taken -- allows enemy to attack -#define gamewon game.gamewon // Finished! -#define alive game.alive // We are alive (not killed) -#define justin game.justin // just entered quadrant -#define alldone game.alldone // game is now finished -#define shldchg game.shldchg // shield is changing (affects efficiency) -#define thingx game.thingx // location of strange object in galaxy -#define thingy game.thingy // -#define plnetx game.plnetx // location of planet in quadrant -#define plnety game.plnety // -#define inorbit game.inorbit // orbiting -#define landed game.landed // party on planet (1), on ship (-1) -#define iplnet game.iplnet // planet # in quadrant -#define imine game.imine // mining -#define inplan game.inplan // initial planets -#define nenhere game.nenhere // Number of enemies in quadrant -#define ishere game.ishere // Super-commander in quandrant -#define neutz game.neutz // Romulan Neutral Zone -#define irhere game.irhere // Romulans in quadrant -#define icraft game.icraft // Kirk in Galileo -#define ientesc game.ientesc // Attempted escape from supercommander -#define iscraft game.iscraft // =1 if craft on ship, -1 if removed from game -#define isatb game.isatb // =1 if SuperCommander is attacking base -#define iscate game.iscate // Super Commander is here +#define inkling frozen.inkling // Initial number of klingons +#define inbase frozen.inbase // Initial number of bases +#define incom frozen.incom // Initian number of commanders +#define instar frozen.instar // Initial stars +#define intorps frozen.intorps // Initial/Max torpedoes +#define condit frozen.condit // Condition (red, yellow, green docked) +#define torps frozen.torps // number of torpedoes +#define ship frozen.ship // Ship type -- 'E' is Enterprise +#define quadx frozen.quadx // where we are +#define quady frozen.quady // +#define sectx frozen.sectx // where we are +#define secty frozen.secty // +#define length frozen.length // length of game +#define skill frozen.skill // skill level +#define basex frozen.basex // position of base in current quad +#define basey frozen.basey // +#define klhere frozen.klhere // klingons here +#define comhere frozen.comhere // commanders here +#define casual frozen.casual // causalties +#define nhelp frozen.nhelp // calls for help +#define nkinks frozen.nkinks // +#define ididit frozen.ididit // Action taken -- allows enemy to attack +#define gamewon frozen.gamewon // Finished! +#define alive frozen.alive // We are alive (not killed) +#define justin frozen.justin // just entered quadrant +#define alldone frozen.alldone // game is now finished +#define shldchg frozen.shldchg // shield is changing (affects efficiency) +#define thingx frozen.thingx // location of strange object in galaxy +#define thingy frozen.thingy // +#define plnetx frozen.plnetx // location of planet in quadrant +#define plnety frozen.plnety // +#define inorbit frozen.inorbit // orbiting +#define landed frozen.landed // party on planet (1), on ship (-1) +#define iplnet frozen.iplnet // planet # in quadrant +#define imine frozen.imine // mining +#define inplan frozen.inplan // initial planets +#define nenhere frozen.nenhere // Number of enemies in quadrant +#define ishere frozen.ishere // Super-commander in quandrant +#define neutz frozen.neutz // Romulan Neutral Zone +#define irhere frozen.irhere // Romulans in quadrant +#define icraft frozen.icraft // Kirk in Galileo +#define ientesc frozen.ientesc // Attempted escape from supercommander +#define iscraft frozen.iscraft // =1 if craft on ship, -1 if removed from game +#define isatb frozen.isatb // =1 if SuperCommander is attacking base +#define iscate frozen.iscate // Super Commander is here #ifdef DEBUG -#define idebug game.idebug // Debug mode +#define idebug frozen.idebug // Debug mode #endif -#define iattak game.iattak // attack recursion elimination (was cracks[4]) -#define icrystl game.icrystl // dilithium crystals aboard -#define tourn game.tourn // Tournament number -#define thawed game.thawed // Thawed game -#define batx game.batx // Base coordinates being attacked -#define baty game.baty // -#define ithere game.ithere // Tholean is here -#define ithx game.ithx // coordinates of tholean -#define ithy game.ithy -#define iseenit game.iseenit // Seen base attack report -#define inresor game.inresor // initial resources -#define intime game.intime // initial time -#define inenrg game.inenrg // Initial/Max Energy -#define inshld game.inshld // Initial/Max Shield -#define inlsr game.inlsr // initial life support resources -#define indate game.indate // Initial date -#define energy game.energy // Energy level -#define shield game.shield // Shield level -#define shldup game.shldup // Shields are up -#define warpfac game.warpfac // Warp speed -#define wfacsq game.wfacsq // squared warp factor -#define lsupres game.lsupres // life support reserves -#define dist game.dist // movement distance -#define direc game.direc // movement direction -#define Time game.Time // time taken by current operation -#define docfac game.docfac // repair factor when docking (constant?) -#define resting game.resting // rest time -#define damfac game.damfac // damage factor -#define stdamtim game.stdamtim // time that star chart was damaged -#define cryprob game.cryprob // probability that crystal will work -#define probex game.probex // location of probe -#define probey game.probey -#define probecx game.probecx // current probe quadrant -#define probecy game.probecy -#define probeinx game.probeinx // Probe x,y increment -#define probeiny game.probeiny -#define proben game.proben // number of moves for probe -#define isarmed game.isarmed // Probe is armed -#define nprobes game.nprobes // number of probes available +#define iattak frozen.iattak // attack recursion elimination (was cracks[4]) +#define icrystl frozen.icrystl // dilithium crystals aboard +#define tourn frozen.tourn // Tournament number +#define thawed frozen.thawed // Thawed game +#define batx frozen.batx // Base coordinates being attacked +#define baty frozen.baty // +#define ithere frozen.ithere // Tholean is here +#define ithx frozen.ithx // coordinates of tholean +#define ithy frozen.ithy +#define iseenit frozen.iseenit // Seen base attack report +#define inresor frozen.inresor // initial resources +#define intime frozen.intime // initial time +#define inenrg frozen.inenrg // Initial/Max Energy +#define inshld frozen.inshld // Initial/Max Shield +#define inlsr frozen.inlsr // initial life support resources +#define indate frozen.indate // Initial date +#define energy frozen.energy // Energy level +#define shield frozen.shield // Shield level +#define shldup frozen.shldup // Shields are up +#define warpfac frozen.warpfac // Warp speed +#define wfacsq frozen.wfacsq // squared warp factor +#define lsupres frozen.lsupres // life support reserves +#define dist frozen.dist // movement distance +#define direc frozen.direc // movement direction +#define Time frozen.Time // time taken by current operation +#define docfac frozen.docfac // repair factor when docking (constant?) +#define resting frozen.resting // rest time +#define damfac frozen.damfac // damage factor +#define stdamtim frozen.stdamtim // time that star chart was damaged +#define cryprob frozen.cryprob // probability that crystal will work +#define probex frozen.probex // location of probe +#define probey frozen.probey +#define probecx frozen.probecx // current probe quadrant +#define probecy frozen.probecy +#define probeinx frozen.probeinx // Probe x,y increment +#define probeiny frozen.probeiny +#define proben frozen.proben // number of moves for probe +#define isarmed frozen.isarmed // Probe is armed +#define nprobes frozen.nprobes // number of probes available EXTERN int kx[21], // enemy sector locations