From 61a235f9c8a332df14e8fe40b7b1fcaa98ecc548 Mon Sep 17 00:00:00 2001 From: lukem Date: Sat, 11 Oct 1997 02:06:55 +0000 Subject: KNFify (with indent) --- battlestar/com1.c | 148 +++++++++++++++++++++++++++--------------------------- 1 file changed, 74 insertions(+), 74 deletions(-) (limited to 'battlestar/com1.c') diff --git a/battlestar/com1.c b/battlestar/com1.c index 69e30458..ae6aa7a3 100644 --- a/battlestar/com1.c +++ b/battlestar/com1.c @@ -1,4 +1,4 @@ -/* $NetBSD: com1.c,v 1.5 1997/10/10 11:39:16 lukem Exp $ */ +/* $NetBSD: com1.c,v 1.6 1997/10/11 02:06:58 lukem Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,15 +38,15 @@ #if 0 static char sccsid[] = "@(#)com1.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: com1.c,v 1.5 1997/10/10 11:39:16 lukem Exp $"); +__RCSID("$NetBSD: com1.c,v 1.6 1997/10/11 02:06:58 lukem Exp $"); #endif -#endif /* not lint */ +#endif /* not lint */ #include "extern.h" int move(thataway, token) - int thataway, token; + int thataway, token; { wordnumber++; if ((!notes[CANTMOVE] && !notes[LAUNCHED]) || @@ -56,26 +56,27 @@ move(thataway, token) position = thataway; newway(token); ourtime++; - } - else { + } else { puts("You can't go this way."); newway(token); whichway(location[position]); - return(0); + 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!"); - return(1); + 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!"); + return (1); } 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(tothis) /* Converts day to night and vice versa. */ + int tothis; /* Day objects are permanent. Night objects + * are added */ +{ /* at dusk, and subtracted at dawn. */ struct objs *p; - int i, j; + int i, j; if (tothis == TONIGHT) { for (i = 1; i <= NUMOFROOMS; i++) @@ -97,10 +98,10 @@ convert(tothis) /* Converts day to night and vice versa. */ void news() { - int n; - int hurt; + int n; + int hurt; - if (ourtime > 30 && position < 32){ + 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"); puts("frozen void of space and killed."); @@ -108,7 +109,7 @@ news() } if (ourtime > 20 && position < 32) puts("Explosions rock the battlestar."); - if (ourtime > snooze){ + if (ourtime > snooze) { puts("You drop from exhaustion..."); zzz(); } @@ -135,92 +136,91 @@ news() 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."); + } + if (testbit(location[position].objects, ELF)) { + printf("%s\n", objdes[ELF]); + fight(ELF, rnd(30)); } - if (testbit(location[position].objects,ELF)){ - printf("%s\n",objdes[ELF]); - fight(ELF,rnd(30)); - } - if (testbit(location[position].objects,DARK)){ - printf("%s\n",objdes[DARK]); - fight(DARK,100); + if (testbit(location[position].objects, DARK)) { + printf("%s\n", objdes[DARK]); + fight(DARK, 100); } - if (testbit(location[position].objects,WOODSMAN)){ - printf("%s\n",objdes[WOODSMAN]); - fight(WOODSMAN,50); + if (testbit(location[position].objects, WOODSMAN)) { + printf("%s\n", objdes[WOODSMAN]); + fight(WOODSMAN, 50); } - switch(position){ - - case 267: - case 257: /* entering a cave */ - case 274: - case 246: - notes[CANTSEE] = 1; - break; - case 160: - case 216: /* leaving a cave */ - case 230: - case 231: - case 232: - notes[CANTSEE] = 0; - break; + switch (position) { + + case 267: + case 257: /* entering a cave */ + case 274: + case 246: + notes[CANTSEE] = 1; + break; + case 160: + case 216: /* leaving a cave */ + case 230: + case 231: + case 232: + notes[CANTSEE] = 0; + break; } if (testbit(location[position].objects, GIRL)) meetgirl = 1; - if (meetgirl && CYCLE * 1.5 - ourtime < 10){ - setbit(location[GARDEN].objects,GIRLTALK); - setbit(location[GARDEN].objects,LAMPON); - setbit(location[GARDEN].objects,ROPE); + if (meetgirl && CYCLE * 1.5 - ourtime < 10) { + setbit(location[GARDEN].objects, GIRLTALK); + setbit(location[GARDEN].objects, LAMPON); + setbit(location[GARDEN].objects, ROPE); } - if (position == DOCK && (beenthere[position] || ourtime > CYCLE)){ + if (position == DOCK && (beenthere[position] || ourtime > CYCLE)) { clearbit(location[DOCK].objects, GIRL); - clearbit(location[DOCK].objects,MAN); + clearbit(location[DOCK].objects, MAN); } - if (meetgirl && ourtime - CYCLE * 1.5 > 10){ - clearbit(location[GARDEN].objects,GIRLTALK); - clearbit(location[GARDEN].objects,LAMPON); - clearbit(location[GARDEN].objects,ROPE); + if (meetgirl && ourtime - CYCLE * 1.5 > 10) { + clearbit(location[GARDEN].objects, GIRLTALK); + clearbit(location[GARDEN].objects, LAMPON); + clearbit(location[GARDEN].objects, ROPE); meetgirl = 0; } - if (testbit(location[position].objects,CYLON)){ + 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", ourclock); fflush(stdout); sleep(1); - if (!visual()){ + if (!visual()) { hurt = rnd(NUMOFINJURIES); injuries[hurt] = 1; puts("Laser blasts sear the cockpit, and the alien 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]); - } - else - clearbit(location[position].objects,CYLON); + } else + clearbit(location[position].objects, CYLON); } - if (injuries[SKULL] && injuries[INCISE] && injuries[NECK]){ + if (injuries[SKULL] && injuries[INCISE] && injuries[NECK]) { puts("I'm afraid you have suffered fatal injuries."); die(); } - for (n=0; n < NUMOFINJURIES; n++) - if (injuries[n] == 1){ + for (n = 0; n < NUMOFINJURIES; n++) + if (injuries[n] == 1) { injuries[n] = 2; if (WEIGHT > 5) WEIGHT -= 5; else WEIGHT = 0; } - if (injuries[ARM] == 2){ + if (injuries[ARM] == 2) { CUMBER -= 5; injuries[ARM]++; } - if (injuries[RIBS] == 2){ + if (injuries[RIBS] == 2) { CUMBER -= 2; injuries[RIBS]++; } - if (injuries[SPINE] == 2){ + if (injuries[SPINE] == 2) { WEIGHT = 0; injuries[SPINE]++; } @@ -233,16 +233,16 @@ news() void crash() { - int hurt1,hurt2; + int hurt1, hurt2; fuel--; if (!location[position].flyhere || - (testbit(location[position].objects,LAND) && fuel <= 0)){ + (testbit(location[position].objects, LAND) && fuel <= 0)) { if (!location[position].flyhere) puts("You're flying too low. We're going to crash!"); - else{ + else { puts("You're out of fuel. We'll have to crash land!"); - if (!location[position].down){ + if (!location[position].down) { puts("Your viper strikes the ground and explodes into firey fragments."); puts("Thick black smoke billows up from the wreckage."); die(); @@ -250,16 +250,16 @@ crash() position = location[position].down; } notes[LAUNCHED] = 0; - setbit(location[position].objects,CRASH); - ourtime += rnd(CYCLE/4); + setbit(location[position].objects, CRASH); + ourtime += rnd(CYCLE / 4); puts("The viper explodes into the ground and you lose consciousness..."); zzz(); hurt1 = rnd(NUMOFINJURIES - 2) + 2; hurt2 = rnd(NUMOFINJURIES - 2) + 2; injuries[hurt1] = 1; injuries[hurt2] = 1; - injuries[0] = 1; /* abrasions */ - injuries[1] = 1; /* lacerations */ + injuries[0] = 1;/* abrasions */ + injuries[1] = 1;/* lacerations */ printf("I'm afraid you have suffered %s and %s.\n", ouch[hurt1], ouch[hurt2]); } -- cgit v1.2.3-56-ge451