Get rid of some macros that block mechanical translation.
authorEric S. Raymond <esr@thyrsus.com>
Sat, 30 Sep 2006 09:00:49 +0000 (09:00 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Sat, 30 Sep 2006 09:00:49 +0000 (09:00 +0000)
src/ai.c
src/battle.c
src/events.c
src/finish.c
src/moving.c
src/planets.c
src/reports.c
src/setup.c
src/sst.h

index 31d19ad13bdcf06293ab473679a9abfc09a817a5..e0bfb08ad50cfce872446ef883a982a1faa579e1 100644 (file)
--- a/src/ai.c
+++ b/src/ai.c
@@ -389,7 +389,7 @@ void supercommander(void)
        prout("== SUPERCOMMANDER");
 
     /* Decide on being active or passive */
-    avoid = ((NKILLC+NKILLK)/(game.state.date+0.01-game.indate) < 0.1*game.skill*(game.skill+1.0) ||
+    avoid = ((game.incom - game.state.remcom + game.inkling - game.state.remkl)/(game.state.date+0.01-game.indate) < 0.1*game.skill*(game.skill+1.0) ||
            (game.state.date-game.indate) < 3.0);
     if (!game.iscate && avoid) {
        /* compute move away from Enterprise */
index d9e815436c0fa415b1e7bd9df81287c5575c5919..7068553602ed88833a498e3fd0a89af1aa886aa2 100644 (file)
@@ -239,7 +239,7 @@ void ram(bool ibumpd, feature ienm, coord w)
     }
     game.shldup = false;
     prout(_("***Shields are down."));
-    if (KLINGREM) {
+    if (game.state.remkl + game.state.remcom + game.state.nscrem) {
        pause_game(true);
        damagereport();
     }
@@ -639,7 +639,7 @@ void attack(bool torps_ok)
            r = (Rand()+Rand())*0.5 -0.5;
            r += 0.002*game.kpower[loop]*r;
            torpedo(course, r, jay, &hit, 1, 1);
-           if (KLINGREM==0) 
+           if ((game.state.remkl + game.state.remcom + game.state.nscrem)==0) 
                finish(FWON); /* Klingons did themselves in! */
            if (game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova || game.alldone) 
                return; /* Supernova or finished */
@@ -789,7 +789,7 @@ void deadkl(coord w, feature type, coord mv)
     /* For each kind of enemy, finish message to player */
     prout(_(" destroyed."));
     game.quad[w.x][w.y] = IHDOT;
-    if (KLINGREM==0)
+    if ((game.state.remkl + game.state.remcom + game.state.nscrem)==0)
        return;
 
     game.state.remtime = game.state.remres/(game.state.remkl + 4*game.state.remcom);
@@ -966,7 +966,7 @@ void photon(void)
        if (game.alldone || game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova)
            return;
     }
-    if (KLINGREM==0)
+    if ((game.state.remkl + game.state.remcom + game.state.nscrem)==0)
        finish(FWON);
 }
 
@@ -1368,7 +1368,7 @@ void hittem(double *hits)
        skip(1);
        if (kpow == 0) {
            deadkl(w, ienm, w);
-           if (KLINGREM==0)
+           if ((game.state.remkl + game.state.remcom + game.state.nscrem)==0)
                finish(FWON);           
            if (game.alldone)
                return;
index b4b61214b14cecd18efcb09c2c836c9b7c9aa153..99ac229b44f074e4982b2b9b66f34083aa4a17ee 100644 (file)
@@ -943,7 +943,7 @@ void supernova(bool induced, coord *w)
     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)) {
+    if ((game.state.remkl + game.state.remcom + game.state.nscrem)==0 && !same(nq, game.quadrant)) {
        skip(2);
        if (!induced)
            prout(_("Lucky you!"));
index c59bd8ea6069fea478c4fa1e52b20a6596ce2618..42333d5fdad2d6040ebe2ed6c12c27d4e0aaaadb 100644 (file)
@@ -100,7 +100,7 @@ void finish(FINTYPE ifin)
                badpt = 0.0;    // Close enough!
            if (game.state.date-game.indate < 5.0 ||
                // killsPerDate >= RateMax
-               KLINGKILLED/(game.state.date-game.indate) >=
+               ((game.inkling + game.incom + game.inscom) - (game.state.remkl + game.state.remcom + game.state.nscrem))/(game.state.date-game.indate) >=
                0.1*game.skill*(game.skill+1.0) + 0.1 + 0.008*badpt) {
                skip(1);
                prout(_("In fact, you have done so well that Starfleet Command"));
@@ -166,7 +166,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 (KLINGREM*3.0 > INKLINGTOT) {
+       if ((game.state.remkl + game.state.remcom + game.state.nscrem)*3.0 > (game.inkling + game.incom + game.inscom)) {
            prout(_("acquitted."));
            skip(1);
            prout(_("LIVE LONG AND PROSPER."));
@@ -296,7 +296,7 @@ void finish(FINTYPE ifin)
     else if (game.ship == IHE)
        game.ship = IHF;
     game.alive = false;
-    if (KLINGREM != 0) {
+    if ((game.state.remkl + game.state.remcom + game.state.nscrem) != 0) {
        double goodies = game.state.remres/game.inresor;
        double baddies = (game.state.remkl + 2.0*game.state.remcom)/(game.inkling+2.0*game.incom);
        if (goodies/baddies >= 1.0+0.5*Rand()) {
@@ -330,9 +330,9 @@ void score(void)
     int ithperd, iwon, klship;
 
     iskill = game.skill;
-    if ((timused == 0 || KLINGREM != 0) && timused < 5.0)
+    if ((timused == 0 || (game.state.remkl + game.state.remcom + game.state.nscrem) != 0) && timused < 5.0)
        timused = 5.0;
-    perdate = KLINGKILLED/timused;
+    perdate = ((game.inkling + game.incom + game.inscom) - (game.state.remkl + game.state.remcom + game.state.nscrem))/timused;
     ithperd = 500*perdate + 0.5;
     iwon = 0;
     if (game.gamewon)
@@ -345,28 +345,28 @@ void score(void)
        klship = 2;
     if (!game.gamewon)
        game.state.nromrem = 0; // None captured if no win
-    iscore = 10*NKILLK + 50*NKILLC + ithperd + iwon
+    iscore = 10*(game.inkling - game.state.remkl) + 50*(game.incom - game.state.remcom) + ithperd + iwon
        - 100*game.state.basekl - 100*klship - 45*game.nhelp -5*game.state.starkl - game.casual
-       + 20*NKILLROM + 200*NKILLSC - 10*game.state.nplankl - 300*game.state.nworldkl + game.state.nromrem;
+       + 20*(game.inrom - game.state.nromrem) + 200*(game.inscom - game.state.nscrem) - 10*game.state.nplankl - 300*game.state.nworldkl + game.state.nromrem;
     if (!game.alive)
        iscore -= 200;
     skip(2);
     prout(_("Your score --"));
-    if (NKILLROM)
+    if (game.inrom - game.state.nromrem)
        prout(_("%6d Romulans destroyed                 %5d"),
-             NKILLROM,20*NKILLROM);
+             game.inrom - game.state.nromrem, 20*(game.inrom - game.state.nromrem));
     if (game.state.nromrem)
        prout(_("%6d Romulans captured                  %5d"),
              game.state.nromrem, game.state.nromrem);
-    if (NKILLK)
+    if (game.inkling - game.state.remkl)
        prout(_("%6d ordinary Klingons destroyed        %5d"),
-             NKILLK, 10*NKILLK);
-    if (NKILLC)
+             game.inkling - game.state.remkl, 10*(game.inkling - game.state.remkl));
+    if (game.incom - game.state.remcom)
        prout(_("%6d Klingon commanders destroyed       %5d"),
-             NKILLC, 50*NKILLC);
-    if (NKILLSC)
+             game.incom - game.state.remcom, 50*(game.incom - game.state.remcom));
+    if (game.inscom - game.state.nscrem)
        prout(_("%6d Super-Commander destroyed          %5d"),
-             NKILLSC, 200*NKILLSC);
+             game.inscom - game.state.nscrem, 200*(game.inscom - game.state.nscrem));
     if (ithperd)
        prout(_("%6.2f Klingons per stardate              %5d"),
              perdate, ithperd);
index 63a51c7e485dd2f9519fe9960e1916f0fed48735..d21ab179461d4af2a79f0bf6c5c51b6a415e001d 100644 (file)
@@ -793,7 +793,7 @@ void atover(bool igrab)
     } while 
        /* Repeat if another snova */
        (game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova);
-    if (KLINGREM==0) 
+    if ((game.state.remkl + game.state.remcom + game.state.nscrem)==0) 
        finish(FWON); /* Snova killed remaining enemy. */
 }
 
index 8aba37c3f07288916d68f16720169a55c591169f..f91a7d6e84516abc4802af642b4f8dadde0921c2 100644 (file)
@@ -450,7 +450,7 @@ void deathray(void)
        while (game.nenhere > 0)
            deadkl(game.ks[1], game.quad[game.ks[1].x][game.ks[1].y],game.ks[1]);
        prout(_("Ensign Chekov-  \"Congratulations, Captain!\""));
-       if (KLINGREM == 0)
+       if ((game.state.remkl + game.state.remcom + game.state.nscrem) == 0)
            finish(FWON);    
        if ((game.options & OPTION_PLAIN) == 0) {
            prout(_("Spock-  \"Captain, I believe the `Experimental Death Ray'"));
index 3c672186f7d6a9aeb9deec00d80312b05c9fdb7d..a0d9bbc26c47fb58c28e02dc29a2928aeae56821 100644 (file)
@@ -60,10 +60,12 @@ void report(void)
     if (game.tourn)
        prout(_("This is tournament game %d."), game.tourn);
     prout(_("Your secret password is \"%s\""),game.passwd);
-    proutn(_("%d of %d Klingons have been killed"), KLINGKILLED, INKLINGTOT);
-    if (NKILLC)
-       prout(_(", including %d Commander%s."), NKILLC, NKILLC==1?"":_("s"));
-    else if (NKILLK + NKILLSC > 0)
+    proutn(_("%d of %d Klingons have been killed"), 
+          ((game.inkling + game.incom + game.inscom) - (game.state.remkl + game.state.remcom + game.state.nscrem)), 
+          (game.inkling + game.incom + game.inscom));
+    if (game.incom - game.state.remcom)
+       prout(_(", including %d Commander%s."), game.incom - game.state.remcom, (game.incom - game.state.remcom)==1?"":_("s"));
+    else if (game.inkling - game.state.remkl + (game.inscom - game.state.nscrem) > 0)
        prout(_(", but no Commanders."));
     else
        prout(".");
@@ -344,7 +346,7 @@ void status(int req)
     );
 
     RQ(9,
-        prstat(_("Klingons Left"), "%d", KLINGREM);
+        prstat(_("Klingons Left"), "%d", game.state.remkl + game.state.remcom + game.state.nscrem);
     );
 
     RQ(10,
index c8112e0ff17a2beffdd71e61e83e7a06b9cb1469..9edd85cfbcdc41bef81552c5e9d783d556388b7f 100644 (file)
@@ -379,7 +379,7 @@ void setup(bool needprompt)
        prout(_("a deadly Klingon invasion force. As captain of the United"));
        prout(_("Starship U.S.S. Enterprise, it is your mission to seek out"));
        prout(_("and destroy this invasion force of %d battle cruisers."),
-             INKLINGTOT);
+             (game.inkling + game.incom + game.inscom));
        prout(_("You have an initial allotment of %d stardates to complete"), (int)game.intime);
        prout(_("your mission.  As you proceed you may be given more time."));
        skip(1);
@@ -389,7 +389,7 @@ void setup(bool needprompt)
     else {
        prout(_("Stardate %d."), (int)game.state.date);
        skip(1);
-       prout(_("%d Klingons."), INKLINGTOT);
+       prout(_("%d Klingons."), game.inkling + game.incom + game.inscom);
        prout(_("An unknown number of Romulans."));
        if (game.state.nscrem)
            prout(_("And one (GULP) Super-Commander."));
index 7389c5de3aecd4a0c3636b88c172849e9a4d9ea1..064687a6347f7855b70ea3300edec48c818a3b0a 100644 (file)
--- a/src/sst.h
+++ b/src/sst.h
@@ -113,14 +113,6 @@ typedef struct {
     } chart[GALSIZE+1][GALSIZE+1];     // the starchart (subscript 0 not used)
 } snapshot;                            // Data that is snapshot
 
-#define NKILLK (game.inkling - game.state.remkl)
-#define NKILLC (game.incom - game.state.remcom)
-#define NKILLSC (game.inscom - game.state.nscrem)
-#define NKILLROM (game.inrom - game.state.nromrem)
-#define KLINGREM (game.state.remkl + game.state.remcom + game.state.nscrem)
-#define INKLINGTOT (game.inkling + game.incom + game.inscom)
-#define KLINGKILLED (INKLINGTOT - KLINGREM)
-
 /* game options */
 #define OPTION_ALL     0xffffffff
 #define OPTION_TTY     0x00000001      /* old interface */