Hack boxed xcomments so they're easier for a mechanical translator to recognize.
[super-star-trek.git] / src / events.c
index 3a93a84cf0320c7c85d062e79e80624efb959084..7e5c411d511013cff951cdebd9ab2d4fc50139ef 100644 (file)
@@ -62,11 +62,13 @@ void events(void)
 {
     int evcode, i=0, j, k, l;
     double fintim = game.state.date + game.optime, datemin, xtime, repair, yank=0;
-    bool radio_was_broken, ictbeam = false, ipage = false, istract = false;
+    bool radio_was_broken, ictbeam = false, istract = false;
     struct quadrant *pdest, *q;
     coord w, hold;
     event *ev, *ev2;
 
+    pause_reset();
+
     if (idebug) {
        prout("=== EVENTS from %.2f to %.2f:", game.state.date, fintim);
        for (i = 1; i < NEVENTS; i++) {
@@ -145,7 +147,7 @@ void events(void)
            prout(_("   surveillance reports are coming in."));
            skip(1);
            if (!game.iseenit) {
-               attakreport(false);
+               attackreport(false);
                game.iseenit = true;
            }
            rechart();
@@ -156,10 +158,8 @@ void events(void)
        game.optime -= xtime;
        switch (evcode) {
        case FSNOVA: /* Supernova */
-           if (!ipage)
-               pause_game(true);
-           ipage=true;
-           snova(false, NULL);
+           pause_game(true);
+           supernova(false, NULL);
            schedule(FSNOVA, expran(0.5*game.intime));
            if (game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova)
                return;
@@ -198,9 +198,7 @@ void events(void)
            }
            /* tractor beaming cases merge here */
            yank = sqrt(yank);
-           if (!ipage)
-               pause_game(true);
-           ipage=true;
+           pause_game(true);
            game.optime = (10.0/(7.5*7.5))*yank; /* 7.5 is yank rate (warp 7.5) */
            ictbeam = true;
            skip(1);
@@ -299,9 +297,7 @@ void events(void)
            if (!damaged(DRADIO) && game.condition != docked) 
                break; /* No warning :-( */
            game.iseenit = true;
-           if (!ipage)
-               pause_game(true);
-           ipage = true;
+           pause_game(true);
            skip(1);
            proutn(_("Lt. Uhura-  \"Captain, the starbase in "));
            prout(cramlc(quadrant, game.battle));
@@ -348,9 +344,7 @@ void events(void)
            else if (game.state.rembase != 1 &&
                     (!damaged(DRADIO) || game.condition == docked)) {
                /* Get word via subspace radio */
-               if (!ipage)
-                   pause_game(true);               
-               ipage = true;
+               pause_game(true);                   
                skip(1);
                prout(_("Lt. Uhura-  \"Captain, Starfleet Command reports that"));
                proutn(_("   the starbase in "));
@@ -380,7 +374,7 @@ void events(void)
            schedule(FSCMOVE, 0.2777);
            if (!game.ientesc && !istract && game.isatb != 1 &&
                        (!game.iscate || !game.justin)) 
-               scom(&ipage);
+               supercommander();
            break;
        case FDSPROB: /* Move deep space probe */
            schedule(FDSPROB, 0.01);
@@ -395,9 +389,7 @@ void events(void)
                    game.state.galaxy[game.probec.x][game.probec.y].supernova) {
                    // Left galaxy or ran into supernova
                    if (!damaged(DRADIO) || game.condition == docked) {
-                       if (!ipage)
-                           pause_game(true);
-                       ipage = true;
+                       pause_game(true);
                        skip(1);
                        proutn(_("Lt. Uhura-  \"The deep space probe "));
                        if (!VALID_QUADRANT(j, i))
@@ -410,9 +402,7 @@ void events(void)
                    break;
                }
                if (!damaged(DRADIO) || game.condition == docked) {
-                   if (!ipage)
-                       pause_game(true);
-                   ipage = true;
+                   pause_game(true);
                    skip(1);
                    proutn(_("Lt. Uhura-  \"The deep space probe is now in "));
                    proutn(cramlc(quadrant, game.probec));
@@ -433,7 +423,7 @@ void events(void)
            game.proben--; // One less to travel
            if (game.proben == 0 && game.isarmed && pdest->stars) {
                /* lets blow the sucker! */
-               snova(true, &game.probec);
+               supernova(true, &game.probec);
                unschedule(FDSPROB);
                if (game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova) 
                    return;
@@ -444,10 +434,10 @@ void events(void)
            /* try a whole bunch of times to find something suitable */
            i = 100;
            do {
-               /* need a quadrant which is not the current one,
-                  which has some stars which are inhabited and
-                  not already under attack, which is not
-                  supernova'ed, and which has some Klingons in it */
+               // need a quadrant which is not the current one,
+               // which has some stars which are inhabited and
+               // not already under attack, which is not
+               // supernova'ed, and which has some Klingons in it
                w = randplace(GALSIZE);
                q = &game.state.galaxy[w.x][w.y];
            } while (--i &&
@@ -498,10 +488,8 @@ void events(void)
            }
            break;
        case FREPRO:            /* Klingon reproduces */
-           /*
-            * If we ever switch to a real event queue, we'll need to
-            * explicitly retrieve and restore the x and y.
-            */
+           // If we ever switch to a real event queue, we'll need to
+           // explicitly retrieve and restore the x and y.
            ev = schedule(FREPRO, expran(1.0 * game.intime));
            /* see if current distress call still active */
            q = &game.state.galaxy[ev->quadrant.x][ev->quadrant.y];
@@ -645,7 +633,7 @@ void nova(coord nov)
 
     if (Rand() < 0.05) {
        /* Wow! We've supernova'ed */
-       snova(false, &nov);
+       supernova(false, &nov);
        return;
     }
 
@@ -684,7 +672,7 @@ void nova(coord nov)
                    case IHSTAR: /* Affect another star */
                        if (Rand() < 0.05) {
                            /* This star supernovas */
-                           snova(false, &scratch);
+                           supernova(false, &scratch);
                            return;
                        }
                        top2++;
@@ -701,7 +689,7 @@ void nova(coord nov)
                        game.state.nplankl++;
                        crmena(true, IHP, sector, scratch);
                        prout(_(" destroyed."));
-                       DESTROY(&game.state.plnets[game.iplnet]);
+                       DESTROY(&game.state.planets[game.iplnet]);
                        game.iplnet = 0;
                        invalidate(game.plnet);
                        if (game.landed) {
@@ -824,7 +812,7 @@ void nova(coord nov)
 }
        
        
-void snova(bool induced, coord *w) 
+void supernova(bool induced, coord *w) 
 /* star goes supernova */
 {
     int num = 0, nrmdead, npdead, kldead;
@@ -842,7 +830,8 @@ void snova(bool induced, coord *w)
                stars += game.state.galaxy[nq.x][nq.y].stars;
            }
        }
-       if (stars == 0) return; /* nothing to supernova exists */
+       if (stars == 0)
+           return; /* nothing to supernova exists */
        num = Rand()*stars + 1;
        for_quadrants(nq.x) {
            for_quadrants(nq.y) {
@@ -931,8 +920,8 @@ void snova(bool induced, coord *w)
     if (npdead) {
        int loop;
        for (loop = 0; loop < game.inplan; loop++)
-           if (same(game.state.plnets[loop].w, nq)) {
-               DESTROY(&game.state.plnets[loop]);
+           if (same(game.state.planets[loop].w, nq)) {
+               DESTROY(&game.state.planets[loop]);
            }
     }
     /* Destroy any base in supernovaed quadrant */