char *prompt;
{
(void) printf("%s? ", prompt);
- if (fgets(inp, sizeof(inp), stdin))
+ if (fgets(inp, sizeof(inp), stdin)) {
return(tolower(inp[0]));
+ }
else {
fputs("\n",stdout);
exit(1);
retry:
newloc = FNA();
- for (j = 0; j < LOCS; j++)
- if (loc[j] == newloc)
+ for (j = 0; j < LOCS; j++) {
+ if (loc[j] == newloc) {
goto retry;
+ }
+ }
loc[where] = newloc;
}
{
int room = cave[loc[YOU]][k];
- if (room == loc[RMS])
+ if (room == loc[RMS]) {
(void) puts("I smell a superhack!");
- else if (room == loc[STARLET1] || room == loc[STARLET2])
+ }
+ else if (room == loc[STARLET1] || room == loc[STARLET2]) {
(void) puts("I smell perfume!");
- else if (room == loc[DROID1] || room == loc[DROID2])
+ }
+ else if (room == loc[DROID1] || room == loc[DROID2]) {
(void) puts("Droids nearby!");
- else if (room == loc[LUSER1] || room == loc[LUSER2])
+ }
+ else if (room == loc[LUSER1] || room == loc[LUSER2]) {
(void) puts("Lusers nearby!");
+ }
}
}
return;
}
- for (k = 0; k < j9; k++)
+ for (k = 0; k < j9; k++) {
if (k >= 2 && path[k] == path[k - 2])
{
(void) puts("Pies can't fly that crookedly --- try again.");
return;
}
+ }
scratchloc = loc[YOU];
{
scratchloc = path[k];
check_shot();
- if (finished != NOT)
+ if (finished != NOT) {
return;
+ }
}
}
move_superhack();
- if (--pies <= 0)
+ if (--pies <= 0) {
finished = LOSE;
+ }
}
}
{
k = FNC();
- if (k < 3)
+ if (k < 3) {
loc[RMS] = cave[loc[RMS]][k];
+ }
- if (loc[RMS] != loc[YOU])
+ if (loc[RMS] != loc[YOU]) {
return;
+ }
(void) puts("The superhack flames you to a crisp. You lose!");
scratchloc--;
- for (k = 0; k < 3; k++)
- if (cave[loc[YOU]][k] == scratchloc)
- goto goodmove;
+ for (k = 0; k < 3; k++) {
+ if (cave[loc[YOU]][k] == scratchloc) {
+ goto goodmove;
+ }
+ }
PM("You can't get there from here!");
return;
int main(int argc, char *argv[])
{
- if (argc >= 2 && strcmp(argv[1], "-s") == 0)
- srand(atoi(argv[2]));
- else
- srand((int)time((long *) 0));
+ if (argc >= 2 && strcmp(argv[1], "-s") == 0) {
+ srand(atoi(argv[2]));
+ }
+ else {
+ srand((int)time((long *) 0));
+ }
for (;;)
{
badlocs:
- for (j = 0; j < LOCS; j++)
- loc[j] = FNA();
+ for (j = 0; j < LOCS; j++) {
+ loc[j] = FNA();
+ }
- for (j = 0; j < LOCS; j++)
- for (k = 0; k < LOCS; k++)
- if (j == k)
- continue;
- else if (loc[j] == loc[k])
- goto badlocs;
+ for (j = 0; j < LOCS; j++) {
+ for (k = 0; k < LOCS; k++) {
+ if (j == k) {
+ continue;
+ }
+ else if (loc[j] == loc[k]) {
+ goto badlocs;
+ }
+ }
+ }
(void) puts("Hunt the Superhack");
c = getlet("Throw, move or help [t,m,?]");
- if (c == 't')
+ if (c == 't') {
throw();
- else if (c == 'm')
+ }
+ else if (c == 'm') {
move();
- else if (c == '?')
+ }
+ else if (c == '?') {
print_instructions();
+ }
#ifdef DEBUG
else if (c == 'd')
{