#endif
};
-#define NUMCOMMANDS sizeof(commands)/sizeof(commands[0])
+#define NUMCOMMANDS ARRAY_SIZE(commands)
#define ACCEPT(i) (!commands[i].option || (commands[i].option & game.options))
static void listCommands(void)
fclose(fp);
}
-void enqueue(char *s)
-/* enqueue input for the command parser */
-{
- chew();
- strcpy(line, s);
-}
-
static void makemoves(void)
/* command-interpretation loop */
{
clrscr();
proutn("COMMAND> ");
if (scan() == IHEOL) {
- makechart();
+ if (game.options & OPTION_CURSES)
+ makechart();
continue;
}
game.ididit = false;
commandhook(commands[i].name, true);
switch (v) { /* command switch */
case SRSCAN: // srscan
- srscan(SCAN_FULL);
+ srscan();
break;
case STATUS: // status
- srscan(SCAN_STATUS);
+ status(0);
break;
case REQUEST: // status request
- srscan(SCAN_REQUEST);
+ request();
break;
case LRSCAN: // lrscan
lrscan();
}
break;
case DOCK: // dock
- dock(1);
- if (game.ididit) attack(0);
+ dock(true);
+ if (game.ididit) attack(false);
break;
case DAMAGES: // damages
dreprt();
break;
case CHART: // chart
- chart(false);
+ makechart();
break;
case IMPULSE: // impulse
impuls();
continue;
}
if (hitme && !game.justin) {
- attack(2);
+ attack(true);
if (game.alldone) break;
if (game.state.galaxy[game.quadrant.x][game.quadrant.y].supernova) { // went NOVA!
atover(false);
}
}
/* where to save the input in case of bugs */
- logfp = fopen("sst-input.log", "w");
- setlinebuf(logfp);
- fprintf(logfp, "seed %d\n", seed);
+ logfp = fopen("/usr/tmp/sst-input.log", "w");
+ if (logfp) {
+ setlinebuf(logfp);
+ fprintf(logfp, "seed %d\n", seed);
+ }
srand(seed);
- srand(seed);
iostart();
line[0] = '\0';