From 2ea1ffb97cc0cdb13d8f4d42547a4e15245adfb2 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 20 Sep 2006 05:31:21 +0000 Subject: [PATCH] Change the condition field from an uint with #defines to an enum. --- src/ai.c | 20 ++++++++++---------- src/battle.c | 28 ++++++++++++++-------------- src/events.c | 30 +++++++++++++++--------------- src/io.c | 2 +- src/moving.c | 14 +++++++------- src/planets.c | 4 ++-- src/reports.c | 40 ++++++++++++++++++++-------------------- src/setup.c | 14 +++++++------- src/sst.h | 14 +++++++------- 9 files changed, 83 insertions(+), 83 deletions(-) diff --git a/src/ai.c b/src/ai.c index 1fd1b9b..91d7ab4 100644 --- a/src/ai.c +++ b/src/ai.c @@ -27,7 +27,7 @@ static bool tryexit(coord look, int ienm, int loccom, bool irun) /* print escape message and move out of quadrant. We know this if either short or long range sensors are working */ if (!damaged(DSRSENS) || !damaged(DLRSENS) || - game.condit == IHDOCKED) { + game.condition == docked) { crmena(1, ienm, sector, game.ks[loccom]); prout(_(" escapes to %s (and regains strength)."), cramlc(quadrant, iq)); @@ -40,7 +40,7 @@ static bool tryexit(coord look, int ienm, int loccom, bool irun) game.kdist[loccom] = game.kdist[game.nenhere]; game.klhere--; game.nenhere--; - if (game.condit != IHDOCKED) newcnd(); + if (game.condition != docked) newcnd(); /* Handle global matters related to escape */ game.state.galaxy[game.quadrant.x][game.quadrant.y].klingons--; game.state.galaxy[iq.x][iq.y].klingons++; @@ -85,7 +85,7 @@ static void movebaddy(coord com, int loccom, int ienm) /* If SC, check with spy to see if should hi-tail it */ if (ienm==IHS && - (game.kpower[loccom] <= 500.0 || (game.condit==IHDOCKED && !damaged(DPHOTON)))) { + (game.kpower[loccom] <= 500.0 || (game.condition==docked && !damaged(DPHOTON)))) { irun = true; motion = -QUADSIZE; } @@ -146,12 +146,12 @@ static void movebaddy(coord com, int loccom, int ienm) forces += 1000.0; } motion = 0; - if (forces <= 1000.0 && game.condit != IHDOCKED) /* Typical situation */ + if (forces <= 1000.0 && game.condition != docked) /* Typical situation */ motion = ((forces+200.0*Rand())/150.0) - 5.0; else { if (forces > 1000.0) /* Very strong -- move in for kill */ motion = (1.0-square(Rand()))*dist1 + 1.0; - if (game.condit==IHDOCKED && (game.options & OPTION_BASE)) /* protected by base -- back off ! */ + if (game.condition==docked && (game.options & OPTION_BASE)) /* protected by base -- back off ! */ motion -= game.skill*(2.0-square(Rand())); } if (idebug) @@ -239,7 +239,7 @@ static void movebaddy(coord com, int loccom, int ienm) /* it moved */ game.ks[loccom] = next; game.kdist[loccom] = game.kavgd[loccom] = distance(game.sector, next); - if (!damaged(DSRSENS) || game.condit == IHDOCKED) { + if (!damaged(DSRSENS) || game.condition == docked) { proutn("***"); cramen(ienm); proutn(_(" from %s"), cramlc(2, com)); @@ -324,7 +324,7 @@ static bool movescom(coord iq, bool flag, bool *ipage) game.kpower[i] = game.kpower[game.nenhere]; game.klhere--; game.nenhere--; - if (game.condit!=IHDOCKED) newcnd(); + if (game.condition!=docked) newcnd(); sortkl(); } /* check for a helpful planet */ @@ -334,7 +334,7 @@ static bool movescom(coord iq, bool flag, bool *ipage) /* destroy the planet */ DESTROY(&game.state.plnets[i]); game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].planet = NOPLANET; - if (!damaged(DRADIO) || game.condit == IHDOCKED) { + if (!damaged(DRADIO) || game.condition == docked) { if (*ipage==0) pause_game(1); *ipage = 1; prout(_("Lt. Uhura- \"Captain, Starfleet Intelligence reports")); @@ -487,7 +487,7 @@ void scom(bool *ipage) schedule(FSCDBAS, 1.0 +2.0*Rand()); if (is_scheduled(FCDBAS)) postpone(FSCDBAS, scheduled(FCDBAS)-game.state.date); - if (damaged(DRADIO) && game.condit != IHDOCKED) + if (damaged(DRADIO) && game.condition != docked) return; /* no warning */ game.iseenit = true; if (*ipage == 0) pause_game(1); @@ -510,7 +510,7 @@ void scom(bool *ipage) if ( !idebug && (Rand() > 0.2 || - (damaged(DRADIO) && game.condit != IHDOCKED) || + (damaged(DRADIO) && game.condition != docked) || !game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].charted)) return; if (*ipage==0) pause_game(1); diff --git a/src/battle.c b/src/battle.c index ca77cd4..6e171b2 100644 --- a/src/battle.c +++ b/src/battle.c @@ -62,7 +62,7 @@ void doshield(int i) } game.shldup = true; game.shldchg = 1; - if (game.condit != IHDOCKED) game.energy -= 50.0; + if (game.condition != docked) game.energy -= 50.0; prout(_("Shields raised.")); if (game.energy <= 0) { skip(1); @@ -196,7 +196,7 @@ void torpedo(double course, double r, coord in, double *hit, int i, int n) if (fabs(deltay) > bigger) bigger = fabs(deltay); deltax /= bigger; deltay /= bigger; - if (!damaged(DSRSENS) || game.condit==IHDOCKED) + if (!damaged(DSRSENS) || game.condition==docked) setwnd(srscan_window); else setwnd(message_window); @@ -225,7 +225,7 @@ void torpedo(double course, double r, coord in, double *hit, int i, int n) *hit = fabs(*hit); newcnd(); /* we're blown out of dock */ /* We may be displaced. */ - if (game.landed==1 || game.condit==IHDOCKED) return; /* Cheat if on a planet */ + if (game.landed==1 || game.condition==docked) return; /* Cheat if on a planet */ ang = angle + 2.5*(Rand()-0.5); temp = fabs(sin(ang)); if (fabs(cos(ang)) > temp) temp = fabs(cos(ang)); @@ -500,7 +500,7 @@ void attack(bool torps_ok) /* compute hit strength and diminsh shield power */ r = Rand(); /* Increase chance of photon torpedos if docked or enemy energy low */ - if (game.condit == IHDOCKED) r *= 0.25; + if (game.condition == docked) r *= 0.25; if (game.kpower[loop] < 500) r *= 0.25; jay = game.ks[loop]; iquad = game.quad[jay.x][jay.y]; @@ -512,7 +512,7 @@ void attack(bool torps_ok) (iquad==IHQUEST && r > 0.05); if (itflag) { /* Enemy uses phasers */ - if (game.condit == IHDOCKED) continue; /* Don't waste the effort! */ + if (game.condition == docked) continue; /* Don't waste the effort! */ attempt = true; /* Attempt to attack */ dustfac = 0.8+0.05*Rand(); hit = game.kpower[loop]*pow(dustfac,game.kavgd[loop]); @@ -537,9 +537,9 @@ void attack(bool torps_ok) return; /* Supernova or finished */ if (hit == 0) continue; } - if (game.shldup || game.shldchg != 0 || game.condit==IHDOCKED) { + if (game.shldup || game.shldchg != 0 || game.condition==docked) { /* shields will take hits */ - double absorb, hitsh, propor = pfac*game.shield*(game.condit==IHDOCKED ? 2.1 : 1.0); + double absorb, hitsh, propor = pfac*game.shield*(game.condition==docked ? 2.1 : 1.0); if(propor < 0.1) propor = 0.1; hitsh = propor*chgfac*hit+1.0; atackd = true; @@ -547,7 +547,7 @@ void attack(bool torps_ok) if (absorb > game.shield) absorb = game.shield; game.shield -= absorb; hit -= hitsh; - if (game.condit==IHDOCKED) dock(false); + if (game.condition==docked) dock(false); if (propor > 0.1 && hit < 0.005*game.energy) continue; } /* It's a hit -- print out hit size */ @@ -570,7 +570,7 @@ void attack(bool torps_ok) hittot += hit; fry(hit); game.energy -= hit; - if (game.condit==IHDOCKED) + if (game.condition==docked) dock(false); } if (game.energy <= 0) { @@ -578,7 +578,7 @@ void attack(bool torps_ok) finish(FBATTLE); return; } - if (!attempt && game.condit == IHDOCKED) + if (!attempt && game.condition == docked) prout(_("***Enemies decide against attacking your ship.")); if (!atackd) return; percent = 100.0*pfac*game.shield+0.5; @@ -674,7 +674,7 @@ void deadkl(coord w, int type, coord mv) game.state.remtime = game.state.remres/(game.state.remkl + 4*game.state.remcom); - /* Remove enemy ship from arrays describing local game.conditions */ + /* Remove enemy ship from arrays describing local conditions */ if (is_scheduled(FCDBAS) && game.battle.x==game.quadrant.x && game.battle.y==game.quadrant.y && type==IHC) unschedule(FCDBAS); for_local_enemies(i) @@ -818,7 +818,7 @@ void photon(void) /* Loop for moving torpedoes */ osuabor = false; for (i = 1; i <= n && !osuabor; i++) { - if (game.condit != IHDOCKED) game.torps--; + if (game.condition != docked) game.torps--; r = (Rand()+Rand())*0.5 -0.5; if (fabs(r) >= 0.47) { /* misfire! */ @@ -837,7 +837,7 @@ void photon(void) break; } } - if (game.shldup || game.condit == IHDOCKED) + if (game.shldup || game.condition == docked) r *= 1.0 + 0.0001*game.shield; torpedo(course[i], r, game.sector, &dummy, i, n); if (game.alldone || game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova) @@ -917,7 +917,7 @@ void phasers(void) skip(1); /* SR sensors and Computer */ if (damaged(DSRSENS) || damaged(DCOMPTR)) ipoop = false; - if (game.condit == IHDOCKED) { + if (game.condition == docked) { prout(_("Phasers can't be fired through base shields.")); chew(); return; diff --git a/src/events.c b/src/events.c index 20decb9..466867c 100644 --- a/src/events.c +++ b/src/events.c @@ -121,7 +121,7 @@ void events(void) return; } /* Is life support adequate? */ - if (damaged(DLIFSUP) && game.condit != IHDOCKED) { + if (damaged(DLIFSUP) && game.condition != docked) { if (game.lsupres < xtime && game.damage[DLIFSUP] > game.lsupres) { finish(FLIFESUP); return; @@ -131,7 +131,7 @@ void events(void) } /* Fix devices */ repair = xtime; - if (game.condit == IHDOCKED) repair /= game.docfac; + if (game.condition == docked) repair /= game.docfac; /* Don't fix Deathray here */ for (l=0; l 0.0 && l != DDRAY) @@ -162,7 +162,7 @@ void events(void) case FSPY: /* Check with spy to see if S.C. should tractor beam */ if (game.state.nscrem == 0 || ictbeam || istract || - game.condit==IHDOCKED || game.isatb==1 || game.iscate==1) return; + game.condition==docked || game.isatb==1 || game.iscate==1) return; if (game.ientesc || (game.energy < 2000 && game.torps < 4 && game.shield < 1250) || (damaged(DPHASER) && (damaged(DPHOTON) || game.torps < 4)) || @@ -183,7 +183,7 @@ void events(void) } i = Rand()*game.state.remcom+1.0; yank = square(game.state.kcmdr[i].x-game.quadrant.x) + square(game.state.kcmdr[i].y-game.quadrant.y); - if (istract || game.condit == IHDOCKED || yank == 0) { + if (istract || game.condition == docked || yank == 0) { /* Drats! Have to reschedule */ schedule(FTBEAM, game.optime + expran(1.5*game.intime/game.state.remcom)); @@ -284,7 +284,7 @@ void events(void) postpone(FCDBAS, scheduled(FSCDBAS)-game.state.date); game.future[FBATTAK].date = game.future[FCDBAS].date + expran(0.3*game.intime); game.iseenit = false; - if (!damaged(DRADIO) && game.condit != IHDOCKED) + if (!damaged(DRADIO) && game.condition != docked) break; /* No warning :-( */ game.iseenit = true; if (!ipage) pause_game(1); @@ -333,7 +333,7 @@ void events(void) prout(_("Spock- \"Captain, I believe the starbase has been destroyed.\"")); } else if (game.state.rembase != 1 && - (!damaged(DRADIO) || game.condit == IHDOCKED)) { + (!damaged(DRADIO) || game.condition == docked)) { /* Get word via subspace radio */ if (!ipage) pause_game(1); ipage = true; @@ -380,7 +380,7 @@ void events(void) if (!VALID_QUADRANT(i, j) || game.state.galaxy[game.probec.x][game.probec.y].supernova) { // Left galaxy or ran into supernova - if (!damaged(DRADIO) || game.condit == IHDOCKED) { + if (!damaged(DRADIO) || game.condition == docked) { if (ipage==0) pause_game(1); ipage = 1; skip(1); @@ -394,7 +394,7 @@ void events(void) unschedule(FDSPROB); break; } - if (!damaged(DRADIO) || game.condit == IHDOCKED) { + if (!damaged(DRADIO) || game.condition == docked) { if (ipage==0) pause_game(1); ipage = 1; skip(1); @@ -406,7 +406,7 @@ void events(void) pdest = &game.state.galaxy[game.probec.x][game.probec.y]; /* Update star chart if Radio is working or have access to radio. */ - if (!damaged(DRADIO) || game.condit == IHDOCKED) { + if (!damaged(DRADIO) || game.condition == docked) { struct page *chp = &game.state.chart[game.probec.x][game.probec.y]; chp->klingons = pdest->klingons; @@ -450,7 +450,7 @@ void events(void) q->status = distressed; /* tell the captain about it if we can */ - if (!damaged(DRADIO) || game.condit == IHDOCKED) + if (!damaged(DRADIO) || game.condition == docked) { prout("Uhura- Captain, %s in %s reports it is under attack", systemname(q->planet), cramlc(quadrant, w)); @@ -474,7 +474,7 @@ void events(void) ev2->quadrant = ev->quadrant; /* report the disaster if we can */ - if (!damaged(DRADIO) || game.condit == IHDOCKED) + if (!damaged(DRADIO) || game.condition == docked) { prout("Uhura- We've lost contact with starsystem %s", systemname(q->planet)); @@ -527,7 +527,7 @@ void events(void) /* recompute time left */ game.state.remtime = game.state.remres/(game.state.remkl+4*game.state.remcom); /* report the disaster if we can */ - if (!damaged(DRADIO) || game.condit == IHDOCKED) + if (!damaged(DRADIO) || game.condition == docked) { if (same(game.quadrant, w)) { prout("Spock- sensors indicate the Klingons have"); @@ -592,7 +592,7 @@ void wait(void) if (game.alldone) return; delay -= temp; /* Repair Deathray if long rest at starbase */ - if (origTime-delay >= 9.99 && game.condit == IHDOCKED) + if (origTime-delay >= 9.99 && game.condition == docked) game.damage[DDRAY] = 0.0; } while // leave if quadrant supernovas @@ -819,7 +819,7 @@ void snova(bool induced, coord *w) if (!same(nq, game.quadrant) || game.justin) { /* it isn't here, or we just entered (treat as enroute) */ - if (!damaged(DRADIO) || game.condit == IHDOCKED) { + if (!damaged(DRADIO) || game.condition == docked) { skip(1); prout(_("Message from Starfleet Command Stardate %.2f"), game.state.date); prout(_(" Supernova in %s; caution advised."), @@ -906,7 +906,7 @@ void snova(bool induced, coord *w) game.state.nplankl += npdead; } /* mark supernova in galaxy and in star chart */ - if (same(game.quadrant, nq) || !damaged(DRADIO) || game.condit == IHDOCKED) + if (same(game.quadrant, nq) || !damaged(DRADIO) || game.condition == docked) game.state.galaxy[nq.x][nq.y].supernova = true; /* If supernova destroys last Klingons give special message */ if (KLINGREM==0 && !same(nq, game.quadrant)) { diff --git a/src/io.c b/src/io.c index b60fec5..74b3fce 100644 --- a/src/io.c +++ b/src/io.c @@ -397,7 +397,7 @@ void tracktorpedo(coord w, int l, int i, int n, int iquad) skip(1); proutn("%d - %d ", w.x, w.y); } else { - if (!damaged(DSRSENS) || game.condit==IHDOCKED) { + if (!damaged(DSRSENS) || game.condition==docked) { if (i != 1 && l == 1) { drawmaps(2); delay(400); diff --git a/src/moving.c b/src/moving.c index e7e90af..3ed56a4 100644 --- a/src/moving.c +++ b/src/moving.c @@ -33,7 +33,7 @@ void imove(void) /* If tractor beam is to occur, don't move full distance */ if (game.state.date+game.optime >= scheduled(FTBEAM)) { trbeam = true; - game.condit = IHRED; + game.condition = red; game.dist = game.dist*(scheduled(FTBEAM)-game.state.date)/game.optime + 0.1; game.optime = scheduled(FTBEAM) - game.state.date + 1e-5; } @@ -57,7 +57,7 @@ void imove(void) game.kavgd[m] = 0.5 * (finald + game.kdist[m]); } /* - * Stas Sergeev added the game.condition + * Stas Sergeev added the condition * that attacks only happen if Klingons * are present and your skill is good. */ @@ -211,7 +211,7 @@ void dock(bool verbose) /* dock our ship at a starbase */ { chew(); - if (game.condit == IHDOCKED && verbose) { + if (game.condition == docked && verbose) { prout(_("Already docked.")); return; } @@ -224,7 +224,7 @@ void dock(bool verbose) prout(_(" not adjacent to base.")); return; } - game.condit = IHDOCKED; + game.condition = docked; if (verbose) prout(_("Docked.")); game.ididit = true; if (game.energy < game.inenrg) game.energy = game.inenrg; @@ -857,7 +857,7 @@ void probe(void) if (is_scheduled(FDSPROB)) { chew(); skip(1); - if (damaged(DRADIO) && game.condit != IHDOCKED) { + if (damaged(DRADIO) && game.condition != docked) { prout(_("Spock- \"Records show the previous probe has not yet")); prout(_(" reached its destination.\"")); } @@ -914,8 +914,8 @@ void mayday(void) int line = 0, m, ix, iy; chew(); - /* Test for game.conditions which prevent calling for help */ - if (game.condit == IHDOCKED) { + /* Test for conditions which prevent calling for help */ + if (game.condition == docked) { prout(_("Lt. Uhura- \"But Captain, we're already docked.\"")); return; } diff --git a/src/planets.c b/src/planets.c index 52bc32d..1589a86 100644 --- a/src/planets.c +++ b/src/planets.c @@ -235,7 +235,7 @@ void usecrystals(void) } if (game.energy >= 1000) { prout(_("Spock- \"Captain, Starfleet Regulations prohibit such an operation")); - prout(_(" except when condition Yellow exists.")); + prout(_(" except when Condition Yellow exists.")); return; } prout(_("Spock- \"Captain, I must warn you that loading")); @@ -306,7 +306,7 @@ void shuttle(void) prout(_("You will have to beam down to retrieve the shuttle craft.")); return; } - if (game.shldup || game.condit == IHDOCKED) { + if (game.shldup || game.condition == docked) { prout(_("Shuttle craft cannot pass through shields.")); return; } diff --git a/src/reports.c b/src/reports.c index ac41cd8..6120d02 100644 --- a/src/reports.c +++ b/src/reports.c @@ -71,7 +71,7 @@ void report(void) prout(_(" destroyed, %d remaining."), game.state.rembase); } else prout(_("There are %d bases."), game.inbase); - if (!damaged(DRADIO) || game.condit == IHDOCKED || game.iseenit) { + if (!damaged(DRADIO) || game.condition == docked || game.iseenit) { /* Don't report this if not seen and either the radio is dead or not at base! */ attakreport(false); @@ -89,7 +89,7 @@ void report(void) if (game.nprobes!=1) proutn(_("s")); prout("."); } - if ((!damaged(DRADIO) || game.condit == IHDOCKED) + if ((!damaged(DRADIO) || game.condition == docked) && is_scheduled(FDSPROB)) { if (game.isarmed) proutn(_("An armed deep space probe is in")); @@ -122,7 +122,7 @@ void lrscan(void) chew(); if (damaged(DLRSENS)) { /* Now allow base's sensors if docked */ - if (game.condit != IHDOCKED) { + if (game.condition != docked) { prout(_("LONG-RANGE SENSORS DAMAGED.")); return; } @@ -198,7 +198,7 @@ void chart(bool title) if (!damaged(DRADIO)) rechart(); - if (game.lastchart < game.state.date && game.condit == IHDOCKED) { + if (game.lastchart < game.state.date && game.condition == docked) { prout(_("Spock- \"I revised the Star Chart from the starbase's records.\"")); rechart(); } @@ -241,12 +241,12 @@ static void sectscan(int goodScan, int i, int j) { if (goodScan || (abs(i-game.sector.x)<= 1 && abs(j-game.sector.y) <= 1)){ if ((game.quad[i][j]==IHMATER0)||(game.quad[i][j]==IHMATER1)||(game.quad[i][j]==IHMATER2)||(game.quad[i][j]==IHE)||(game.quad[i][j]==IHF)){ - switch (game.condit) { - case IHRED: textcolor(RED); break; - case IHGREEN: textcolor(GREEN); break; - case IHYELLOW: textcolor(YELLOW); break; - case IHDOCKED: textcolor(CYAN); break; - case IHDEAD: textcolor(BROWN); + switch (game.condition) { + case red: textcolor(RED); break; + case green: textcolor(GREEN); break; + case yellow: textcolor(YELLOW); break; + case docked: textcolor(CYAN); break; + case dead: textcolor(BROWN); } if (game.quad[i][j] != game.ship) highvideo(); @@ -268,13 +268,13 @@ static void status(int req) proutn(_("Stardate %.1f, Time Left %.2f"), game.state.date, game.state.remtime); break; case 2: - if (game.condit != IHDOCKED) newcnd(); - switch (game.condit) { - case IHRED: cp = "RED"; break; - case IHGREEN: cp = "GREEN"; break; - case IHYELLOW: cp = "YELLOW"; break; - case IHDOCKED: cp = "DOCKED"; break; - case IHDEAD: cp="DEAD"; break; + if (game.condition != docked) newcnd(); + switch (game.condition) { + case red: cp = "RED"; break; + case green: cp = "GREEN"; break; + case yellow: cp = "YELLOW"; break; + case docked: cp = "DOCKED"; break; + case dead: cp="DEAD"; break; } for (t=0;t0) @@ -288,7 +288,7 @@ static void status(int req) case 4: proutn(_("Life Support ")); if (damaged(DLIFSUP)) { - if (game.condit == IHDOCKED) + if (game.condition == docked) proutn(_("DAMAGED, Base provides")); else proutn(_("DAMAGED, reserves=%4.2f"), game.lsupres); @@ -350,7 +350,7 @@ int srscan(int l) case SCAN_FULL: // SRSCAN if (damaged(DSRSENS)) { /* Allow base's sensors if docked */ - if (game.condit != IHDOCKED) { + if (game.condition != docked) { prout(_(" S.R. SENSORS DAMAGED!")); goodScan=false; } @@ -393,7 +393,7 @@ int srscan(int l) leftside=false; break; } - if (game.condit != IHDOCKED) newcnd(); + if (game.condition != docked) newcnd(); for (i = 1; i <= max(QUADSIZE, sizeof(requests)/sizeof(requests[0])); i++) { jj = (req!=0 ? req : i); if (leftside && i <= QUADSIZE) { diff --git a/src/setup.c b/src/setup.c index aa55bbe..5912f1d 100644 --- a/src/setup.c +++ b/src/setup.c @@ -121,7 +121,7 @@ void abandn(void) struct quadrant *q; chew(); - if (game.condit==IHDOCKED) { + if (game.condition==docked) { if (game.ship!=IHE) { prout("You cannot abandon Ye Faerie Queene."); return; @@ -213,7 +213,7 @@ void abandn(void) game.imine = false; game.iscraft=0; /* Galileo disappears */ /* Resupply ship */ - game.condit=IHDOCKED; + game.condition=docked; for (l = 0; l < NDEVICES; l++) game.damage[l] = 0.0; game.damage[DSHUTTL] = -1; @@ -579,11 +579,11 @@ coord dropin(int iquad) void newcnd(void) /* update our alert status */ { - game.condit = IHGREEN; - if (game.energy < 1000.0) game.condit = IHYELLOW; + game.condition = green; + if (game.energy < 1000.0) game.condition = yellow; if (game.state.galaxy[game.quadrant.x][game.quadrant.y].klingons || game.state.galaxy[game.quadrant.x][game.quadrant.y].romulans) - game.condit = IHRED; - if (!game.alive) game.condit=IHDEAD; + game.condition = red; + if (!game.alive) game.condition=dead; } coord newkling(int i) @@ -684,7 +684,7 @@ void newqad(bool shutup) else game.plnet = dropin(IHW); } - // Check for game.condition + // Check for condition newcnd(); // And finally the stars for (i = 1; i <= q->stars; i++) diff --git a/src/sst.h b/src/sst.h index 211f63c..18baff6 100644 --- a/src/sst.h +++ b/src/sst.h @@ -226,6 +226,13 @@ struct game { icrystl, // dilithium crystals aboard iseenit, // seen base attack report thawed; // thawed game + enum { + green = 'G', + yellow = 'Y', + red = 'R', + docked = 'D', + dead = 'Z', + } condition; // condition (red/yellow/green/docked) int inkling, // initial number of klingons inbase, // initial number of bases incom, // initial number of commanders @@ -233,7 +240,6 @@ struct game { inrom, // initial number of commanders instar, // initial stars intorps, // initial/Max torpedoes - condit, // condition (red/yellow/green/docked) torps, // number of torpedoes ship, // ship type -- 'E' is Enterprise abandoned, // count of crew abandoned in space @@ -318,16 +324,10 @@ enum loctype {neither, quadrant, sector}; #define IHF 'F' #define IHT 'T' #define IHWEB '#' -#define IHGREEN 'G' -#define IHYELLOW 'Y' -#define IHRED 'R' -#define IHDOCKED 'D' -#define IHDEAD 'Z' #define IHMATER0 '-' #define IHMATER1 'o' #define IHMATER2 '0' - /* Function prototypes */ void prelim(void); void attack(bool); -- 2.31.1