diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2018-02-07 20:22:24 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2018-02-07 20:22:24 +0000 |
commit | dea665dae5494b8fbbcb563cff2567478e70f58d (patch) | |
tree | 44bda3c9943142d9d9ad2885aa659315095f6f07 | |
parent | 88984196776bd9535df901f10db857393b97f7cd (diff) |
slightly reduce the difficulty of the adventure game that is reading
the battlestar code by reformatting a few lines.
special request from mlarkin so he'll go back to fixing meltdown.
-rw-r--r-- | games/battlestar/battlestar.c | 4 | ||||
-rw-r--r-- | games/battlestar/com2.c | 9 | ||||
-rw-r--r-- | games/battlestar/com3.c | 10 | ||||
-rw-r--r-- | games/battlestar/com5.c | 9 | ||||
-rw-r--r-- | games/battlestar/com6.c | 7 | ||||
-rw-r--r-- | games/battlestar/com7.c | 4 | ||||
-rw-r--r-- | games/battlestar/getcom.c | 4 |
7 files changed, 27 insertions, 20 deletions
diff --git a/games/battlestar/battlestar.c b/games/battlestar/battlestar.c index d1e9730ded4..02ab795bb9e 100644 --- a/games/battlestar/battlestar.c +++ b/games/battlestar/battlestar.c @@ -1,4 +1,4 @@ -/* $OpenBSD: battlestar.c,v 1.21 2017/05/31 19:51:27 tedu Exp $ */ +/* $OpenBSD: battlestar.c,v 1.22 2018/02/07 20:22:23 tedu Exp $ */ /* $NetBSD: battlestar.c,v 1.3 1995/03/21 15:06:47 cgd Exp $ */ /* @@ -71,6 +71,6 @@ main(int argc, char *argv[]) next = getword(next, words[wordcount], -1); parse(); while (cypher()) - ; + continue; } } diff --git a/games/battlestar/com2.c b/games/battlestar/com2.c index d26590dbe72..8766654d203 100644 --- a/games/battlestar/com2.c +++ b/games/battlestar/com2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com2.c,v 1.18 2015/12/31 17:51:19 mestre Exp $ */ +/* $OpenBSD: com2.c,v 1.19 2018/02/07 20:22:23 tedu Exp $ */ /* $NetBSD: com2.c,v 1.3 1995/03/21 15:06:55 cgd Exp $ */ /* @@ -179,8 +179,11 @@ murder(void) if (inc_wordnumber(words[wordnumber], "whom")) return; - for (n = 0; n < NUMOFOBJECTS && !((n == SWORD || n == KNIFE || n == TWO_HANDED || n == MACE || n == CLEAVER || n == BROAD || n == CHAIN || n == SHOVEL || n == HALBERD) && TestBit(inven, n)); n++) - ; + for (n = 0; n < NUMOFOBJECTS && + !((n == SWORD || n == KNIFE || n == TWO_HANDED || n == MACE || + n == CLEAVER || n == BROAD || n == CHAIN || n == SHOVEL || + n == HALBERD) && TestBit(inven, n)); n++) + continue; if (n == NUMOFOBJECTS) { if (TestBit(inven, LASER)) { printf("Your laser should do the trick.\n"); diff --git a/games/battlestar/com3.c b/games/battlestar/com3.c index ff4d1ec0371..c8cbde03425 100644 --- a/games/battlestar/com3.c +++ b/games/battlestar/com3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com3.c,v 1.14 2015/12/31 17:51:19 mestre Exp $ */ +/* $OpenBSD: com3.c,v 1.15 2018/02/07 20:22:23 tedu Exp $ */ /* $NetBSD: com3.c,v 1.3 1995/03/21 15:07:00 cgd Exp $ */ /* @@ -104,10 +104,11 @@ bury(void) int value; if (TestBit(inven, SHOVEL)) { - while (wordtype[++wordnumber] != OBJECT && wordtype[wordnumber] != NOUNS && wordnumber <= wordcount) - ; + while (wordtype[++wordnumber] != OBJECT && + wordtype[wordnumber] != NOUNS && wordnumber <= wordcount) + continue; value = wordvalue[wordnumber]; - if (wordtype[wordnumber] == NOUNS && (TestBit(location[position].objects, value) || value == BODY)) + if (wordtype[wordnumber] == NOUNS && (TestBit(location[position].objects, value) || value == BODY)) { switch (value) { case BODY: wordtype[wordnumber] = OBJECT; @@ -138,6 +139,7 @@ bury(void) default: puts("Wha..?"); } + } if (wordtype[wordnumber] == OBJECT && position > 88 && (TestBit(inven, value) || TestBit(location[position].objects, value))) { puts("Buried."); if (TestBit(inven, value)) { diff --git a/games/battlestar/com5.c b/games/battlestar/com5.c index 284aebc841c..bdb6d48e2c7 100644 --- a/games/battlestar/com5.c +++ b/games/battlestar/com5.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com5.c,v 1.13 2015/12/31 17:51:19 mestre Exp $ */ +/* $OpenBSD: com5.c,v 1.14 2018/02/07 20:22:23 tedu Exp $ */ /* $NetBSD: com5.c,v 1.3 1995/03/21 15:07:07 cgd Exp $ */ /* @@ -274,7 +274,7 @@ give(void) wordvalue[wordnumber] != MEDALION && wordvalue[wordnumber] != TALISMAN && wordnumber <= wordcount) - ; + continue; if (wordnumber <= wordcount) { obj = wordvalue[wordnumber]; if (obj == EVERYTHING) @@ -282,8 +282,9 @@ give(void) last1 = wordnumber; } wordnumber = firstnumber; - while ((wordtype[++wordnumber] != NOUNS || wordvalue[wordnumber] == obj) && wordnumber <= wordcount) - ; + while ((wordtype[++wordnumber] != NOUNS || + wordvalue[wordnumber] == obj) && wordnumber <= wordcount) + continue; if (wordtype[wordnumber] == NOUNS) { person = wordvalue[wordnumber]; last2 = wordnumber; diff --git a/games/battlestar/com6.c b/games/battlestar/com6.c index b13b5607eb1..f56fb08ab5a 100644 --- a/games/battlestar/com6.c +++ b/games/battlestar/com6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com6.c,v 1.23 2016/09/11 14:21:17 tb Exp $ */ +/* $OpenBSD: com6.c,v 1.24 2018/02/07 20:22:23 tedu Exp $ */ /* $NetBSD: com6.c,v 1.5 1995/04/27 21:30:23 mycroft Exp $ */ /* @@ -204,8 +204,9 @@ ride(void) puts("You climb onto the stallion and kick it in the guts. The stupid steed launches"); puts("forward through bush and fern. You are thrown and the horse gallops off."); ClearBit(location[position].objects, HORSE); - while (!(position = rnd(NUMOFROOMS + 1)) || !OUTSIDE || !beenthere[position] || location[position].flyhere) - ; + while (!(position = rnd(NUMOFROOMS + 1)) || !OUTSIDE || + !beenthere[position] || location[position].flyhere) + continue; SetBit(location[position].objects, HORSE); if (location[position].north) position = location[position].north; diff --git a/games/battlestar/com7.c b/games/battlestar/com7.c index 192499973e9..1b14009fde7 100644 --- a/games/battlestar/com7.c +++ b/games/battlestar/com7.c @@ -1,4 +1,4 @@ -/* $OpenBSD: com7.c,v 1.13 2015/12/31 17:51:19 mestre Exp $ */ +/* $OpenBSD: com7.c,v 1.14 2018/02/07 20:22:23 tedu Exp $ */ /* $NetBSD: com7.c,v 1.3 1995/03/21 15:07:12 cgd Exp $ */ /* @@ -52,7 +52,7 @@ fighton: if (snooze > ourtime) exhaustion = CYCLE / (snooze - ourtime); else { - puts("You collapse exhausted, and he pulverizes your skull."); + puts("You collapse exhausted and he pulverizes your skull."); die(0); } if (snooze - ourtime < 20) diff --git a/games/battlestar/getcom.c b/games/battlestar/getcom.c index 556c16310cb..eb78ebaaba0 100644 --- a/games/battlestar/getcom.c +++ b/games/battlestar/getcom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getcom.c,v 1.16 2015/12/31 17:51:19 mestre Exp $ */ +/* $OpenBSD: getcom.c,v 1.17 2018/02/07 20:22:23 tedu Exp $ */ /* $NetBSD: getcom.c,v 1.3 1995/03/21 15:07:30 cgd Exp $ */ /* @@ -58,7 +58,7 @@ getcom(char *buf, int size, const char *prompt, const char *error) if (buf[strlen(buf) - 1] != '\n') { int i; while ((i = getchar()) != '\n' && i != EOF) - ; + continue; } return (buf); } |