X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=planets.c;h=a45879f05c8adf225ea236fec6150810117b8eb2;hp=a98235ffa1f8934f72090c0aa1cdf0c0f993302f;hb=2a0411c349010501abd2f907b8965a8ca9b4e80c;hpb=02f05de93d48d0147cfffbb8e55ca7776ca09797 diff --git a/planets.c b/planets.c index a98235f..a45879f 100644 --- a/planets.c +++ b/planets.c @@ -1,8 +1,9 @@ #include "sst.h" -static char classes[4][2]={"","M","N","O"}; static int height; +static char *classes[] = {"M","N","O"}; + static int consumeTime(void) { /* I think most of this avoidance was caused by overlay scheme. Let's see what happens if all events can occur here */ @@ -31,7 +32,7 @@ void preport(void) { chew(); prout("Spock- \"Planet report follows, Captain.\""); skip(1); - for (i = 1; i <= inplan; i++) { + for (i = 0; i < inplan; i++) { if (game.state.plnets[i].known != unknown #ifdef DEBUG || ( idebug && game.state.plnets[i].x !=0) @@ -41,7 +42,7 @@ void preport(void) { #ifdef DEBUG if (idebug && game.state.plnets[i].known==unknown) proutn("(Unknown) "); #endif - cramlc(1, game.state.plnets[i].x, game.state.plnets[i].y); + proutn(cramlc(quadrant, game.state.plnets[i].x, game.state.plnets[i].y)); proutn(" class "); proutn(classes[game.state.plnets[i].pclass]); proutn(" "); @@ -77,9 +78,8 @@ void orbit(void) { prout("Helmsman Sulu- \"Entering standard orbit, Sir.\""); newcnd(); if (consumeTime()) return; - proutn("Sulu- \"Entered orbit at altitude "); - cramf(height = (1400.+7200.*Rand()), 0, 2); - prout(" kilometers.\""); + height = (1400.+7200.*Rand()); + prout("Sulu- \"Entered orbit at altitude %.2f kilometers.\"", height); inorbit = 1; return; } @@ -95,15 +95,11 @@ void sensor(void) { prout("No planet in this quadrant."); return; } - proutn("Spock- \"Sensor scan for"); - cramlc(1, quadx, quady); - prout("-"); + prout("Spock- \"Sensor scan for %s-", cramlc(quadrant, quadx, quady)); skip(1); - proutn(" Planet at"); - cramlc(2, plnetx, plnety); - proutn(" is of class "); - proutn(classes[game.state.plnets[iplnet].pclass]); - prout("."); + prout(" Planet at %s is of class %s.", + cramlc(sector, plnetx, plnety), + classes[game.state.plnets[iplnet].pclass]); if (game.state.plnets[iplnet].known==shuttle_down) prout(" Sensors show Galileo still on surface."); proutn(" Readings indicate"); @@ -323,9 +319,8 @@ void shuttle(void) { Time = 3.0e-5*height; if (Time >= 0.8*game.state.remtime) { prout("First Officer Spock- \"Captain, I compute that such"); - prout(" a maneuver would require approximately "); - cramf(100*Time/game.state.remtime,0,4); - prout("% of our"); + proutn(" a maneuver would require approximately 2d%% of our", + (int)(100*Time/game.state.remtime)); prout("remaining time."); prout("Are you sure this is wise?\" "); if (ja()==0) { @@ -445,7 +440,7 @@ void deathray(void) { prout(" is still operational.\""); } else { - prout(" has been rendered disfunctional.\""); + prout(" has been rendered nonfunctional.\""); game.damage[DDRAY] = 39.95; } return;