X-Git-Url: https://jxself.org/git/?p=super-star-trek.git;a=blobdiff_plain;f=src%2Fsst.c;h=64dcd3d0c1b093a7f593173c558d0adf723d8f34;hp=a0d732d31fe5674c79b6e52063016ae028822b1e;hb=fcc0982757ef9c87939a9bff808e93064a28f688;hpb=9ae916e9144e84ef1de4a86ea73a45a2bc4cc1be diff --git a/src/sst.c b/src/sst.c index a0d732d..64dcd3d 100644 --- a/src/sst.c +++ b/src/sst.c @@ -189,7 +189,7 @@ int seed; // the random-number seed bool idebug; // debug mode FILE *logfp, *replayfp; -char *systnames[NINHAB + 1]; +char *systnames[NINHAB]; char *device[NDEVICES]; static struct @@ -276,7 +276,7 @@ commands[] = { {"HELP", HELP, 0}, #define SEED 37 {"SEED", SEED, 0}, -#if BSD_BUG_FOR_BUG +#ifdef BSD_BUG_FOR_BUG #define VISUAL 38 {"VISUAL", VISUAL, 0}, #endif @@ -472,13 +472,13 @@ static void makemoves(void) attack(false); break; case DAMAGES: // damages - dreprt(); + damagereport(); break; case CHART: // chart makechart(); break; case IMPULSE: // impulse - impuls(); + impulse(); break; case REST: // rest wait(); @@ -486,7 +486,7 @@ static void makemoves(void) hitme = true; break; case WARP: // warp - setwrp(); + setwarp(); break; case SCORE: // score score(); @@ -518,7 +518,7 @@ static void makemoves(void) hitme = true; break; case PLANETS: // Planet list - preport(); + survey(); break; case REPORT: // Game Report report(); @@ -540,7 +540,7 @@ static void makemoves(void) hitme = true; break; case ABANDON: // Abandon Ship - abandn(); + abandon(); break; case DESTRUCT: // Self Destruct selfdestruct(); @@ -575,7 +575,7 @@ static void makemoves(void) if (key == IHREAL) seed = (int)aaitem; break; -#if BSD_BUG_FOR_BUG +#ifdef BSD_BUG_FOR_BUG case VISUAL: visual(); // perform visual scan break; @@ -583,10 +583,12 @@ static void makemoves(void) } commandhook(commands[i].name, false); for (;;) { - if (game.alldone) break; // Game has ended + if (game.alldone) + break; // Game has ended if (game.optime != 0.0) { events(); - if (game.alldone) break; // Events did us in + if (game.alldone) + break; // Events did us in } if (game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova) { // Galaxy went Nova! atover(false); @@ -824,19 +826,12 @@ int scan(void) chew(); return IHEOL; } - if (isdigit(*linep) || *linep=='+' || *linep=='-' || *linep=='.') { - // treat as a number - i = 0; - if (sscanf(linep, "%lf%n", &aaitem, &i) < 1) { - linep = line; // Invalid numbers are ignored - *linep = 0; - return IHEOL; - } - else { - // skip to end - linep += i; - return IHREAL; - } + i = 0; + // try a number + if (sscanf(linep, "%lf%n", &aaitem, &i) > 0) { + // skip to end + linep += i; + return IHREAL; } // Treat as alpha cp = citem;