summaryrefslogtreecommitdiffstats
path: root/battlestar
diff options
context:
space:
mode:
authorjmc <jmc@NetBSD.org>2005-07-01 06:04:46 +0000
committerjmc <jmc@NetBSD.org>2005-07-01 06:04:46 +0000
commit4fe92d1fcdbb2fc53d5d338814045f676c06cc4a (patch)
tree9c573af7165124e541518f30ca2b526fbb2fc162 /battlestar
parentcd55bb615f356f190eb2f57ad04366ecece7a545 (diff)
downloadbsdgames-darwin-4fe92d1fcdbb2fc53d5d338814045f676c06cc4a.tar.gz
bsdgames-darwin-4fe92d1fcdbb2fc53d5d338814045f676c06cc4a.tar.zst
bsdgames-darwin-4fe92d1fcdbb2fc53d5d338814045f676c06cc4a.zip
KNF and WARNS=3
Diffstat (limited to 'battlestar')
-rw-r--r--battlestar/battlestar.c10
-rw-r--r--battlestar/command1.c73
-rw-r--r--battlestar/command2.c104
-rw-r--r--battlestar/command3.c136
-rw-r--r--battlestar/command4.c165
-rw-r--r--battlestar/command5.c155
-rw-r--r--battlestar/command6.c64
-rw-r--r--battlestar/command7.c109
-rw-r--r--battlestar/cypher.c95
-rw-r--r--battlestar/extern.h6
-rw-r--r--battlestar/fly.c28
-rw-r--r--battlestar/getcom.c26
-rw-r--r--battlestar/init.c15
-rw-r--r--battlestar/misc.c12
-rw-r--r--battlestar/parse.c26
-rw-r--r--battlestar/room.c23
-rw-r--r--battlestar/save.c14
17 files changed, 667 insertions, 394 deletions
diff --git a/battlestar/battlestar.c b/battlestar/battlestar.c
index e88349c6..f26e8814 100644
--- a/battlestar/battlestar.c
+++ b/battlestar/battlestar.c
@@ -1,4 +1,4 @@
-/* $NetBSD: battlestar.c,v 1.14 2004/01/27 20:30:29 jsm Exp $ */
+/* $NetBSD: battlestar.c,v 1.15 2005/07/01 06:04:54 jmc Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
#if 0
static char sccsid[] = "@(#)battlestar.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: battlestar.c,v 1.14 2004/01/27 20:30:29 jsm Exp $");
+__RCSID("$NetBSD: battlestar.c,v 1.15 2005/07/01 06:04:54 jmc Exp $");
#endif
#endif /* not lint */
@@ -52,12 +52,8 @@ __RCSID("$NetBSD: battlestar.c,v 1.14 2004/01/27 20:30:29 jsm Exp $");
#include "extern.h"
-int main(int, char *[]);
-
int
-main(argc, argv)
- int argc;
- char **argv;
+main(int argc, char **argv)
{
char mainbuf[LINELENGTH];
char *next;
diff --git a/battlestar/command1.c b/battlestar/command1.c
index 2ecf181b..96235d95 100644
--- a/battlestar/command1.c
+++ b/battlestar/command1.c
@@ -1,4 +1,4 @@
-/* $NetBSD: command1.c,v 1.2 2003/08/07 09:37:00 agc Exp $ */
+/* $NetBSD: command1.c,v 1.3 2005/07/01 06:04:54 jmc Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,15 +34,14 @@
#if 0
static char sccsid[] = "@(#)com1.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: command1.c,v 1.2 2003/08/07 09:37:00 agc Exp $");
+__RCSID("$NetBSD: command1.c,v 1.3 2005/07/01 06:04:54 jmc Exp $");
#endif
#endif /* not lint */
#include "extern.h"
int
-moveplayer(thataway, token)
- int thataway, token;
+moveplayer(int thataway, int token)
{
wordnumber++;
if ((!notes[CANTMOVE] && !notes[LAUNCHED]) ||
@@ -59,19 +58,21 @@ moveplayer(thataway, token)
return (0);
}
} else {
- if (notes[CANTMOVE] && !notes[LAUNCHED])
- puts("You aren't able to move; you better drop something.");
- else
- puts("You are out of fuel; now you will rot in space forever!");
+ if (notes[CANTMOVE] && !notes[LAUNCHED]) {
+ printf("You aren't able to move; you better drop ");
+ puts("something.");
+ } else {
+ printf("You are out of fuel; ");
+ puts("now you will rot in space forever!");
+ }
}
return (1);
}
+/* Converts day to night and vice versa. */
void
-convert(tothis) /* Converts day to night and vice versa. */
- int tothis; /* Day objects are permanent. Night objects
- * are added */
-{ /* at dusk, and subtracted at dawn. */
+convert(int tothis)
+{
const struct objs *p;
unsigned int i, j;
@@ -99,8 +100,10 @@ news()
int hurt;
if (ourtime > 30 && position < 32) {
- puts("An explosion of shuddering magnitude splinters bulkheads and");
- puts("ruptures the battlestar's hull. You are sucked out into the");
+ printf("An explosion of shuddering magnitude splinters ");
+ puts("bulkheads and");
+ printf("ruptures the battlestar's hull. You are sucked out ");
+ puts("into the");
puts("frozen void of space and killed.");
die();
}
@@ -116,26 +119,34 @@ news()
if (location == nightfile) {
convert(TODAY);
if (OUTSIDE && ourtime - rythmn - CYCLE < 10) {
- puts("Dew lit sunbeams stretch out from a watery sunrise and herald the dawn.");
- puts("You awake from a misty dream-world into stark reality.");
+ printf("Dew lit sunbeams stretch out from a ");
+ puts("watery sunrise and herald the dawn.");
+ printf("You awake from a misty dream-world ");
+ puts("into stark reality.");
puts("It is day.");
}
} else {
convert(TONIGHT);
clearbit(location[POOLS].objects, BATHGOD);
if (OUTSIDE && ourtime - rythmn - CYCLE < 10) {
- puts("The dying sun sinks into the ocean, leaving a blood-stained sunset.");
- puts("The sky slowly fades from orange to violet to black. A few stars");
+ printf("The dying sun sinks into the ocean, ");
+ puts("leaving a blood-stained sunset.");
+ printf("The sky slowly fades from orange to ");
+ puts("violet to black. A few stars");
puts("flicker on, and it is night.");
- puts("The world seems completely different at night.");
+ printf("The world seems completely different ");
+ puts("at night.");
}
}
rythmn = ourtime - ourtime % CYCLE;
}
if (!wiz && !tempwiz)
- if ((testbit(inven, TALISMAN) || testbit(wear, TALISMAN)) && (testbit(inven, MEDALION) || testbit(wear, MEDALION)) && (testbit(inven, AMULET) || testbit(wear, AMULET))) {
+ if ((testbit(inven, TALISMAN) || testbit(wear, TALISMAN)) &&
+ (testbit(inven, MEDALION) || testbit(wear, MEDALION)) &&
+ (testbit(inven, AMULET) || testbit(wear, AMULET))) {
tempwiz = 1;
- puts("The three amulets glow and reenforce each other in power.\nYou are now a wizard.");
+ printf("The three amulets glow and reenforce each ");
+ puts("other in power.\nYou are now a wizard.");
}
if (testbit(location[position].objects, ELF)) {
printf("%s\n", objdes[ELF]);
@@ -184,16 +195,19 @@ news()
}
if (testbit(location[position].objects, CYLON)) {
puts("Oh my God, you're being shot at by an alien spacecraft!");
- printf("The targeting computer says we have %d seconds to attack!\n",
+ printf("The targeting computer says we have %d seconds ",
ourclock);
+ printf("to attack!\n");
fflush(stdout);
sleep(1);
if (!visual()) {
hurt = rnd(NUMOFINJURIES);
injuries[hurt] = 1;
- puts("Laser blasts sear the cockpit, and the alien veers off in a victory roll.");
+ 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", ouch[hurt]);
+ printf("I'm afraid you have suffered %s.\n",
+ ouch[hurt]);
} else
clearbit(location[position].objects, CYLON);
}
@@ -234,7 +248,7 @@ news()
}
void
-crash()
+crash(void)
{
int hurt1, hurt2;
@@ -246,8 +260,10 @@ crash()
else {
puts("You're out of fuel. We'll have to crash land!");
if (!location[position].down) {
- puts("Your viper strikes the ground and explodes into fiery fragments.");
- puts("Thick black smoke billows up from the wreckage.");
+ printf("Your viper strikes the ground and ");
+ puts("explodes into fiery fragments.");
+ printf("Thick black smoke billows up from the");
+ puts(" wreckage.");
die();
}
position = location[position].down;
@@ -255,7 +271,8 @@ crash()
notes[LAUNCHED] = 0;
setbit(location[position].objects, CRASH);
ourtime += rnd(CYCLE / 4);
- puts("The viper explodes into the ground and you lose consciousness...");
+ printf("The viper explodes into the ground and you lose ");
+ puts("consciousness...");
zzz();
hurt1 = rnd(NUMOFINJURIES - 2) + 2;
hurt2 = rnd(NUMOFINJURIES - 2) + 2;
diff --git a/battlestar/command2.c b/battlestar/command2.c
index 9d56f217..158e546a 100644
--- a/battlestar/command2.c
+++ b/battlestar/command2.c
@@ -1,4 +1,4 @@
-/* $NetBSD: command2.c,v 1.2 2003/08/07 09:37:00 agc Exp $ */
+/* $NetBSD: command2.c,v 1.3 2005/07/01 06:04:54 jmc Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,14 +34,14 @@
#if 0
static char sccsid[] = "@(#)com2.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: command2.c,v 1.2 2003/08/07 09:37:00 agc Exp $");
+__RCSID("$NetBSD: command2.c,v 1.3 2005/07/01 06:04:54 jmc Exp $");
#endif
#endif /* not lint */
#include "extern.h"
int
-wearit()
+wearit(void)
{ /* synonyms = {sheathe, sheath} */
int firstnumber, value;
@@ -91,10 +91,11 @@ wearit()
printf("You are now wearing %s%s.\n",
A_OR_AN_OR_THE(value), objsht[value]);
} else
- if (testbit(wear, value))
- printf("You are already wearing the %s.\n",
+ if (testbit(wear, value)) {
+ printf("You are already wearing the %s",
objsht[value]);
- else
+ printf(".\n");
+ } else
printf("You aren't holding the %s.\n",
objsht[value]);
if (wordnumber < wordcount - 1 &&
@@ -109,7 +110,7 @@ wearit()
}
int
-put()
+put(void)
{ /* synonyms = {buckle, strap, tie} */
if (wordvalue[wordnumber + 1] == ON) {
wordvalue[++wordnumber] = PUTON;
@@ -127,13 +128,13 @@ put()
}
int
-draw()
+draw(void)
{ /* synonyms = {pull, carry} */
return (take(wear));
}
int
-use()
+use(void)
{
wordnumber++;
if (wordvalue[wordnumber] == AMULET && testbit(inven, AMULET) &&
@@ -144,13 +145,16 @@ use()
if (position == 114) {
location[position].down = 160;
whichway(location[position]);
- puts("The waves subside and it is possible to descend to the sea cave now.");
+ printf("The waves subside and it is possible ");
+ puts("to descend to the sea cave now.");
ourtime++;
return (-1);
}
}
- puts("A light mist falls over your eyes and the sound of purling water trickles in");
- puts("your ears. When the mist lifts you are standing beside a cool stream.");
+ printf("A light mist falls over your eyes and the sound of ");
+ puts("purling water trickles in");
+ printf("your ears. When the mist lifts you are standing ");
+ puts("beside a cool stream.");
if (position == 229)
position = 224;
else
@@ -172,11 +176,15 @@ use()
}
void
-murder()
+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; 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;
+ n++);
if (n == NUMOFOBJECTS) {
if (testbit(inven, LASER)) {
printf("Your laser should do the trick.\n");
@@ -211,16 +219,23 @@ murder()
case NORMGOD:
if (testbit(location[position].objects, BATHGOD)) {
- puts("The goddess's head slices off. Her corpse floats in the water.");
+ printf("The goddess's head slices off. Her ");
+ puts("corpse floats in the water.");
clearbit(location[position].objects, BATHGOD);
setbit(location[position].objects, DEADGOD);
power += 5;
notes[JINXED]++;
} else
- if (testbit(location[position].objects, NORMGOD)) {
- puts("The goddess pleads but you strike her mercilessly. Her broken body lies in a\npool of blood.");
- clearbit(location[position].objects, NORMGOD);
- setbit(location[position].objects, DEADGOD);
+ 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,
+ NORMGOD);
+ setbit(location[position].objects,
+ DEADGOD);
power += 5;
notes[JINXED]++;
if (wintime)
@@ -240,7 +255,8 @@ murder()
break;
case NATIVE:
if (testbit(location[position].objects, NATIVE)) {
- puts("The girl screams as you cut her body to shreds. She is dead.");
+ printf("The girl screams as you cut her ");
+ puts("body to shreds. She is dead.");
clearbit(location[position].objects, NATIVE);
setbit(location[position].objects, DEADNATIVE);
power += 5;
@@ -250,7 +266,8 @@ murder()
break;
case MAN:
if (testbit(location[position].objects, MAN)) {
- puts("You strike him to the ground, and he coughs up blood.");
+ printf("You strike him to the ground, and ");
+ puts("he coughs up blood.");
puts("Your fantasy is over.");
die();
}
@@ -270,20 +287,26 @@ murder()
}
void
-ravage()
+ravage(void)
{
while (wordtype[++wordnumber] != NOUNS && wordnumber <= wordcount)
continue;
- if (wordtype[wordnumber] == NOUNS && (testbit(location[position].objects, wordvalue[wordnumber])
- || (wordvalue[wordnumber] == NORMGOD && testbit(location[position].objects, BATHGOD)))) {
+ if (wordtype[wordnumber] == NOUNS &&
+ (testbit(location[position].objects, wordvalue[wordnumber])
+ || (wordvalue[wordnumber] == NORMGOD &&
+ testbit(location[position].objects, BATHGOD)))) {
ourtime++;
switch (wordvalue[wordnumber]) {
case NORMGOD:
- puts("You attack the goddess, and she screams as you beat her. She falls down");
- if (testbit(location[position].objects, BATHGOD))
- puts("crying and tries to cover her nakedness.");
- else
- puts("crying and tries to hold her torn and bloodied dress around her.");
+ printf("You attack the goddess, and she screams as ");
+ puts("you beat her. She falls down");
+ if (testbit(location[position].objects, BATHGOD)) {
+ printf("crying and tries to cover her ");
+ puts("nakedness.");
+ } else {
+ printf("crying and tries to hold her torn ");
+ puts("and bloodied dress around her.");
+ }
power += 5;
pleasure += 8;
ego -= 10;
@@ -293,15 +316,18 @@ ravage()
win = -30000;
break;
case NATIVE:
- puts("The girl tries to run, but you catch her and throw her down. Her face is");
- puts("bleeding, and she screams as you tear off her clothes.");
+ printf("The girl tries to run, but you catch her and ");
+ puts("throw her down. Her face is");
+ printf("bleeding, and she screams as you tear off ");
+ puts("her clothes.");
power += 3;
pleasure += 5;
ego -= 10;
wordnumber--;
murder();
if (rnd(100) < 50) {
- puts("Her screams have attracted attention. I think we are surrounded.");
+ printf("Her screams have attracted ");
+ puts("attention. I think we are surrounded.");
setbit(location[ahead].objects, WOODSMAN);
setbit(location[ahead].objects, DEADWOOD);
setbit(location[ahead].objects, MALLET);
@@ -324,12 +350,15 @@ ravage()
}
int
-follow()
+follow(void)
{
if (followfight == ourtime) {
- puts("The Dark Lord leaps away and runs down secret tunnels and corridors.");
- puts("You chase him through the darkness and splash in pools of water.");
- puts("You have cornered him. His laser sword extends as he steps forward.");
+ printf("The Dark Lord leaps away and runs down secret ");
+ puts("tunnels and corridors.");
+ printf("You chase him through the darkness and splash in ");
+ puts("pools of water.");
+ printf("You have cornered him. His laser sword extends ");
+ puts("as he steps forward.");
position = FINAL;
fight(DARK, 75);
setbit(location[position].objects, TALISMAN);
@@ -337,7 +366,8 @@ follow()
return (0);
} else
if (followgod == ourtime) {
- puts("The goddess leads you down a steamy tunnel and into a high, wide chamber.");
+ printf("The goddess leads you down a steamy tunnel ");
+ puts("and into a high, wide chamber.");
puts("She sits down on a throne.");
position = 268;
setbit(location[position].objects, NORMGOD);
diff --git a/battlestar/command3.c b/battlestar/command3.c
index 0279193c..0c8b20eb 100644
--- a/battlestar/command3.c
+++ b/battlestar/command3.c
@@ -1,4 +1,4 @@
-/* $NetBSD: command3.c,v 1.2 2003/08/07 09:37:00 agc Exp $ */
+/* $NetBSD: command3.c,v 1.3 2005/07/01 06:04:54 jmc Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,14 +34,14 @@
#if 0
static char sccsid[] = "@(#)com3.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: command3.c,v 1.2 2003/08/07 09:37:00 agc Exp $");
+__RCSID("$NetBSD: command3.c,v 1.3 2005/07/01 06:04:54 jmc Exp $");
#endif
#endif /* not lint */
#include "extern.h"
void
-dig()
+dig(void)
{
if (testbit(inven, SHOVEL)) {
puts("OK");
@@ -65,7 +65,7 @@ dig()
}
int
-jump()
+jump(void)
{
int n;
@@ -105,33 +105,46 @@ jump()
}
void
-bury()
+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;
- if (testbit(inven, MAID) || testbit(location[position].objects, MAID))
+ if (testbit(inven, MAID) ||
+ testbit(location[position].objects, MAID))
value = MAID;
- if (testbit(inven, DEADWOOD) || testbit(location[position].objects, DEADWOOD))
+ if (testbit(inven, DEADWOOD) ||
+ testbit(location[position].objects,
+ DEADWOOD))
value = DEADWOOD;
- if (testbit(inven, DEADGOD) || testbit(location[position].objects, DEADGOD))
+ if (testbit(inven, DEADGOD) ||
+ testbit(location[position].objects,
+ DEADGOD))
value = DEADGOD;
- if (testbit(inven, DEADTIME) || testbit(location[position].objects, DEADTIME))
+ if (testbit(inven, DEADTIME) ||
+ testbit(location[position].objects,
+ DEADTIME))
value = DEADTIME;
- if (testbit(inven, DEADNATIVE) || testbit(location[position].objects, DEADNATIVE))
+ if (testbit(inven, DEADNATIVE) ||
+ testbit(location[position].objects,
+ DEADNATIVE))
value = DEADNATIVE;
break;
case NATIVE:
case NORMGOD:
- puts("She screams as you wrestle her into the hole.");
+ printf("She screams as you wrestle her into ");
+ puts("the hole.");
case TIMER:
power += 7;
ego -= 10;
@@ -144,7 +157,9 @@ bury()
default:
puts("Wha..?");
}
- if (wordtype[wordnumber] == OBJECT && position > 88 && (testbit(inven, value) || testbit(location[position].objects, value))) {
+ if (wordtype[wordnumber] == OBJECT && position > 88 &&
+ (testbit(inven, value) ||
+ testbit(location[position].objects, value))) {
puts("Buried.");
if (testbit(inven, value)) {
clearbit(inven, value);
@@ -159,7 +174,8 @@ bury()
case DEADTIME:
case DEADGOD:
ego += 2;
- printf("The %s should rest easier now.\n", objsht[value]);
+ printf("The %s should rest easier now.\n",
+ objsht[value]);
}
} else
puts("It doesn't seem to work.");
@@ -168,13 +184,15 @@ bury()
}
void
-drink()
+drink(void)
{
int n;
if (testbit(inven, POTION)) {
- puts("The cool liquid runs down your throat but turns to fire and you choke.");
- puts("The heat reaches your limbs and tingles your spirit. You feel like falling");
+ printf("The cool liquid runs down your throat but turns to ");
+ puts("fire and you choke.");
+ printf("The heat reaches your limbs and tingles your spirit.");
+ puts(" You feel like falling");
puts("asleep.");
clearbit(inven, POTION);
WEIGHT = MAXWEIGHT;
@@ -188,7 +206,7 @@ drink()
}
int
-shoot()
+shoot(void)
{
int firstnumber, value;
@@ -197,7 +215,8 @@ shoot()
puts("You aren't holding a blaster.");
else {
wordnumber++;
- while (wordnumber <= wordcount && wordtype[wordnumber] == OBJECT) {
+ while (wordnumber <= wordcount &&
+ wordtype[wordnumber] == OBJECT) {
value = wordvalue[wordnumber];
printf("%s:\n", objsht[value]);
if (testbit(location[position].objects, value)) {
@@ -208,8 +227,10 @@ shoot()
if (value == BOMB)
die();
} else
- printf("I don't see any %s around here.\n", objsht[value]);
- if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND)
+ printf("I don't see any %s around here.\n",
+ objsht[value]);
+ if (wordnumber < wordcount - 1 &&
+ wordvalue[++wordnumber] == AND)
wordnumber++;
else
return (firstnumber);
@@ -235,11 +256,15 @@ shoot()
whichway(location[position]);
break;
case 31:
- puts("The laser blast has no effect on the door.");
+ printf("The laser blast has no ");
+ puts("effect on the door.");
break;
case 20:
- puts("The blast hits the door and it explodes into flame. The magnesium burns");
- puts("so rapidly that we have no chance to escape.");
+ printf("The blast hits the door and ");
+ printf("it explodes into flame. The ");
+ puts("magnesium burns");
+ printf("so rapidly that we have no ");
+ puts("chance to escape.");
die();
default:
puts("Nothing happens.");
@@ -247,19 +272,31 @@ shoot()
break;
case NORMGOD:
- if (testbit(location[position].objects, BATHGOD)) {
- puts("The goddess is hit in the chest and splashes back against the rocks.");
- puts("Dark blood oozes from the charred blast hole. Her naked body floats in the");
+ if (testbit(location[position].objects,
+ BATHGOD)) {
+ printf("The goddess is hit in the ");
+ printf("chest and splashes back ");
+ puts("against the rocks.");
+ printf("Dark blood oozes from the ");
+ printf("charred blast hole. Her ");
+ puts("naked body floats in the");
puts("pools and then off downstream.");
- clearbit(location[position].objects, BATHGOD);
+ clearbit(location[position].objects,
+ BATHGOD);
setbit(location[180].objects, DEADGOD);
power += 5;
ego -= 10;
notes[JINXED]++;
} else
- if (testbit(location[position].objects, NORMGOD)) {
- puts("The blast catches the goddess in the stomach, knocking her to the ground.");
- puts("She writhes in the dirt as the agony of death taunts her.");
+ if (testbit(location[position].objects,
+ NORMGOD)) {
+ printf("The blast catches ");
+ printf("the goddess in the ");
+ printf("stomach, knocking ");
+ puts("her to the ground.");
+ printf("She writhes in the ");
+ printf("dirt as the agony of ");
+ puts("death taunts her.");
puts("She has stopped moving.");
clearbit(location[position].objects, NORMGOD);
setbit(location[position].objects, DEADGOD);
@@ -270,33 +307,45 @@ shoot()
live();
break;
} else
- puts("I don't see any goddess around here.");
+ printf("I don't see any ");
+ puts("goddess around here.");
break;
case TIMER:
- if (testbit(location[position].objects, TIMER)) {
- puts("The old man slumps over the bar.");
+ if (testbit(location[position].objects,
+ TIMER)) {
+ printf("The old man slumps over ");
+ puts("the bar.");
power++;
ego -= 2;
notes[JINXED]++;
- clearbit(location[position].objects, TIMER);
- setbit(location[position].objects, DEADTIME);
+ clearbit(location[position].objects,
+ TIMER);
+ setbit(location[position].objects,
+ DEADTIME);
} else
puts("What old-timer?");
break;
case MAN:
if (testbit(location[position].objects, MAN)) {
- puts("The man falls to the ground with blood pouring all over his white suit.");
+ printf("The man falls to the ground ");
+ printf("with blood pouring all over ");
+ puts("his white suit.");
puts("Your fantasy is over.");
die();
} else
puts("What man?");
break;
case NATIVE:
- if (testbit(location[position].objects, NATIVE)) {
- puts("The girl is blown backwards several feet and lies in a pool of blood.");
- clearbit(location[position].objects, NATIVE);
- setbit(location[position].objects, DEADNATIVE);
+ 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,
+ NATIVE);
+ setbit(location[position].objects,
+ DEADNATIVE);
power += 5;
ego -= 2;
notes[JINXED]++;
@@ -308,7 +357,8 @@ shoot()
break;
default:
- printf("You can't shoot the %s.\n", objsht[wordvalue[wordnumber]]);
+ printf("You can't shoot the %s.\n",
+ objsht[wordvalue[wordnumber]]);
}
} else
puts("You must be a looney.");
diff --git a/battlestar/command4.c b/battlestar/command4.c
index b7911144..4535d5ce 100644
--- a/battlestar/command4.c
+++ b/battlestar/command4.c
@@ -1,4 +1,4 @@
-/* $NetBSD: command4.c,v 1.2 2003/08/07 09:37:00 agc Exp $ */
+/* $NetBSD: command4.c,v 1.3 2005/07/01 06:04:54 jmc Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,15 +34,14 @@
#if 0
static char sccsid[] = "@(#)com4.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: command4.c,v 1.2 2003/08/07 09:37:00 agc Exp $");
+__RCSID("$NetBSD: command4.c,v 1.3 2005/07/01 06:04:54 jmc Exp $");
#endif
#endif /* not lint */
#include "extern.h"
int
-take(from)
- unsigned int from[];
+take(unsigned int from[])
{
int firstnumber, heavy, bulky, value;
@@ -54,12 +53,14 @@ take(from)
return (cypher());
} else {
wordnumber++;
- while (wordnumber <= wordcount && wordtype[wordnumber] == OBJECT) {
+ 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) && heavy && bulky && !testbit(inven, value)) {
+ if ((testbit(from, value) || wiz || tempwiz) &&
+ heavy && bulky && !testbit(inven, value)) {
setbit(inven, value);
carrying += objwt[value];
encumber += objcumber[value];
@@ -76,14 +77,16 @@ take(from)
A_OR_AN_OR_BLANK(value),
objsht[value]);
else if (!testbit(from, value))
- printf("I don't see any %s around here.\n", objsht[value]);
+ printf("I don't see any %s around here.\n",
+ objsht[value]);
else if (!heavy)
printf("The %s %stoo heavy.\n", objsht[value],
IS_OR_ARE(value));
else
printf("The %s %stoo cumbersome to hold.\n",
objsht[value], IS_OR_ARE(value));
- if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND)
+ if (wordnumber < wordcount - 1 &&
+ wordvalue[++wordnumber] == AND)
wordnumber++;
else
return (firstnumber);
@@ -136,44 +139,64 @@ take(from)
case AMULET:
if (testbit(location[position].objects, AMULET)) {
- puts("The amulet is warm to the touch, and its beauty catches your breath.");
- puts("A mist falls over your eyes, but then it is gone. Sounds seem clearer");
- puts("and sharper but far away as if in a dream. The sound of purling water");
- puts("reaches you from afar. The mist falls again, and your heart leaps in horror.");
- puts("The gold freezes your hands and fathomless darkness engulfs your soul.");
+ printf("The amulet is warm to the touch, and ");
+ puts("its beauty catches your breath.");
+ printf("A mist falls over your eyes, but ");
+ puts("then it is gone. Sounds seem clearer");
+ printf("and sharper but far away as if in a ");
+ puts("dream. The sound of purling water");
+ printf("reaches you from afar. The mist ");
+ printf("falls again, and your heart leaps in ");
+ puts("horror.");
+ printf("The gold freezes your hands and ");
+ puts("fathomless darkness engulfs your soul.");
}
wordtype[wordnumber--] = OBJECT;
return (take(from));
case MEDALION:
if (testbit(location[position].objects, MEDALION)) {
- puts("The medallion is warm, and it rekindles your spirit with the warmth of life.");
- puts("Your amulet begins to glow as the medallion is brought near to it, and together\nthey radiate.");
+ printf("The medallion is warm, and it ");
+ printf("rekindles your spirit with the ");
+ puts("warmth of life.");
+ printf("Your amulet begins to glow as the ");
+ printf("medallion is brought near to it, ");
+ printf("and together\nthey radiate.\n");
}
wordtype[wordnumber--] = OBJECT;
return (take(from));
case TALISMAN:
if (testbit(location[position].objects, TALISMAN)) {
- puts("The talisman is cold to the touch, and it sends a chill down your spine.");
+ printf("The talisman is cold to the touch, ");
+ puts("and it sends a chill down your spine.");
}
wordtype[wordnumber--] = OBJECT;
return (take(from));
case NORMGOD:
- if (testbit(location[position].objects, BATHGOD) && (testbit(wear, AMULET) || testbit(inven, AMULET))) {
- puts("She offers a delicate hand, and you help her out of the sparkling springs.");
- puts("Water droplets like liquid silver bedew her golden skin, but when they part");
- puts("from her, they fall as teardrops. She wraps a single cloth around her and");
- puts("ties it at the waist. Around her neck hangs a golden amulet.");
- puts("She bids you to follow her, and walks away.");
+ 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.");
+ printf("Water droplets like liquid silver ");
+ printf("bedew her golden skin, but when ");
+ puts("they part");
+ printf("from her, they fall as teardrops. ");
+ puts("She wraps a single cloth around her and");
+ printf("ties it at the waist. Around her ");
+ puts("neck hangs a golden amulet.");
+ printf("She bids you to follow her, and ");
+ puts("walks away.");
pleasure++;
followgod = ourtime;
clearbit(location[position].objects, BATHGOD);
} else
- if (!testbit(location[position].objects, BATHGOD))
- puts("You're in no position to take her.");
- else
+ if (!testbit(location[position].objects,
+ BATHGOD)) {
+ printf("You're in no position to ");
+ puts("take her.");
+ } else
puts("She moves away from you.");
break;
@@ -186,8 +209,7 @@ take(from)
}
int
-throw(name)
- const char *name;
+throw(const char *name)
{
unsigned int n;
int deposit = 0;
@@ -214,7 +236,8 @@ throw(name)
break;
case UP:
- deposit = location[position].up * (location[position].access || position == FINAL);
+ deposit = location[position].up *
+ (location[position].access || position == FINAL);
break;
case DOWN:
@@ -224,14 +247,19 @@ throw(name)
wordnumber = first + 1;
while (wordnumber <= wordcount) {
value = wordvalue[wordnumber];
- if (deposit && testbit(location[position].objects, value)) {
+ if (deposit &&
+ testbit(location[position].objects, value)) {
clearbit(location[position].objects, value);
if (value != GRENADE)
- setbit(location[deposit].objects, value);
+ setbit(location[deposit].objects,
+ value);
else {
- puts("A thundering explosion nearby sends up a cloud of smoke and shrapnel.");
+ 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] = 0;
+ location[deposit].objects[n] =
+ 0;
setbit(location[deposit].objects, CHAR);
}
if (value == ROPE && position == FINAL)
@@ -251,11 +279,15 @@ throw(name)
puts("The door is not damaged.");
}
} else
- if (value == GRENADE && testbit(location[position].objects, value)) {
- puts("You are blown into shreds when your grenade explodes.");
+ if (value == GRENADE &&
+ testbit(location[position].objects,
+ value)) {
+ printf("You are blown into shreds ");
+ puts("when your grenade explodes.");
die();
}
- if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND)
+ if (wordnumber < wordcount - 1 &&
+ wordvalue[++wordnumber] == AND)
wordnumber++;
else
return (first);
@@ -266,27 +298,32 @@ throw(name)
}
int
-drop(name)
- const char *name;
+drop(const char *name)
{
int firstnumber, value;
firstnumber = wordnumber;
wordnumber++;
- while (wordnumber <= wordcount && (wordtype[wordnumber] == OBJECT || wordtype[wordnumber] == NOUNS)) {
+ while (wordnumber <= wordcount &&
+ (wordtype[wordnumber] == OBJECT || wordtype[wordnumber] == NOUNS)) {
value = wordvalue[wordnumber];
if (value == BODY) { /* special case */
wordtype[wordnumber] = OBJECT;
- if (testbit(inven, MAID) || testbit(location[position].objects, MAID))
+ if (testbit(inven, MAID) ||
+ testbit(location[position].objects, MAID))
value = MAID;
- else if (testbit(inven, DEADWOOD) || testbit(location[position].objects, DEADWOOD))
+ else if (testbit(inven, DEADWOOD) ||
+ testbit(location[position].objects, DEADWOOD))
value = DEADWOOD;
- else if (testbit(inven, DEADGOD) || testbit(location[position].objects, DEADGOD))
+ else if (testbit(inven, DEADGOD) ||
+ testbit(location[position].objects, DEADGOD))
value = DEADGOD;
- else if (testbit(inven, DEADTIME) || testbit(location[position].objects, DEADTIME))
+ else if (testbit(inven, DEADTIME) ||
+ testbit(location[position].objects, DEADTIME))
value = DEADTIME;
- else if (testbit(inven, DEADNATIVE) || testbit(location[position].objects, DEADNATIVE))
+ else if (testbit(inven, DEADNATIVE) ||
+ testbit(location[position].objects, DEADNATIVE))
value = DEADNATIVE;
}
if (wordtype[wordnumber] == NOUNS && value == DOOR) {
@@ -306,11 +343,16 @@ drop(name)
carrying -= objwt[value];
encumber -= objcumber[value];
if (value == BOMB) {
- puts("The bomb explodes. A blinding white light and immense concussion obliterate us.");
+ printf("The bomb explodes. A ");
+ printf("blinding white light and ");
+ printf("immense concussion ");
+ puts("obliterate us.");
die();
}
- if (value != AMULET && value != MEDALION && value != TALISMAN)
- setbit(location[position].objects, value);
+ if (value != AMULET && value != MEDALION &&
+ value != TALISMAN)
+ setbit(location[position].objects,
+ value);
else
tempwiz = 0;
ourtime++;
@@ -320,14 +362,17 @@ drop(name)
printf("%s.\n", name);
} else {
if (*name != 'K') {
- printf("You aren't holding the %s.\n", objsht[value]);
- if (testbit(location[position].objects, value)) {
+ printf("You aren't holding the %s.\n",
+ objsht[value]);
+ if (testbit(location[position].objects,
+ value)) {
if (*name == 'T')
puts("Kicked instead.");
else if (*name == 'G')
puts("Given anyway.");
}
- } else if (testbit(location[position].objects, value))
+ } else if (testbit(location[position].objects,
+ value))
puts("Kicked.");
else if (testbit(wear, value))
puts("Not while it's being worn.");
@@ -335,7 +380,8 @@ drop(name)
puts("Not found.");
}
}
- if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND)
+ if (wordnumber < wordcount - 1 &&
+ wordvalue[++wordnumber] == AND)
wordnumber++;
else
return (firstnumber);
@@ -345,21 +391,21 @@ drop(name)
}
int
-takeoff()
+takeoff(void)
{
wordnumber = take(wear);
return (drop("Dropped"));
}
int
-puton()
+puton(void)
{
wordnumber = take(location[position].objects);
return (wearit());
}
int
-eat()
+eat(void)
{
int firstnumber, value;
@@ -400,14 +446,17 @@ eat()
ate = max(ourtime, ate) + CYCLE / 3;
snooze += CYCLE / 10;
ourtime++;
- puts("Eaten. You can explore a little longer now.");
- } else if (!testbit(inven, value))
- printf("You aren't holding the %s.\n", objsht[value]);
- else if (!testbit(inven, KNIFE))
+ printf("Eaten. You can explore a little ");
+ puts("longer now.");
+ } else if (!testbit(inven, value)) {
+ 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 && wordvalue[++wordnumber] == AND)
+ if (wordnumber < wordcount - 1 &&
+ wordvalue[++wordnumber] == AND)
wordnumber++;
else
return (firstnumber);
diff --git a/battlestar/command5.c b/battlestar/command5.c
index 17d3c103..0ad91e24 100644
--- a/battlestar/command5.c
+++ b/battlestar/command5.c
@@ -1,4 +1,4 @@
-/* $NetBSD: command5.c,v 1.2 2003/08/07 09:37:00 agc Exp $ */
+/* $NetBSD: command5.c,v 1.3 2005/07/01 06:04:54 jmc 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.2 2003/08/07 09:37:00 agc Exp $");
+__RCSID("$NetBSD: command5.c,v 1.3 2005/07/01 06:04:54 jmc Exp $");
#endif
#endif /* not lint */
@@ -53,17 +53,20 @@ kiss()
return;
}
if (wordtype[wordnumber] == NOUNS) {
- if (testbit(location[position].objects, wordvalue[wordnumber])) {
+ if (testbit(location[position].objects,
+ wordvalue[wordnumber])) {
pleasure++;
printf("Kissed.\n");
switch (wordvalue[wordnumber]) {
case NORMGOD:
switch (godready++) {
case 0:
- puts("She squirms and avoids your advances.");
+ printf("She squirms and avoids your ");
+ puts("advances.");
break;
case 1:
- puts("She is coming around; she didn't fight it as much.");
+ puts("She is coming around; she ");
+ puts("didn't fight it as much.");
break;
case 2:
puts("She's beginning to like it.");
@@ -74,7 +77,9 @@ kiss()
}
break;
case NATIVE:
- puts("Her lips are warm and her body robust. She pulls you down to the ground.");
+ printf("Her lips are warm and her body ");
+ printf("robust. She pulls you down to ");
+ puts("the ground.");
break;
case TIMER:
puts("The old man blushes.");
@@ -92,7 +97,7 @@ kiss()
}
void
-love()
+love(void)
{
int n;
@@ -107,13 +112,31 @@ love()
return;
}
if (godready >= 2) {
- puts("She cuddles up to you, and her mouth starts to work:\n'That was my sister's amulet. The lovely goddess, Purl, was she. The Empire\ncaptured her just after the Darkness came. My other sister, Vert, was killed\nby the Dark Lord himself. He took her amulet and warped its power.\nYour quest was foretold by my father before he died, but to get the Dark Lord's\namulet you must use cunning and skill. I will leave you my amulet,");
- puts("which you may use as you wish. As for me, I am the last goddess of the\nwaters. My father was the Island King, and the rule is rightfully mine.'\n\nShe pulls the throne out into a large bed.");
+ printf("She cuddles up to you, and her mouth ");
+ printf("starts to work:\n'That was my ");
+ printf("sister's amulet. The lovely ");
+ printf("goddess, Purl, was she. The Empire\n");
+ printf("captured her just after the Darkness ");
+ printf("came. My other sister, Vert, was ");
+ printf("killed\nby the Dark Lord himself. ");
+ printf("He took her amulet and warped its ");
+ printf("power.\nYour quest was foretold by ");
+ printf("my father before he died, but to get ");
+ printf("the Dark Lord's\namulet you must use ");
+ printf("cunning and skill. I will leave you ");
+ puts("my amulet,");
+ printf("which you may use as you wish. As ");
+ printf("for me, I am the last goddess of ");
+ printf("the\nwaters. My father was the ");
+ printf("Island King, and the rule is ");
+ printf("rightfully mine.'\n\nShe pulls the ");
+ puts("throne out into a large bed.");
power++;
pleasure += 15;
ego++;
if (card(injuries, NUMOFINJURIES)) {
- puts("Her kisses revive you; your wounds are healed.\n");
+ printf("Her kisses revive you; your ");
+ printf("wounds are healed.\n");
for (n = 0; n < NUMOFINJURIES; n++)
injuries[n] = 0;
WEIGHT = MAXWEIGHT;
@@ -121,7 +144,8 @@ love()
}
printf("Goddess:\n");
if (!loved)
- setbit(location[position].objects, MEDALION);
+ setbit(location[position].objects,
+ MEDALION);
loved = 1;
ourtime += 10;
printf("Loved.\n");
@@ -132,9 +156,11 @@ love()
return;
}
}
- if (testbit(location[position].objects, wordvalue[wordnumber])) {
+ if (testbit(location[position].objects,
+ wordvalue[wordnumber])) {
if (wordvalue[wordnumber] == NATIVE) {
- puts("The girl is easy prey. She peels off her sarong and indulges you.");
+ printf("The girl is easy prey. She peels ");
+ puts("off her sarong and indulges you.");
power++;
pleasure += 5;
printf("Girl:\n");
@@ -156,7 +182,7 @@ love()
}
int
-zzz()
+zzz(void)
{
int oldtime;
int n;
@@ -178,7 +204,8 @@ zzz()
notes[LAUNCHED] = 0;
}
if (OUTSIDE && rnd(100) < 50) {
- puts("You are awakened abruptly by the sound of someone nearby.");
+ printf("You are awakened abruptly by the sound ");
+ puts("of someone nearby.");
switch (rnd(4)) {
case 0:
if (ucard(inven)) {
@@ -186,12 +213,16 @@ zzz()
while (!testbit(inven, n))
n = rnd(NUMOFOBJECTS);
clearbit(inven, n);
- if (n != AMULET && n != MEDALION && n != TALISMAN)
- setbit(location[position].objects, n);
+ if (n != AMULET && n != MEDALION &&
+ n != TALISMAN)
+ setbit(
+ location[position].objects,
+ n);
carrying -= objwt[n];
encumber -= objcumber[n];
}
- puts("A fiendish little Elf is stealing your treasures!");
+ printf("A fiendish little Elf is stealing ");
+ puts("your treasures!");
fight(ELF, 10);
break;
case 1:
@@ -210,7 +241,7 @@ zzz()
}
void
-chime()
+chime(void)
{
if ((ourtime / CYCLE + 1) % 2 && OUTSIDE)
switch ((ourtime % CYCLE) / (CYCLE / 7)) {
@@ -265,13 +296,16 @@ chime()
}
int
-give()
+give(void)
{
int obj = -1, result = -1, person = 0, firstnumber, last1, last2;
last1 = last2 = 0;
firstnumber = wordnumber;
- while (wordtype[++wordnumber] != OBJECT && wordvalue[wordnumber] != AMULET && wordvalue[wordnumber] != MEDALION && wordvalue[wordnumber] != TALISMAN && wordnumber <= wordcount)
+ while (wordtype[++wordnumber] != OBJECT &&
+ wordvalue[wordnumber] != AMULET &&
+ wordvalue[wordnumber] != MEDALION &&
+ wordvalue[wordnumber] != TALISMAN && wordnumber <= wordcount)
continue;
if (wordnumber <= wordcount) {
obj = wordvalue[wordnumber];
@@ -280,7 +314,8 @@ give()
last1 = wordnumber;
}
wordnumber = firstnumber;
- while ((wordtype[++wordnumber] != NOUNS || wordvalue[wordnumber] == obj) && wordnumber <= wordcount);
+ while ((wordtype[++wordnumber] != NOUNS ||
+ wordvalue[wordnumber] == obj) && wordnumber <= wordcount);
if (wordtype[wordnumber] == NOUNS) {
person = wordvalue[wordnumber];
last2 = wordnumber;
@@ -300,7 +335,8 @@ give()
* the same place. */
wordnumber = last1 - 1;
if (person && testbit(location[position].objects, person)) {
- if (person == NORMGOD && godready < 2 && !(obj == RING || obj == BRACELET))
+ if (person == NORMGOD && godready < 2 &&
+ !(obj == RING || obj == BRACELET))
puts("The goddess won't look at you.");
else
result = drop("Given");
@@ -309,7 +345,8 @@ give()
wordnumber = max(last1, last2) + 1;
return (0);
}
- if (result != -1 && (testbit(location[position].objects, obj) || obj == AMULET || obj == MEDALION || obj == TALISMAN)) {
+ if (result != -1 && (testbit(location[position].objects, obj) ||
+ obj == AMULET || obj == MEDALION || obj == TALISMAN)) {
clearbit(location[position].objects, obj);
ourtime++;
ego++;
@@ -320,35 +357,63 @@ give()
break;
case NORMGOD:
if (obj == RING || obj == BRACELET) {
- puts("She takes the charm and puts it on. A little kiss on the cheek is");
+ printf("She takes the charm and puts it on.");
+ puts(" A little kiss on the cheek is");
puts("your reward.");
ego += 5;
godready += 3;
}
- if (obj == AMULET || obj == MEDALION || obj == TALISMAN) {
+ if (obj == AMULET || obj == MEDALION ||
+ obj == TALISMAN) {
win++;
ego += 5;
power -= 5;
if (win >= 3) {
- puts("The powers of the earth are now legitimate. You have destroyed the Darkness");
- puts("and restored the goddess to her throne. The entire island celebrates with");
- puts("dancing and spring feasts. As a measure of her gratitude, the goddess weds you");
- puts("in the late summer and crowns you Prince Liverwort, Lord of Fungus.");
- puts("\nBut, as the year wears on and autumn comes along, you become restless and");
- puts("yearn for adventure. The goddess, too, realizes that the marriage can't last.");
- puts("She becomes bored and takes several more natives as husbands. One evening,");
- puts("after having been out drinking with the girls, she kicks the throne particularly");
- puts("hard and wakes you up. (If you want to win this game, you're going to have to\nshoot her!)");
- clearbit(location[position].objects, MEDALION);
+ printf("The powers of the earth are ");
+ printf("now legitimate. You have ");
+ puts("destroyed the Darkness");
+ printf("and restored the goddess to ");
+ printf("her throne. The entire ");
+ puts("island celebrates with");
+ printf("dancing and spring feasts. ");
+ printf("As a measure of her ");
+ puts("gratitude, the goddess weds you");
+ printf("in the late summer and ");
+ printf("crowns you Prince Liverwort, ");
+ puts("Lord of Fungus.");
+ printf("\nBut, as the year wears on ");
+ printf("and autumn comes along, you ");
+ puts("become restless and");
+ printf("yearn for adventure. The ");
+ printf("goddess, too, realizes that ");
+ puts("the marriage can't last.");
+ printf("She becomes bored and takes ");
+ printf("several more natives as ");
+ puts("husbands. One evening,");
+ printf("after having been out ");
+ printf("drinking with the girls, she ");
+ puts("kicks the throne particularly");
+ printf("hard and wakes you up. (If ");
+ printf("you want to win this game, ");
+ printf("you're going to have to\n");
+ puts("shoot her!)");
+ clearbit(location[position].objects,
+ MEDALION);
wintime = ourtime;
}
}
break;
case TIMER:
if (obj == COINS) {
- puts("He fingers the coins for a moment and then looks up agape. `Kind you are and");
- puts("I mean to repay you as best I can.' Grabbing a pencil and cocktail napkin...\n");
- printf("+-----------------------------------------------------------------------------+\n");
+ printf("He fingers the coins for a moment ");
+ printf("and then looks up agape. `Kind you ");
+ puts("are and");
+ printf("I mean to repay you as best I can.' ");
+ printf("Grabbing a pencil and cocktail ");
+ puts("napkin...\n");
+ printf("+-----------------------------------");
+ printf("------------------------------------");
+ printf("------+\n");
printf("| xxxxxxxx\\ |\n");
printf("| xxxxx\\ CLIFFS |\n");
printf("| FOREST xxx\\ |\n");
@@ -364,9 +429,15 @@ give()
printf("| // ... N <-- + --- S |\n");
printf("| PALM GROVE // ... | |\n");
printf("| // ... W |\n");
- printf("+-----------------------------------------------------------------------------+\n");
- puts("\n`This map shows a secret entrance to the catacombs.");
- puts("You will know when you arrive because I left an old pair of shoes there.'");
+ printf("+");
+ printf("---------------------------------");
+ printf("---------------------------------");
+ printf("-----------+\n");
+ printf("\n`This map shows a secret entrance ");
+ puts("to the catacombs.");
+ printf("You will know when you arrive ");
+ printf("because I left an old pair of shoes ");
+ puts("there.'");
}
break;
}
diff --git a/battlestar/command6.c b/battlestar/command6.c
index fd2a07b5..c877c1f0 100644
--- a/battlestar/command6.c
+++ b/battlestar/command6.c
@@ -1,4 +1,4 @@
-/* $NetBSD: command6.c,v 1.2 2003/08/07 09:37:01 agc Exp $ */
+/* $NetBSD: command6.c,v 1.3 2005/07/01 06:04:54 jmc 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.2 2003/08/07 09:37:01 agc Exp $");
+__RCSID("$NetBSD: command6.c,v 1.3 2005/07/01 06:04:54 jmc Exp $");
#endif
#endif /* not lint */
@@ -42,7 +42,7 @@ __RCSID("$NetBSD: command6.c,v 1.2 2003/08/07 09:37:01 agc Exp $");
#include "pathnames.h"
int
-launch()
+launch(void)
{
if (testbit(location[position].objects, VIPER) && !notes[CANTLAUNCH]) {
if (fuel > 4) {
@@ -51,8 +51,10 @@ launch()
notes[LAUNCHED] = 1;
ourtime++;
fuel -= 4;
- puts("You climb into the viper and prepare for launch.");
- puts("With a touch of your thumb the turbo engines ignite, thrusting you back into\nyour seat.");
+ printf("You climb into the viper and prepare for ");
+ puts("launch.");
+ printf("With a touch of your thumb the turbo engines ");
+ printf("ignite, thrusting you back into\nyour seat.\n");
return (1);
} else
puts("Not enough fuel to launch.");
@@ -62,7 +64,7 @@ launch()
}
int
-land()
+land(void)
{
if (notes[LAUNCHED] && testbit(location[position].objects, LAND) &&
location[position].down) {
@@ -79,7 +81,7 @@ land()
}
void
-die()
+die(void)
{ /* endgame */
printf("bye.\nYour rating was %s.\n", rate());
post(' ');
@@ -87,14 +89,13 @@ die()
}
void
-diesig(dummy)
- int dummy __attribute__((__unused__));
+diesig(int dummy __attribute__((__unused__)))
{
die();
}
void
-live()
+live(void)
{
puts("\nYou win!");
post('!');
@@ -104,7 +105,7 @@ live()
static FILE *score_fp;
void
-open_score_file()
+open_score_file(void)
{
score_fp = fopen(_PATH_SCORE, "a");
if (score_fp == NULL)
@@ -114,21 +115,21 @@ open_score_file()
}
void
-post(ch)
- char ch;
+post(int ch)
{
time_t tv;
char *date;
- sigset_t sigset, osigset;
+ sigset_t isigset, osigset;
- sigemptyset(&sigset);
- sigaddset(&sigset, SIGINT);
- sigprocmask(SIG_BLOCK, &sigset, &osigset);
+ sigemptyset(&isigset);
+ sigaddset(&isigset, SIGINT);
+ sigprocmask(SIG_BLOCK, &isigset, &osigset);
tv = time(NULL);
date = ctime(&tv);
date[24] = '\0';
if (score_fp != NULL) {
- fprintf(score_fp, "%s %8s %c%20s", date, username, ch, rate());
+ fprintf(score_fp, "%s %8s %c%20s", date, username,
+ ch, rate());
if (wiz)
fprintf(score_fp, " wizard\n");
else
@@ -140,8 +141,8 @@ post(ch)
sigprocmask(SIG_SETMASK, &osigset, (sigset_t *) 0);
}
-const char *
-rate()
+const char *
+rate(void)
{
int score;
@@ -179,10 +180,11 @@ rate()
}
int
-drive()
+drive(void)
{
if (testbit(location[position].objects, CAR)) {
- puts("You hop in the car and turn the key. There is a perceptible grating noise,");
+ printf("You hop in the car and turn the key. There is ");
+ puts("a perceptible grating noise,");
puts("and an explosion knocks you unconscious...");
clearbit(location[position].objects, CAR);
setbit(location[position].objects, CRASH);
@@ -196,13 +198,16 @@ drive()
}
int
-ride()
+ride(void)
{
if (testbit(location[position].objects, HORSE)) {
- 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.");
+ printf("You climb onto the stallion and kick it in the guts.");
+ puts(" The stupid steed launches");
+ 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 || !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)
@@ -220,7 +225,7 @@ ride()
}
void
-light()
+light(void)
{ /* synonyms = {strike, smoke} *//* for
* matches, cigars */
if (testbit(inven, MATCHES) && matchcount) {
@@ -229,7 +234,8 @@ light()
matchlight = 1;
matchcount--;
if (position == 217) {
- puts("The whole bungalow explodes with an intense blast.");
+ printf("The whole bungalow explodes with an ");
+ puts("intense blast.");
die();
}
} else
@@ -237,7 +243,7 @@ light()
}
void
-dooropen()
+dooropen(void)
{ /* synonyms = {open, unlock} */
wordnumber++;
if (wordnumber <= wordcount && wordtype[wordnumber] == NOUNS
diff --git a/battlestar/command7.c b/battlestar/command7.c
index d483245c..1323f577 100644
--- a/battlestar/command7.c
+++ b/battlestar/command7.c
@@ -1,4 +1,4 @@
-/* $NetBSD: command7.c,v 1.2 2003/08/07 09:37:01 agc Exp $ */
+/* $NetBSD: command7.c,v 1.3 2005/07/01 06:04:54 jmc Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,15 +34,14 @@
#if 0
static char sccsid[] = "@(#)com7.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: command7.c,v 1.2 2003/08/07 09:37:01 agc Exp $");
+__RCSID("$NetBSD: command7.c,v 1.3 2005/07/01 06:04:54 jmc Exp $");
#endif
#endif /* not lint */
#include "extern.h"
int
-fight(enemy, strength)
- int enemy, strength;
+fight(int enemy, int strength)
{
int lifeline = 0;
int hurt;
@@ -72,11 +71,17 @@ fighton:
case KILL:
case SMITE:
if (testbit(inven, TWO_HANDED))
- hurt = rnd(70) - 2 * card(injuries, NUMOFINJURIES) - ucard(wear) - exhaustion;
+ 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 - exhaustion;
- else if (testbit(inven, KNIFE) || testbit(inven, MALLET) || testbit(inven, CHAIN) || testbit(inven, MACE) || testbit(inven, HALBERD))
- hurt = rnd(15) - card(injuries, NUMOFINJURIES) - exhaustion;
+ hurt = rnd(50) % (WEIGHT - carrying) -
+ card(injuries, NUMOFINJURIES) - encumber -
+ exhaustion;
+ else if (testbit(inven, KNIFE) || testbit(inven, MALLET) ||
+ testbit(inven, CHAIN) || testbit(inven, MACE) ||
+ testbit(inven, HALBERD))
+ hurt = rnd(15) - card(injuries, NUMOFINJURIES) -
+ exhaustion;
else
hurt = rnd(7) - encumber;
if (hurt < 5)
@@ -89,7 +94,8 @@ fighton:
puts("He checked your blow. CLASH! CLANG!");
break;
case 2:
- puts("His filthy tunic hangs by one less thread.");
+ printf("His filthy tunic hangs by one less ");
+ puts("thread.");
break;
}
else if (hurt < 10) {
@@ -101,7 +107,8 @@ fighton:
puts("A trickle of blood runs down his face.");
break;
case 2:
- puts("A huge purple bruise is forming on the side of his face.");
+ printf("A huge purple bruise is forming on ");
+ puts("the side of his face.");
break;
}
lifeline++;
@@ -111,23 +118,29 @@ fighton:
puts("He staggers back quavering.");
break;
case 1:
- puts("He jumps back with his hand over the wound.");
+ printf("He jumps back with his hand over ");
+ puts("the wound.");
break;
case 2:
- puts("His shirt falls open with a swath across the chest.");
+ printf("His shirt falls open with a swath ");
+ puts("across the chest.");
break;
}
lifeline += 5;
} else if (hurt < 30) {
switch (rnd(3)) {
case 0:
- printf("A bloody gash opens up on his %s side.\n", (rnd(2) ? "left" : "right"));
+ printf("A bloody gash opens up on his %s ",
+ (rnd(2) ? "left" : "right"));
+ printf("side.\n");
break;
case 1:
- puts("The steel bites home and scrapes along his ribs.");
+ printf("The steel bites home and scrapes ");
+ puts("along his ribs.");
break;
case 2:
- puts("You pierce him, and his breath hisses through clenched teeth.");
+ printf("You pierce him, and his breath ");
+ puts("hisses through clenched teeth.");
break;
}
lifeline += 10;
@@ -135,30 +148,40 @@ fighton:
switch (rnd(3)) {
case 0:
puts("You smite him to the ground.");
- if (strength - lifeline > 20)
- puts("But in a flurry of steel he regains his feet!");
+ if (strength - lifeline > 20) {
+ printf("But in a flurry of steel he ");
+ puts("regains his feet!");
+ }
break;
case 1:
- puts("The force of your blow sends him to his knees.");
+ printf("The force of your blow sends him to ");
+ puts("his knees.");
puts("His arm swings lifeless at his side.");
break;
case 2:
- puts("Clutching his blood drenched shirt, he collapses stunned.");
+ printf("Clutching his blood drenched shirt, ");
+ puts("he collapses stunned.");
break;
}
lifeline += 20;
} else {
switch (rnd(3)) {
case 0:
- puts("His ribs crack under your powerful swing, flooding his lungs with blood.");
+ printf("His ribs crack under your powerful ");
+ puts("swing, flooding his lungs with blood.");
break;
case 1:
- puts("You shatter his upheld arm in a spray of blood. The blade continues deep");
- puts("into his back, severing the spinal cord.");
+ printf("You shatter his upheld arm in a ");
+ printf("spray of blood. The blade ");
+ puts("continues deep");
+ printf("into his back, severing the ");
+ puts("spinal cord.");
lifeline += 25;
break;
case 2:
- puts("With a mighty lunge the steel slides in, and gasping, he falls to the ground.");
+ printf("With a mighty lunge the steel ");
+ printf("slides in, and gasping, he falls ");
+ puts("to the ground.");
lifeline += 25;
break;
}
@@ -168,13 +191,21 @@ fighton:
case BACK:
if (enemy == DARK && lifeline > strength * 0.33) {
- puts("He throws you back against the rock and pummels your face.");
+ printf("He throws you back against the rock and ");
+ puts("pummels your face.");
if (testbit(inven, AMULET) || testbit(wear, AMULET)) {
printf("Lifting the amulet from you, ");
- if (testbit(inven, MEDALION) || testbit(wear, MEDALION)) {
- puts("his power grows and the walls of\nthe earth tremble.");
- puts("When he touches the medallion, your chest explodes and the foundations of the\nearth collapse.");
- puts("The planet is consumed by darkness.");
+ if (testbit(inven, MEDALION) ||
+ testbit(wear, MEDALION)) {
+ printf("his power grows and the ");
+ printf("walls of\nthe earth ");
+ printf("tremble.\n");
+ printf("When he touches the ");
+ printf("medallion, your chest ");
+ printf("explodes and the foundations ");
+ printf("of the\nearth collapse.\n");
+ printf("The planet is consumed by ");
+ puts("darkness.");
die();
}
if (testbit(inven, AMULET)) {
@@ -193,8 +224,10 @@ fighton:
die();
}
} else {
- puts("You escape stunned and disoriented from the fight.");
- puts("A victorious bellow echoes from the battlescene.");
+ printf("You escape stunned and disoriented from ");
+ puts("the fight.");
+ printf("A victorious bellow echoes from the ");
+ puts("battlescene.");
if (back && position != back)
moveplayer(back, BACK);
else if (ahead && position != ahead)
@@ -211,10 +244,13 @@ fighton:
case SHOOT:
if (testbit(inven, LASER)) {
if (strength - lifeline <= 50) {
- printf("The %s took a direct hit!\n", objsht[enemy]);
+ printf("The %s took a direct hit!\n",
+ objsht[enemy]);
lifeline += 50;
} else {
- puts("With his bare hand he deflects the laser blast and whips the pistol from you!");
+ printf("With his bare hand he deflects the ");
+ printf("laser blast and whips the pistol ");
+ puts("from you!");
clearbit(inven, LASER);
setbit(location[position].objects, LASER);
carrying -= objwt[LASER];
@@ -238,7 +274,8 @@ fighton:
if (lifeline >= strength) {
printf("You have killed the %s.\n", objsht[enemy]);
if (enemy == ELF || enemy == DARK)
- puts("A watery black smoke consumes his body and then vanishes with a peal of thunder!");
+ printf("A watery black smoke consumes his body and ");
+ puts("then vanishes with a peal of thunder!");
clearbit(location[position].objects, enemy);
power += 2;
notes[JINXED]++;
@@ -246,8 +283,10 @@ fighton:
}
puts("He attacks...");
/* Some embellishments. */
- hurt = rnd(NUMOFINJURIES) - (testbit(inven, SHIELD) != 0) - (testbit(wear, MAIL) != 0) - (testbit(wear, HELM) != 0);
- hurt += (testbit(wear, AMULET) != 0) + (testbit(wear, MEDALION) != 0) + (testbit(wear, TALISMAN) != 0);
+ hurt = rnd(NUMOFINJURIES) - (testbit(inven, SHIELD) != 0) -
+ (testbit(wear, MAIL) != 0) - (testbit(wear, HELM) != 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;
if (!injuries[hurt]) {
diff --git a/battlestar/cypher.c b/battlestar/cypher.c
index 5131dca0..fa811924 100644
--- a/battlestar/cypher.c
+++ b/battlestar/cypher.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cypher.c,v 1.22 2003/08/07 09:37:01 agc Exp $ */
+/* $NetBSD: cypher.c,v 1.23 2005/07/01 06:04:54 jmc Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,14 +34,14 @@
#if 0
static char sccsid[] = "@(#)cypher.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: cypher.c,v 1.22 2003/08/07 09:37:01 agc Exp $");
+__RCSID("$NetBSD: cypher.c,v 1.23 2005/07/01 06:04:54 jmc Exp $");
#endif
#endif /* not lint */
#include "extern.h"
int
-cypher()
+cypher(void)
{
int n;
int junk;
@@ -52,9 +52,11 @@ cypher()
while (wordnumber <= wordcount) {
if (wordtype[wordnumber] != VERB &&
- !(wordtype[wordnumber] == OBJECT && wordvalue[wordnumber] == KNIFE)) {
+ !(wordtype[wordnumber] == OBJECT &&
+ wordvalue[wordnumber] == KNIFE)) {
printf("%s: How's that?\n",
- (wordnumber == wordcount) ? words[0] : words[wordnumber]);
+ (wordnumber == wordcount) ? words[0] :
+ words[wordnumber]);
return (-1);
}
@@ -70,8 +72,10 @@ cypher()
case UP:
if (location[position].access || wiz || tempwiz) {
- if (!location[position].access)
- puts("Zap! A gust of wind lifts you up.");
+ if (!location[position].access) {
+ printf("Zap! A gust of wind lifts ");
+ puts("you up.");
+ }
if (!moveplayer(location[position].up, AHEAD))
return (-1);
} else {
@@ -112,11 +116,13 @@ cypher()
break;
case SHOOT:
- if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
+ if (wordnumber < wordcount &&
+ wordvalue[wordnumber + 1] == EVERYTHING) {
int things;
things = 0;
for (n = 0; n < NUMOFOBJECTS; n++)
- if (testbit(location[position].objects, n) && objsht[n]) {
+ if (testbit(location[position].objects,
+ n) && objsht[n]) {
things++;
wordvalue[wordnumber + 1] = n;
wordnumber = shoot();
@@ -130,11 +136,13 @@ cypher()
break;
case TAKE:
- if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
+ if (wordnumber < wordcount &&
+ wordvalue[wordnumber + 1] == EVERYTHING) {
int things;
things = 0;
for (n = 0; n < NUMOFOBJECTS; n++)
- if (testbit(location[position].objects, n) && objsht[n]) {
+ if (testbit(location[position].objects,
+ n) && objsht[n]) {
things++;
wordvalue[wordnumber + 1] = n;
/* Some objects (type NOUNS)
@@ -179,7 +187,8 @@ cypher()
break;
case DROP:
- if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
+ if (wordnumber < wordcount &&
+ wordvalue[wordnumber + 1] == EVERYTHING) {
int things;
things = 0;
for (n = 0; n < NUMOFOBJECTS; n++)
@@ -198,7 +207,8 @@ cypher()
case KICK:
case THROW:
- if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
+ if (wordnumber < wordcount &&
+ wordvalue[wordnumber + 1] == EVERYTHING) {
int things, wv;
things = 0;
wv = wordvalue[wordnumber];
@@ -211,13 +221,16 @@ cypher()
}
wordnumber += 2;
if (!things)
- printf("Nothing to %s!\n", wv == KICK ? "kick" : "throw");
+ printf("Nothing to %s!\n",
+ wv == KICK ? "kick" : "throw");
} else
- throw(wordvalue[wordnumber] == KICK ? "Kicked" : "Thrown");
+ throw(wordvalue[wordnumber] ==
+ KICK ? "Kicked" : "Thrown");
break;
case TAKEOFF:
- if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
+ if (wordnumber < wordcount &&
+ wordvalue[wordnumber + 1] == EVERYTHING) {
int things;
things = 0;
for (n = 0; n < NUMOFOBJECTS; n++)
@@ -234,7 +247,8 @@ cypher()
break;
case DRAW:
- if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
+ if (wordnumber < wordcount &&
+ wordvalue[wordnumber + 1] == EVERYTHING) {
int things;
things = 0;
for (n = 0; n < NUMOFOBJECTS; n++)
@@ -251,11 +265,13 @@ cypher()
break;
case PUTON:
- if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
+ if (wordnumber < wordcount &&
+ wordvalue[wordnumber + 1] == EVERYTHING) {
int things;
things = 0;
for (n = 0; n < NUMOFOBJECTS; n++)
- if (testbit(location[position].objects, n) && objsht[n]) {
+ if (testbit(location[position].objects,
+ n) && objsht[n]) {
things++;
wordvalue[wordnumber + 1] = n;
wordnumber = puton();
@@ -268,7 +284,8 @@ cypher()
break;
case WEARIT:
- if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
+ if (wordnumber < wordcount &&
+ wordvalue[wordnumber + 1] == EVERYTHING) {
int things;
things = 0;
for (n = 0; n < NUMOFOBJECTS; n++)
@@ -285,7 +302,8 @@ cypher()
break;
case EAT:
- if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
+ if (wordnumber < wordcount &&
+ wordvalue[wordnumber + 1] == EVERYTHING) {
int things;
things = 0;
for (n = 0; n < NUMOFOBJECTS; n++)
@@ -311,19 +329,23 @@ cypher()
for (n = 0; n < NUMOFOBJECTS; n++)
if (testbit(inven, n))
printf("\t%s\n", objsht[n]);
- if (WEIGHT == 0)
- printf("\n= %d kilogram%s (can't lift any weight%s)\n",
+ if (WEIGHT == 0) {
+ printf("\n= %d kilogram%s",
carrying,
- (carrying == 1 ? "." : "s."),
- (carrying ? " or move with what you have" : ""));
- else
+ (carrying == 1 ? "." : "s."));
+ printf(" (can't lift any weight%s)\n",
+ (carrying ?
+ " or move with what you have" :
+ ""));
+ } else
printf("\n= %d kilogram%s (%d%%)\n",
carrying,
(carrying == 1 ? "." : "s."),
carrying * 100 / WEIGHT);
- if (CUMBER == 0)
- printf("Your arms can't pick anything up.\n");
- else
+ if (CUMBER == 0) {
+ printf("Your arms can't pick ");
+ printf("anything up.\n");
+ } else
printf("Your arms are %d%% full.\n",
encumber * 100 / CUMBER);
} else
@@ -341,7 +363,9 @@ cypher()
for (n = 0; n < NUMOFINJURIES; n++)
if (injuries[n])
printf("\t%s\n", ouch[n]);
- printf("\nYou can still carry up to %d kilogram%s\n", WEIGHT, (WEIGHT == 1 ? "." : "s."));
+ printf("\nYou can still carry up to ");
+ printf("%d kilogram%s\n", WEIGHT,
+ (WEIGHT == 1 ? "." : "s."));
} else
puts("\nYou are in perfect health.");
wordnumber++;
@@ -352,7 +376,8 @@ cypher()
break;
case OPEN:
- if (wordnumber < wordcount && wordvalue[wordnumber + 1] == EVERYTHING) {
+ if (wordnumber < wordcount &&
+ wordvalue[wordnumber + 1] == EVERYTHING) {
int things;
things = 0;
for (n = 0; n < NUMOFOBJECTS; n++)
@@ -430,8 +455,12 @@ cypher()
case SCORE:
printf("\tPLEASURE\tPOWER\t\tEGO\n");
printf("\t%3d\t\t%3d\t\t%3d\n\n", pleasure, power, ego);
- printf("This gives you the rating of %s in %d turns.\n", rate(), ourtime);
- printf("You have visited %d out of %d rooms this run (%d%%).\n", card(beenthere, NUMOFROOMS), NUMOFROOMS, card(beenthere, NUMOFROOMS) * 100 / NUMOFROOMS);
+ printf("This gives you the rating of ");
+ 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",
+ card(beenthere, NUMOFROOMS) * 100 / NUMOFROOMS);
break;
case KNIFE:
diff --git a/battlestar/extern.h b/battlestar/extern.h
index 3c9c9c40..ec0e6022 100644
--- a/battlestar/extern.h
+++ b/battlestar/extern.h
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.30 2004/01/27 20:30:29 jsm Exp $ */
+/* $NetBSD: extern.h,v 1.31 2005/07/01 06:04:54 jmc Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -362,7 +362,7 @@ void news(void);
void newway(int);
void open_score_file(void);
void parse(void);
-void post(char);
+void post(int);
void printobjs(void);
int put(void);
int puton(void);
@@ -376,7 +376,7 @@ int shoot(void);
int take(unsigned int[]);
int takeoff(void);
int throw(const char *);
-const char *truedirec(int, char);
+const char *truedirec(int, int);
int ucard(const unsigned int *);
int use(void);
int visual(void);
diff --git a/battlestar/fly.c b/battlestar/fly.c
index d0353a31..e2e298d3 100644
--- a/battlestar/fly.c
+++ b/battlestar/fly.c
@@ -1,4 +1,4 @@
-/* $NetBSD: fly.c,v 1.12 2004/01/27 20:30:29 jsm Exp $ */
+/* $NetBSD: fly.c,v 1.13 2005/07/01 06:04:54 jmc 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.12 2004/01/27 20:30:29 jsm Exp $");
+__RCSID("$NetBSD: fly.c,v 1.13 2005/07/01 06:04:54 jmc Exp $");
#endif
#endif /* not lint */
@@ -61,8 +61,7 @@ static void succumb(int);
static void target(void);
static void
-succumb(dummy)
- int dummy __attribute__((__unused__));
+succumb(int dummy __attribute__((__unused__)))
{
if (oldsig == SIG_DFL) {
endfly();
@@ -75,7 +74,7 @@ succumb(dummy)
}
int
-visual()
+visual(void)
{
destroyed = 0;
if (initscr() == NULL) {
@@ -151,7 +150,8 @@ visual()
if (torps) {
torps -= 2;
blast();
- if (row == MIDR && column - MIDC < 2 && MIDC - column < 2) {
+ if (row == MIDR && column - MIDC < 2 &&
+ MIDC - column < 2) {
destroyed = 1;
alarm(0);
}
@@ -182,7 +182,7 @@ visual()
}
static void
-screen()
+screen(void)
{
int r, c, n;
int i;
@@ -199,7 +199,7 @@ screen()
}
static void
-target()
+target(void)
{
int n;
@@ -212,7 +212,7 @@ target()
}
static void
-notarget()
+notarget(void)
{
int n;
@@ -225,7 +225,7 @@ notarget()
}
static void
-blast()
+blast(void)
{
int n;
@@ -247,8 +247,7 @@ blast()
}
static void
-moveenemy(dummy)
- int dummy __attribute__((__unused__));
+moveenemy(int dummy __attribute__((__unused__)))
{
double d;
int oldr, oldc;
@@ -265,7 +264,8 @@ moveenemy(dummy)
fuel = 0;
mvaddstr(0, 60, "*** Out of fuel ***");
}
- d = (double) ((row - MIDR) * (row - MIDR) + (column - MIDC) * (column - MIDC));
+ d = (double) ((row - MIDR) * (row - MIDR) + (column - MIDC) *
+ (column - MIDC));
if (d < 16) {
row += (rnd(9) - 4) % (4 - abs(row - MIDR));
column += (rnd(9) - 4) % (4 - abs(column - MIDC));
@@ -287,7 +287,7 @@ moveenemy(dummy)
}
static void
-endfly()
+endfly(void)
{
alarm(0);
signal(SIGALRM, SIG_DFL);
diff --git a/battlestar/getcom.c b/battlestar/getcom.c
index 1b60e11f..46bcd2c1 100644
--- a/battlestar/getcom.c
+++ b/battlestar/getcom.c
@@ -1,4 +1,4 @@
-/* $NetBSD: getcom.c,v 1.12 2004/11/05 21:30:31 dsl Exp $ */
+/* $NetBSD: getcom.c,v 1.13 2005/07/01 06:04:54 jmc Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,17 +34,14 @@
#if 0
static char sccsid[] = "@(#)getcom.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: getcom.c,v 1.12 2004/11/05 21:30:31 dsl Exp $");
+__RCSID("$NetBSD: getcom.c,v 1.13 2005/07/01 06:04:54 jmc Exp $");
#endif
#endif /* not lint */
#include "extern.h"
-char *
-getcom(buf, size, prompt, error)
- char *buf;
- int size;
- const char *prompt, *error;
+char *
+getcom(char *buf, int size, const char *prompt, const char *error)
{
for (;;) {
fputs(prompt, stdout);
@@ -61,7 +58,7 @@ getcom(buf, size, prompt, error)
if (error)
puts(error);
}
- /* If we didn't get to the end of the line, don't read it in next time. */
+ /* If we didn't get to the end of line, don't read it in next time. */
if (buf[strlen(buf) - 1] != '\n') {
int i;
while ((i = getchar()) != '\n' && i != EOF)
@@ -76,9 +73,7 @@ getcom(buf, size, prompt, error)
* and leaves it unchanged if flag = 0
*/
char *
-getword(buf1, buf2, flag)
- char *buf1, *buf2;
- int flag;
+getword(char *buf1, char *buf2, int flag)
{
int cnt;
@@ -90,10 +85,12 @@ getword(buf1, buf2, flag)
*buf2 = 0;
return (0);
}
- while (cnt < WORDLEN && *buf1 && !isspace((unsigned char)*buf1) && *buf1 != ',')
+ while (cnt < WORDLEN && *buf1 &&
+ !isspace((unsigned char)*buf1) && *buf1 != ',')
if (flag < 0) {
if (isupper((unsigned char)*buf1)) {
- *buf2++ = tolower((unsigned char)*buf1++);
+ *buf2++ =
+ tolower((unsigned char)*buf1++);
cnt++;
} else {
*buf2++ = *buf1++;
@@ -101,7 +98,8 @@ getword(buf1, buf2, flag)
}
} else if (flag > 0) {
if (islower((unsigned char)*buf1)) {
- *buf2++ = toupper((unsigned char)*buf1++);
+ *buf2++ =
+ toupper((unsigned char)*buf1++);
cnt++;
} else {
*buf2++ = *buf1++;
diff --git a/battlestar/init.c b/battlestar/init.c
index e904aad1..93cbb2ff 100644
--- a/battlestar/init.c
+++ b/battlestar/init.c
@@ -1,4 +1,4 @@
-/* $NetBSD: init.c,v 1.14 2004/01/27 20:30:29 jsm Exp $ */
+/* $NetBSD: init.c,v 1.15 2005/07/01 06:04:54 jmc Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)init.c 8.4 (Berkeley) 4/30/95";
#else
-__RCSID("$NetBSD: init.c,v 1.14 2004/01/27 20:30:29 jsm Exp $");
+__RCSID("$NetBSD: init.c,v 1.15 2005/07/01 06:04:54 jmc Exp $");
#endif
#endif /* not lint */
@@ -45,8 +45,7 @@ static const char *getutmp(void);
static int wizard(const char *);
void
-initialize(filename)
- const char *filename;
+initialize(const char *filename)
{
const struct objs *p;
char *savefile;
@@ -78,7 +77,7 @@ initialize(filename)
}
static const char *
-getutmp()
+getutmp(void)
{
struct passwd *ptr;
@@ -109,8 +108,7 @@ static const char *const badguys[] = {
};
static int
-wizard(uname)
- const char *uname;
+wizard(const char *uname)
{
int flag;
@@ -120,8 +118,7 @@ wizard(uname)
}
static int
-checkout(uname)
- const char *uname;
+checkout(const char *uname)
{
const char *const *ptr;
diff --git a/battlestar/misc.c b/battlestar/misc.c
index 5bcbacb7..f83252d8 100644
--- a/battlestar/misc.c
+++ b/battlestar/misc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: misc.c,v 1.8 2003/08/07 09:37:02 agc Exp $ */
+/* $NetBSD: misc.c,v 1.9 2005/07/01 06:04:54 jmc Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,16 +34,15 @@
#if 0
static char sccsid[] = "@(#)misc.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: misc.c,v 1.8 2003/08/07 09:37:02 agc Exp $");
+__RCSID("$NetBSD: misc.c,v 1.9 2005/07/01 06:04:54 jmc Exp $");
#endif
#endif /* not lint */
#include "extern.h"
+/* for beenthere, injuries */
int
-card(array, size) /* for beenthere, injuries */
- const char *array;
- int size;
+card(const char *array, int size)
{
const char *end = array + size;
int i = 0;
@@ -55,8 +54,7 @@ card(array, size) /* for beenthere, injuries */
}
int
-ucard(array)
- const unsigned int *array;
+ucard(const unsigned int *array)
{
int j = 0, n;
diff --git a/battlestar/parse.c b/battlestar/parse.c
index c1505a3a..4b4b3bc6 100644
--- a/battlestar/parse.c
+++ b/battlestar/parse.c
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.14 2004/01/27 20:30:29 jsm Exp $ */
+/* $NetBSD: parse.c,v 1.15 2005/07/01 06:04:54 jmc 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.14 2004/01/27 20:30:29 jsm Exp $");
+__RCSID("$NetBSD: parse.c,v 1.15 2005/07/01 06:04:54 jmc Exp $");
#endif
#endif /* not lint */
@@ -51,7 +51,7 @@ static struct wlist *lookup(const char *);
static struct wlist *hashtab[HASHSIZE];
void
-wordinit()
+wordinit(void)
{
struct wlist *w;
@@ -60,8 +60,7 @@ wordinit()
}
static int
-hash(s)
- const char *s;
+hash(const char *s)
{
int hashval = 0;
@@ -74,8 +73,7 @@ hash(s)
}
static struct wlist *
-lookup(s)
- const char *s;
+lookup(const char *s)
{
struct wlist *wp;
@@ -86,8 +84,7 @@ lookup(s)
}
static void
-install(wp)
- struct wlist *wp;
+install(struct wlist *wp)
{
int hashval;
@@ -100,7 +97,7 @@ install(wp)
}
void
-parse()
+parse(void)
{
struct wlist *wp;
int n;
@@ -157,8 +154,10 @@ parse()
while (flag) {
flag = 0;
for (n = 1; n < wordcount; n++)
- if ((wordtype[n - 1] == NOUNS || wordtype[n - 1] == OBJECT) &&
- wordvalue[n] == AND && wordvalue[n + 1] == EVERYTHING) {
+ if ((wordtype[n - 1] == NOUNS ||
+ wordtype[n - 1] == OBJECT) &&
+ wordvalue[n] == AND &&
+ wordvalue[n + 1] == EVERYTHING) {
char tmpword[WORDLEN];
wordvalue[n + 1] = wordvalue[n - 1];
wordvalue[n - 1] = EVERYTHING;
@@ -172,7 +171,8 @@ parse()
/* And trim EVERYTHING AND EVERYTHING. */
for (n = 1; n < wordcount; n++)
if (wordvalue[n - 1] == EVERYTHING &&
- wordvalue[n] == AND && wordvalue[n + 1] == EVERYTHING) {
+ wordvalue[n] == AND &&
+ wordvalue[n + 1] == EVERYTHING) {
int i;
for (i = n + 1; i < wordcount; i++) {
wordtype[i - 1] = wordtype[i + 1];
diff --git a/battlestar/room.c b/battlestar/room.c
index 5cbaf850..81d28a67 100644
--- a/battlestar/room.c
+++ b/battlestar/room.c
@@ -1,4 +1,4 @@
-/* $NetBSD: room.c,v 1.11 2003/08/07 09:37:03 agc Exp $ */
+/* $NetBSD: room.c,v 1.12 2005/07/01 06:04:54 jmc Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,14 +34,14 @@
#if 0
static char sccsid[] = "@(#)room.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: room.c,v 1.11 2003/08/07 09:37:03 agc Exp $");
+__RCSID("$NetBSD: room.c,v 1.12 2005/07/01 06:04:54 jmc Exp $");
#endif
#endif /* not lint */
#include "extern.h"
void
-writedes()
+writedes(void)
{
int compass;
const char *p;
@@ -65,7 +65,7 @@ writedes()
}
void
-printobjs()
+printobjs(void)
{
unsigned int *p = location[position].objects;
int n;
@@ -77,8 +77,7 @@ printobjs()
}
void
-whichway(here)
- struct room here;
+whichway(struct room here)
{
switch (direction) {
@@ -113,10 +112,8 @@ whichway(here)
}
}
-const char *
-truedirec(way, option)
- int way;
- char option;
+const char *
+truedirec(int way, int option)
{
switch (way) {
@@ -173,14 +170,14 @@ truedirec(way, option)
}
default:
- printf("Error: room %d. More than four directions wanted.", position);
+ printf("Error: room %d. More than four directions wanted.",
+ position);
return ("!!");
}
}
void
-newway(thisway)
- int thisway;
+newway(int thisway)
{
switch (direction) {
diff --git a/battlestar/save.c b/battlestar/save.c
index 0ed15a94..8af9142b 100644
--- a/battlestar/save.c
+++ b/battlestar/save.c
@@ -1,4 +1,4 @@
-/* $NetBSD: save.c,v 1.11 2003/08/07 09:37:03 agc Exp $ */
+/* $NetBSD: save.c,v 1.12 2005/07/01 06:04:54 jmc Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,15 +34,14 @@
#if 0
static char sccsid[] = "@(#)save.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: save.c,v 1.11 2003/08/07 09:37:03 agc Exp $");
+__RCSID("$NetBSD: save.c,v 1.12 2005/07/01 06:04:54 jmc Exp $");
#endif
#endif /* not lint */
#include "extern.h"
void
-restore(filename)
- const char *filename;
+restore(const char *filename)
{
int n;
int tmp;
@@ -94,8 +93,7 @@ restore(filename)
}
void
-save(filename)
- const char *filename;
+save(const char *filename)
{
int n;
int tmp;
@@ -156,9 +154,7 @@ save(filename)
* with malloc(3).
*/
char *
-save_file_name(filename, len)
- const char *filename;
- size_t len;
+save_file_name(const char *filename, size_t len)
{
char *home;
char *newname;