X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=src%2Fevents.c;h=072c2e6d95a2b39e56b58caf8dc466fedbe6bc91;hp=3a93a84cf0320c7c85d062e79e80624efb959084;hb=cbb2d987e8c23c6c25bd441fdef5401d5a89289e;hpb=9ae916e9144e84ef1de4a86ea73a45a2bc4cc1be diff --git a/src/events.c b/src/events.c index 3a93a84..072c2e6 100644 --- a/src/events.c +++ b/src/events.c @@ -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; @@ -645,7 +635,7 @@ void nova(coord nov) if (Rand() < 0.05) { /* Wow! We've supernova'ed */ - snova(false, &nov); + supernova(false, &nov); return; } @@ -684,7 +674,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 +691,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 +814,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 +832,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 +922,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 */