From 1c75ca2e2dc72d118edbb854455e602d70d80a52 Mon Sep 17 00:00:00 2001 From: rillig Date: Sun, 2 May 2021 12:50:43 +0000 Subject: games: remove trailing whitespace in *.c and *.h --- battlestar/command1.c | 10 ++++----- battlestar/command2.c | 22 +++++++++---------- battlestar/command3.c | 58 +++++++++++++++++++++++++-------------------------- battlestar/command4.c | 56 ++++++++++++++++++++++++------------------------- battlestar/command5.c | 28 ++++++++++++------------- battlestar/command6.c | 8 +++---- battlestar/command7.c | 26 +++++++++++------------ battlestar/cypher.c | 40 +++++++++++++++++------------------ battlestar/fly.c | 8 +++---- battlestar/getcom.c | 10 ++++----- battlestar/parse.c | 10 ++++----- battlestar/room.c | 6 +++--- 12 files changed, 141 insertions(+), 141 deletions(-) (limited to 'battlestar') diff --git a/battlestar/command1.c b/battlestar/command1.c index c69dff69..bd021e1d 100644 --- a/battlestar/command1.c +++ b/battlestar/command1.c @@ -1,4 +1,4 @@ -/* $NetBSD: command1.c,v 1.5 2012/06/19 05:46:08 dholland Exp $ */ +/* $NetBSD: command1.c,v 1.6 2021/05/02 12:50:43 rillig Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)com1.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: command1.c,v 1.5 2012/06/19 05:46:08 dholland Exp $"); +__RCSID("$NetBSD: command1.c,v 1.6 2021/05/02 12:50:43 rillig Exp $"); #endif #endif /* not lint */ @@ -143,8 +143,8 @@ news(void) rythmn = ourtime - ourtime % CYCLE; } if (!wiz && !tempwiz) - if ((testbit(inven, TALISMAN) || testbit(wear, TALISMAN)) && - (testbit(inven, MEDALION) || testbit(wear, MEDALION)) && + if ((testbit(inven, TALISMAN) || testbit(wear, TALISMAN)) && + (testbit(inven, MEDALION) || testbit(wear, MEDALION)) && (testbit(inven, AMULET) || testbit(wear, AMULET))) { tempwiz = 1; printf("The three amulets glow and reenforce each "); @@ -208,7 +208,7 @@ news(void) printf("Laser blasts sear the cockpit, and the alien "); puts("veers off in a victory roll."); puts("The viper shudders under a terrible explosion."); - printf("I'm afraid you have suffered %s.\n", + printf("I'm afraid you have suffered %s.\n", ouch[hurt]); } else clearbit(location[position].objects, CYLON); diff --git a/battlestar/command2.c b/battlestar/command2.c index 530bcfde..9d2c465c 100644 --- a/battlestar/command2.c +++ b/battlestar/command2.c @@ -1,4 +1,4 @@ -/* $NetBSD: command2.c,v 1.4 2019/02/03 03:19:25 mrg Exp $ */ +/* $NetBSD: command2.c,v 1.5 2021/05/02 12:50:43 rillig Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)com2.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: command2.c,v 1.4 2019/02/03 03:19:25 mrg Exp $"); +__RCSID("$NetBSD: command2.c,v 1.5 2021/05/02 12:50:43 rillig Exp $"); #endif #endif /* not lint */ @@ -180,10 +180,10 @@ murder(void) { int n; - for (n = 0; - !((n == SWORD || n == KNIFE || n == TWO_HANDED || n == MACE || - n == CLEAVER || n == BROAD || n == CHAIN || n == SHOVEL || - n == HALBERD) && testbit(inven, n)) && n < NUMOFOBJECTS; + for (n = 0; + !((n == SWORD || n == KNIFE || n == TWO_HANDED || n == MACE || + n == CLEAVER || n == BROAD || n == CHAIN || n == SHOVEL || + n == HALBERD) && testbit(inven, n)) && n < NUMOFOBJECTS; n++); if (n == NUMOFOBJECTS) { if (testbit(inven, LASER)) { @@ -226,15 +226,15 @@ murder(void) power += 5; notes[JINXED]++; } else - if (testbit(location[position].objects, + if (testbit(location[position].objects, NORMGOD)) { printf("The goddess pleads but you "); printf("strike her mercilessly. Her "); printf("broken body lies in a\n"); puts("pool of blood."); - clearbit(location[position].objects, + clearbit(location[position].objects, NORMGOD); - setbit(location[position].objects, + setbit(location[position].objects, DEADGOD); power += 5; notes[JINXED]++; @@ -292,9 +292,9 @@ ravage(void) { while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount) continue; - if (wordtype[wordnumber] == NOUNS && + if (wordtype[wordnumber] == NOUNS && (testbit(location[position].objects, wordvalue[wordnumber]) - || (wordvalue[wordnumber] == NORMGOD && + || (wordvalue[wordnumber] == NORMGOD && testbit(location[position].objects, BATHGOD)))) { ourtime++; switch (wordvalue[wordnumber]) { diff --git a/battlestar/command3.c b/battlestar/command3.c index f4ccb6d9..54be08f6 100644 --- a/battlestar/command3.c +++ b/battlestar/command3.c @@ -1,4 +1,4 @@ -/* $NetBSD: command3.c,v 1.5 2019/02/03 03:19:25 mrg Exp $ */ +/* $NetBSD: command3.c,v 1.6 2021/05/02 12:50:43 rillig Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)com3.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: command3.c,v 1.5 2019/02/03 03:19:25 mrg Exp $"); +__RCSID("$NetBSD: command3.c,v 1.6 2021/05/02 12:50:43 rillig Exp $"); #endif #endif /* not lint */ @@ -110,33 +110,33 @@ bury(void) int value; if (testbit(inven, SHOVEL)) { - while (wordtype[++wordnumber] != OBJECT && + while (wordtype[++wordnumber] != OBJECT && wordtype[wordnumber] != NOUNS && wordnumber < wordcount) continue; value = wordvalue[wordnumber]; - if (wordtype[wordnumber] == NOUNS && - (testbit(location[position].objects, value) || + if (wordtype[wordnumber] == NOUNS && + (testbit(location[position].objects, value) || value == BODY)) switch (value) { case BODY: wordtype[wordnumber] = OBJECT; - if (testbit(inven, MAID) || + if (testbit(inven, MAID) || testbit(location[position].objects, MAID)) value = MAID; - if (testbit(inven, DEADWOOD) || - testbit(location[position].objects, + if (testbit(inven, DEADWOOD) || + testbit(location[position].objects, DEADWOOD)) value = DEADWOOD; - if (testbit(inven, DEADGOD) || - testbit(location[position].objects, + if (testbit(inven, DEADGOD) || + testbit(location[position].objects, DEADGOD)) value = DEADGOD; - if (testbit(inven, DEADTIME) || - testbit(location[position].objects, + if (testbit(inven, DEADTIME) || + testbit(location[position].objects, DEADTIME)) value = DEADTIME; - if (testbit(inven, DEADNATIVE) || - testbit(location[position].objects, + if (testbit(inven, DEADNATIVE) || + testbit(location[position].objects, DEADNATIVE)) value = DEADNATIVE; break; @@ -159,8 +159,8 @@ bury(void) default: puts("Wha..?"); } - if (wordtype[wordnumber] == OBJECT && position > 88 && - (testbit(inven, value) || + if (wordtype[wordnumber] == OBJECT && position > 88 && + (testbit(inven, value) || testbit(location[position].objects, value))) { puts("Buried."); if (testbit(inven, value)) { @@ -176,7 +176,7 @@ bury(void) case DEADTIME: case DEADGOD: ego += 2; - printf("The %s should rest easier now.\n", + printf("The %s should rest easier now.\n", objsht[value]); } } else @@ -217,7 +217,7 @@ shoot(void) puts("You aren't holding a blaster."); else { wordnumber++; - while (wordnumber <= wordcount && + while (wordnumber <= wordcount && wordtype[wordnumber] == OBJECT) { value = wordvalue[wordnumber]; printf("%s:\n", objsht[value]); @@ -229,9 +229,9 @@ shoot(void) if (value == BOMB) die(); } else - printf("I don't see any %s around here.\n", + printf("I don't see any %s around here.\n", objsht[value]); - if (wordnumber < wordcount - 1 && + if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND) wordnumber++; else @@ -274,7 +274,7 @@ shoot(void) break; case NORMGOD: - if (testbit(location[position].objects, + if (testbit(location[position].objects, BATHGOD)) { printf("The goddess is hit in the "); printf("chest and splashes back "); @@ -283,7 +283,7 @@ shoot(void) printf("charred blast hole. Her "); puts("naked body floats in the"); puts("pools and then off downstream."); - clearbit(location[position].objects, + clearbit(location[position].objects, BATHGOD); setbit(location[180].objects, DEADGOD); power += 5; @@ -315,16 +315,16 @@ shoot(void) break; case TIMER: - if (testbit(location[position].objects, + if (testbit(location[position].objects, TIMER)) { printf("The old man slumps over "); puts("the bar."); power++; ego -= 2; notes[JINXED]++; - clearbit(location[position].objects, + clearbit(location[position].objects, TIMER); - setbit(location[position].objects, + setbit(location[position].objects, DEADTIME); } else puts("What old-timer?"); @@ -340,14 +340,14 @@ shoot(void) puts("What man?"); break; case NATIVE: - if (testbit(location[position].objects, + if (testbit(location[position].objects, NATIVE)) { printf("The girl is blown backwards "); printf("several feet and lies in a "); puts("pool of blood."); - clearbit(location[position].objects, + clearbit(location[position].objects, NATIVE); - setbit(location[position].objects, + setbit(location[position].objects, DEADNATIVE); power += 5; ego -= 2; @@ -360,7 +360,7 @@ shoot(void) break; default: - printf("You can't shoot the %s.\n", + printf("You can't shoot the %s.\n", objsht[wordvalue[wordnumber]]); } } else diff --git a/battlestar/command4.c b/battlestar/command4.c index 4535d5ce..6d25055e 100644 --- a/battlestar/command4.c +++ b/battlestar/command4.c @@ -1,4 +1,4 @@ -/* $NetBSD: command4.c,v 1.3 2005/07/01 06:04:54 jmc Exp $ */ +/* $NetBSD: command4.c,v 1.4 2021/05/02 12:50:43 rillig Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)com4.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: command4.c,v 1.3 2005/07/01 06:04:54 jmc Exp $"); +__RCSID("$NetBSD: command4.c,v 1.4 2021/05/02 12:50:43 rillig Exp $"); #endif #endif /* not lint */ @@ -53,13 +53,13 @@ take(unsigned int from[]) return (cypher()); } else { wordnumber++; - while (wordnumber <= wordcount && wordtype[wordnumber] == + while (wordnumber <= wordcount && wordtype[wordnumber] == OBJECT) { value = wordvalue[wordnumber]; printf("%s:\n", objsht[value]); heavy = (carrying + objwt[value]) <= WEIGHT; bulky = (encumber + objcumber[value]) <= CUMBER; - if ((testbit(from, value) || wiz || tempwiz) && + if ((testbit(from, value) || wiz || tempwiz) && heavy && bulky && !testbit(inven, value)) { setbit(inven, value); carrying += objwt[value]; @@ -77,7 +77,7 @@ take(unsigned int from[]) A_OR_AN_OR_BLANK(value), objsht[value]); else if (!testbit(from, value)) - printf("I don't see any %s around here.\n", + printf("I don't see any %s around here.\n", objsht[value]); else if (!heavy) printf("The %s %stoo heavy.\n", objsht[value], @@ -85,7 +85,7 @@ take(unsigned int from[]) else printf("The %s %stoo cumbersome to hold.\n", objsht[value], IS_OR_ARE(value)); - if (wordnumber < wordcount - 1 && + if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND) wordnumber++; else @@ -175,7 +175,7 @@ take(unsigned int from[]) return (take(from)); case NORMGOD: - if (testbit(location[position].objects, BATHGOD) && + if (testbit(location[position].objects, BATHGOD) && (testbit(wear, AMULET) || testbit(inven, AMULET))) { printf("She offers a delicate hand, and you "); puts("help her out of the sparkling springs."); @@ -192,7 +192,7 @@ take(unsigned int from[]) followgod = ourtime; clearbit(location[position].objects, BATHGOD); } else - if (!testbit(location[position].objects, + if (!testbit(location[position].objects, BATHGOD)) { printf("You're in no position to "); puts("take her."); @@ -236,7 +236,7 @@ throw(const char *name) break; case UP: - deposit = location[position].up * + deposit = location[position].up * (location[position].access || position == FINAL); break; @@ -247,18 +247,18 @@ throw(const char *name) wordnumber = first + 1; while (wordnumber <= wordcount) { value = wordvalue[wordnumber]; - if (deposit && + if (deposit && testbit(location[position].objects, value)) { clearbit(location[position].objects, value); if (value != GRENADE) - setbit(location[deposit].objects, + setbit(location[deposit].objects, value); else { printf("A thundering explosion "); printf("nearby sends up a cloud of "); puts("smoke and shrapnel."); for (n = 0; n < NUMOFWORDS; n++) - location[deposit].objects[n] = + location[deposit].objects[n] = 0; setbit(location[deposit].objects, CHAR); } @@ -279,14 +279,14 @@ throw(const char *name) puts("The door is not damaged."); } } else - if (value == GRENADE && - testbit(location[position].objects, + if (value == GRENADE && + testbit(location[position].objects, value)) { printf("You are blown into shreds "); puts("when your grenade explodes."); die(); } - if (wordnumber < wordcount - 1 && + if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND) wordnumber++; else @@ -305,24 +305,24 @@ drop(const char *name) firstnumber = wordnumber; wordnumber++; - while (wordnumber <= wordcount && + while (wordnumber <= wordcount && (wordtype[wordnumber] == OBJECT || wordtype[wordnumber] == NOUNS)) { value = wordvalue[wordnumber]; if (value == BODY) { /* special case */ wordtype[wordnumber] = OBJECT; - if (testbit(inven, MAID) || + if (testbit(inven, MAID) || testbit(location[position].objects, MAID)) value = MAID; - else if (testbit(inven, DEADWOOD) || + else if (testbit(inven, DEADWOOD) || testbit(location[position].objects, DEADWOOD)) value = DEADWOOD; - else if (testbit(inven, DEADGOD) || + else if (testbit(inven, DEADGOD) || testbit(location[position].objects, DEADGOD)) value = DEADGOD; - else if (testbit(inven, DEADTIME) || + else if (testbit(inven, DEADTIME) || testbit(location[position].objects, DEADTIME)) value = DEADTIME; - else if (testbit(inven, DEADNATIVE) || + else if (testbit(inven, DEADNATIVE) || testbit(location[position].objects, DEADNATIVE)) value = DEADNATIVE; } @@ -349,9 +349,9 @@ drop(const char *name) puts("obliterate us."); die(); } - if (value != AMULET && value != MEDALION && + if (value != AMULET && value != MEDALION && value != TALISMAN) - setbit(location[position].objects, + setbit(location[position].objects, value); else tempwiz = 0; @@ -362,7 +362,7 @@ drop(const char *name) printf("%s.\n", name); } else { if (*name != 'K') { - printf("You aren't holding the %s.\n", + printf("You aren't holding the %s.\n", objsht[value]); if (testbit(location[position].objects, value)) { @@ -371,7 +371,7 @@ drop(const char *name) else if (*name == 'G') puts("Given anyway."); } - } else if (testbit(location[position].objects, + } else if (testbit(location[position].objects, value)) puts("Kicked."); else if (testbit(wear, value)) @@ -380,7 +380,7 @@ drop(const char *name) puts("Not found."); } } - if (wordnumber < wordcount - 1 && + if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND) wordnumber++; else @@ -449,13 +449,13 @@ eat(void) printf("Eaten. You can explore a little "); puts("longer now."); } else if (!testbit(inven, value)) { - printf("You aren't holding the %s.\n", + printf("You aren't holding the %s.\n", objsht[value]); } else if (!testbit(inven, KNIFE)) puts("You need a knife."); else puts("You're stuffed."); - if (wordnumber < wordcount - 1 && + if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND) wordnumber++; else diff --git a/battlestar/command5.c b/battlestar/command5.c index fa92ee04..451d704d 100644 --- a/battlestar/command5.c +++ b/battlestar/command5.c @@ -1,4 +1,4 @@ -/* $NetBSD: command5.c,v 1.5 2014/03/22 23:31:28 dholland Exp $ */ +/* $NetBSD: command5.c,v 1.6 2021/05/02 12:50:43 rillig Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)com5.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: command5.c,v 1.5 2014/03/22 23:31:28 dholland Exp $"); +__RCSID("$NetBSD: command5.c,v 1.6 2021/05/02 12:50:43 rillig Exp $"); #endif #endif /* not lint */ @@ -53,7 +53,7 @@ kiss(void) return; } if (wordtype[wordnumber] == NOUNS) { - if (testbit(location[position].objects, + if (testbit(location[position].objects, wordvalue[wordnumber])) { pleasure++; printf("Kissed.\n"); @@ -144,7 +144,7 @@ love(void) } printf("Goddess:\n"); if (!loved) - setbit(location[position].objects, + setbit(location[position].objects, MEDALION); loved = 1; ourtime += 10; @@ -156,7 +156,7 @@ love(void) return; } } - if (testbit(location[position].objects, + if (testbit(location[position].objects, wordvalue[wordnumber])) { if (wordvalue[wordnumber] == NATIVE) { printf("The girl is easy prey. She peels "); @@ -216,7 +216,7 @@ zzz(void) while (!testbit(inven, n)) n = rnd(NUMOFOBJECTS); clearbit(inven, n); - if (n != AMULET && n != MEDALION && + if (n != AMULET && n != MEDALION && n != TALISMAN) setbit( location[position].objects, @@ -305,9 +305,9 @@ give(void) last1 = last2 = 0; firstnumber = wordnumber; - while (wordtype[++wordnumber] != OBJECT && - wordvalue[wordnumber] != AMULET && - wordvalue[wordnumber] != MEDALION && + while (wordtype[++wordnumber] != OBJECT && + wordvalue[wordnumber] != AMULET && + wordvalue[wordnumber] != MEDALION && wordvalue[wordnumber] != TALISMAN && wordnumber <= wordcount) continue; if (wordnumber <= wordcount) { @@ -317,7 +317,7 @@ give(void) last1 = wordnumber; } wordnumber = firstnumber; - while ((wordtype[++wordnumber] != NOUNS || + while ((wordtype[++wordnumber] != NOUNS || wordvalue[wordnumber] == obj) && wordnumber <= wordcount); if (wordtype[wordnumber] == NOUNS) { person = wordvalue[wordnumber]; @@ -338,7 +338,7 @@ give(void) * the same place. */ wordnumber = last1 - 1; if (person && testbit(location[position].objects, person)) { - if (person == NORMGOD && godready < 2 && + if (person == NORMGOD && godready < 2 && !(obj == RING || obj == BRACELET)) puts("The goddess won't look at you."); else @@ -348,7 +348,7 @@ give(void) wordnumber = max(last1, last2) + 1; return (0); } - if (result != -1 && (testbit(location[position].objects, obj) || + if (result != -1 && (testbit(location[position].objects, obj) || obj == AMULET || obj == MEDALION || obj == TALISMAN)) { clearbit(location[position].objects, obj); ourtime++; @@ -366,7 +366,7 @@ give(void) ego += 5; godready += 3; } - if (obj == AMULET || obj == MEDALION || + if (obj == AMULET || obj == MEDALION || obj == TALISMAN) { win++; ego += 5; @@ -400,7 +400,7 @@ give(void) printf("you want to win this game, "); printf("you're going to have to\n"); puts("shoot her!)"); - clearbit(location[position].objects, + clearbit(location[position].objects, MEDALION); wintime = ourtime; } diff --git a/battlestar/command6.c b/battlestar/command6.c index 0c6c8641..5eec6962 100644 --- a/battlestar/command6.c +++ b/battlestar/command6.c @@ -1,4 +1,4 @@ -/* $NetBSD: command6.c,v 1.8 2010/04/24 00:38:30 dholland Exp $ */ +/* $NetBSD: command6.c,v 1.9 2021/05/02 12:50:43 rillig Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)com6.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: command6.c,v 1.8 2010/04/24 00:38:30 dholland Exp $"); +__RCSID("$NetBSD: command6.c,v 1.9 2021/05/02 12:50:43 rillig Exp $"); #endif #endif /* not lint */ @@ -127,7 +127,7 @@ post(int ch) sigprocmask(SIG_BLOCK, &isigset, &osigset); tv = time(NULL); if (score_fp != NULL) { - fprintf(score_fp, "%24.24s %8s %c%20s", ctime(&tv), username, + fprintf(score_fp, "%24.24s %8s %c%20s", ctime(&tv), username, ch, rate()); if (wiz) fprintf(score_fp, " wizard\n"); @@ -206,7 +206,7 @@ ride(void) printf("forward through bush and fern. You are thrown and "); puts("the horse gallops off."); clearbit(location[position].objects, HORSE); - while (!(position = rnd(NUMOFROOMS + 1)) || !OUTSIDE || + while (!(position = rnd(NUMOFROOMS + 1)) || !OUTSIDE || !beenthere[position] || location[position].flyhere) continue; setbit(location[position].objects, HORSE); diff --git a/battlestar/command7.c b/battlestar/command7.c index 060f0890..aae78808 100644 --- a/battlestar/command7.c +++ b/battlestar/command7.c @@ -1,4 +1,4 @@ -/* $NetBSD: command7.c,v 1.4 2018/02/04 08:48:05 mrg Exp $ */ +/* $NetBSD: command7.c,v 1.5 2021/05/02 12:50:43 rillig Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)com7.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: command7.c,v 1.4 2018/02/04 08:48:05 mrg Exp $"); +__RCSID("$NetBSD: command7.c,v 1.5 2021/05/02 12:50:43 rillig Exp $"); #endif #endif /* not lint */ @@ -71,16 +71,16 @@ fighton: case KILL: case SMITE: if (testbit(inven, TWO_HANDED)) - hurt = rnd(70) - 2 * card(injuries, NUMOFINJURIES) - + hurt = rnd(70) - 2 * card(injuries, NUMOFINJURIES) - ucard(wear) - exhaustion; else if (testbit(inven, SWORD) || testbit(inven, BROAD)) - hurt = rnd(50) % (WEIGHT - carrying) - - card(injuries, NUMOFINJURIES) - encumber - + hurt = rnd(50) % (WEIGHT - carrying) - + card(injuries, NUMOFINJURIES) - encumber - exhaustion; - else if (testbit(inven, KNIFE) || testbit(inven, MALLET) || - testbit(inven, CHAIN) || testbit(inven, MACE) || + else if (testbit(inven, KNIFE) || testbit(inven, MALLET) || + testbit(inven, CHAIN) || testbit(inven, MACE) || testbit(inven, HALBERD)) - hurt = rnd(15) - card(injuries, NUMOFINJURIES) - + hurt = rnd(15) - card(injuries, NUMOFINJURIES) - exhaustion; else hurt = rnd(7) - encumber; @@ -130,7 +130,7 @@ fighton: } else if (hurt < 30) { switch (rnd(3)) { case 0: - printf("A bloody gash opens up on his %s ", + printf("A bloody gash opens up on his %s ", (rnd(2) ? "left" : "right")); printf("side.\n"); break; @@ -195,7 +195,7 @@ fighton: puts("pummels your face."); if (testbit(inven, AMULET) || testbit(wear, AMULET)) { printf("Lifting the amulet from you, "); - if (testbit(inven, MEDALION) || + if (testbit(inven, MEDALION) || testbit(wear, MEDALION)) { printf("his power grows and the "); printf("walls of\nthe earth "); @@ -244,7 +244,7 @@ fighton: case SHOOT: if (testbit(inven, LASER)) { if (strength - lifeline <= 50) { - printf("The %s took a direct hit!\n", + printf("The %s took a direct hit!\n", objsht[enemy]); lifeline += 50; } else { @@ -284,9 +284,9 @@ fighton: } puts("He attacks..."); /* Some embellishments. */ - hurt = rnd(NUMOFINJURIES) - (testbit(inven, SHIELD) != 0) - + hurt = rnd(NUMOFINJURIES) - (testbit(inven, SHIELD) != 0) - (testbit(wear, MAIL) != 0) - (testbit(wear, HELM) != 0); - hurt += (testbit(wear, AMULET) != 0) + + hurt += (testbit(wear, AMULET) != 0) + (testbit(wear, MEDALION) != 0) + (testbit(wear, TALISMAN) != 0); hurt = hurt < 0 ? 0 : hurt; hurt = hurt >= NUMOFINJURIES ? NUMOFINJURIES - 1 : hurt; diff --git a/battlestar/cypher.c b/battlestar/cypher.c index fa811924..99bebac4 100644 --- a/battlestar/cypher.c +++ b/battlestar/cypher.c @@ -1,4 +1,4 @@ -/* $NetBSD: cypher.c,v 1.23 2005/07/01 06:04:54 jmc Exp $ */ +/* $NetBSD: cypher.c,v 1.24 2021/05/02 12:50:43 rillig Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)cypher.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: cypher.c,v 1.23 2005/07/01 06:04:54 jmc Exp $"); +__RCSID("$NetBSD: cypher.c,v 1.24 2021/05/02 12:50:43 rillig Exp $"); #endif #endif /* not lint */ @@ -52,10 +52,10 @@ cypher(void) while (wordnumber <= wordcount) { if (wordtype[wordnumber] != VERB && - !(wordtype[wordnumber] == OBJECT && + !(wordtype[wordnumber] == OBJECT && wordvalue[wordnumber] == KNIFE)) { printf("%s: How's that?\n", - (wordnumber == wordcount) ? words[0] : + (wordnumber == wordcount) ? words[0] : words[wordnumber]); return (-1); } @@ -116,7 +116,7 @@ cypher(void) break; case SHOOT: - if (wordnumber < wordcount && + if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) { int things; things = 0; @@ -136,7 +136,7 @@ cypher(void) break; case TAKE: - if (wordnumber < wordcount && + if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) { int things; things = 0; @@ -187,7 +187,7 @@ cypher(void) break; case DROP: - if (wordnumber < wordcount && + if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) { int things; things = 0; @@ -207,7 +207,7 @@ cypher(void) case KICK: case THROW: - if (wordnumber < wordcount && + if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) { int things, wv; things = 0; @@ -221,15 +221,15 @@ cypher(void) } wordnumber += 2; if (!things) - printf("Nothing to %s!\n", + printf("Nothing to %s!\n", wv == KICK ? "kick" : "throw"); } else - throw(wordvalue[wordnumber] == + throw(wordvalue[wordnumber] == KICK ? "Kicked" : "Thrown"); break; case TAKEOFF: - if (wordnumber < wordcount && + if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) { int things; things = 0; @@ -247,7 +247,7 @@ cypher(void) break; case DRAW: - if (wordnumber < wordcount && + if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) { int things; things = 0; @@ -265,7 +265,7 @@ cypher(void) break; case PUTON: - if (wordnumber < wordcount && + if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) { int things; things = 0; @@ -284,7 +284,7 @@ cypher(void) break; case WEARIT: - if (wordnumber < wordcount && + if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) { int things; things = 0; @@ -302,7 +302,7 @@ cypher(void) break; case EAT: - if (wordnumber < wordcount && + if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) { int things; things = 0; @@ -334,8 +334,8 @@ cypher(void) carrying, (carrying == 1 ? "." : "s.")); printf(" (can't lift any weight%s)\n", - (carrying ? - " or move with what you have" : + (carrying ? + " or move with what you have" : "")); } else printf("\n= %d kilogram%s (%d%%)\n", @@ -364,7 +364,7 @@ cypher(void) if (injuries[n]) printf("\t%s\n", ouch[n]); printf("\nYou can still carry up to "); - printf("%d kilogram%s\n", WEIGHT, + printf("%d kilogram%s\n", WEIGHT, (WEIGHT == 1 ? "." : "s.")); } else puts("\nYou are in perfect health."); @@ -376,7 +376,7 @@ cypher(void) break; case OPEN: - if (wordnumber < wordcount && + if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) { int things; things = 0; @@ -459,7 +459,7 @@ cypher(void) printf("%s in %d turns.\n", rate(), ourtime); printf("You have visited %d out of %d rooms ", card(beenthere, NUMOFROOMS), NUMOFROOMS); - printf("this run (%d%%).\n", + printf("this run (%d%%).\n", card(beenthere, NUMOFROOMS) * 100 / NUMOFROOMS); break; diff --git a/battlestar/fly.c b/battlestar/fly.c index 85175b6f..6277def6 100644 --- a/battlestar/fly.c +++ b/battlestar/fly.c @@ -1,4 +1,4 @@ -/* $NetBSD: fly.c,v 1.15 2012/10/13 19:58:53 dholland Exp $ */ +/* $NetBSD: fly.c,v 1.16 2021/05/02 12:50:43 rillig Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)fly.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: fly.c,v 1.15 2012/10/13 19:58:53 dholland Exp $"); +__RCSID("$NetBSD: fly.c,v 1.16 2021/05/02 12:50:43 rillig Exp $"); #endif #endif /* not lint */ @@ -151,7 +151,7 @@ visual(void) if (torps) { torps -= 2; blast(); - if (row == MIDR && column < MIDC + 2 && + if (row == MIDR && column < MIDC + 2 && column > MIDC - 2) { destroyed = 1; alarm(0); @@ -265,7 +265,7 @@ moveenemy(int dummy __unused) fuel = 0; mvaddstr(0, 60, "*** Out of fuel ***"); } - d = (double) ((row - MIDR) * (row - MIDR) + (column - MIDC) * + d = (double) ((row - MIDR) * (row - MIDR) + (column - MIDC) * (column - MIDC)); if (d < 16) { row += (rnd(9) - 4) % (4 - abs(row - MIDR)); diff --git a/battlestar/getcom.c b/battlestar/getcom.c index 7e13b5f9..15b8e832 100644 --- a/battlestar/getcom.c +++ b/battlestar/getcom.c @@ -1,4 +1,4 @@ -/* $NetBSD: getcom.c,v 1.14 2012/01/16 17:38:16 christos Exp $ */ +/* $NetBSD: getcom.c,v 1.15 2021/05/02 12:50:43 rillig Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)getcom.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: getcom.c,v 1.14 2012/01/16 17:38:16 christos Exp $"); +__RCSID("$NetBSD: getcom.c,v 1.15 2021/05/02 12:50:43 rillig Exp $"); #endif #endif /* not lint */ @@ -85,11 +85,11 @@ getword(char *buf1, char *buf2, int flag) *buf2 = 0; return (0); } - while (cnt < WORDLEN && *buf1 && + while (cnt < WORDLEN && *buf1 && !isspace((unsigned char)*buf1) && *buf1 != ',') if (flag < 0) { if (isupper((unsigned char)*buf1)) { - *buf2++ = + *buf2++ = tolower((unsigned char)*buf1++); cnt++; } else { @@ -98,7 +98,7 @@ getword(char *buf1, char *buf2, int flag) } } else if (flag > 0) { if (islower((unsigned char)*buf1)) { - *buf2++ = + *buf2++ = toupper((unsigned char)*buf1++); cnt++; } else { diff --git a/battlestar/parse.c b/battlestar/parse.c index 60700bc3..fbf141c1 100644 --- a/battlestar/parse.c +++ b/battlestar/parse.c @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.17 2020/02/06 22:09:43 fox Exp $ */ +/* $NetBSD: parse.c,v 1.18 2021/05/02 12:50:43 rillig Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)parse.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: parse.c,v 1.17 2020/02/06 22:09:43 fox Exp $"); +__RCSID("$NetBSD: parse.c,v 1.18 2021/05/02 12:50:43 rillig Exp $"); #endif #endif /* not lint */ @@ -154,9 +154,9 @@ parse(void) while (flag) { flag = 0; for (n = 1; n < wordcount; n++) - if ((wordtype[n - 1] == NOUNS || + if ((wordtype[n - 1] == NOUNS || wordtype[n - 1] == OBJECT) && - wordvalue[n] == AND && + wordvalue[n] == AND && wordvalue[n + 1] == EVERYTHING) { char tmpword[WORDLEN]; wordvalue[n + 1] = wordvalue[n - 1]; @@ -171,7 +171,7 @@ parse(void) /* And trim EVERYTHING AND EVERYTHING. */ for (n = 1; n < wordcount; n++) if (wordvalue[n - 1] == EVERYTHING && - wordvalue[n] == AND && + wordvalue[n] == AND && wordvalue[n + 1] == EVERYTHING) { int i; for (i = n + 1; i < wordcount; i++) { diff --git a/battlestar/room.c b/battlestar/room.c index 16d129b5..5ec56844 100644 --- a/battlestar/room.c +++ b/battlestar/room.c @@ -1,4 +1,4 @@ -/* $NetBSD: room.c,v 1.14 2019/10/05 23:34:14 mrg Exp $ */ +/* $NetBSD: room.c,v 1.15 2021/05/02 12:50:43 rillig Exp $ */ /* * Copyright (c) 1983, 1993 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)room.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: room.c,v 1.14 2019/10/05 23:34:14 mrg Exp $"); +__RCSID("$NetBSD: room.c,v 1.15 2021/05/02 12:50:43 rillig Exp $"); #endif #endif /* not lint */ @@ -174,7 +174,7 @@ truedirec(int way, int option) break; } - printf("Error: room %d. More than four directions wanted.", + printf("Error: room %d. More than four directions wanted.", position); return ("!!"); } -- cgit v1.2.3-56-ge451