Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/games/battlestar Clean up formatting; partly from OpenBSD.
details: https://anonhg.NetBSD.org/src/rev/cbea27fca1f7
branches: trunk
changeset: 497061:cbea27fca1f7
user: jsm <jsm%NetBSD.org@localhost>
date: Sun Sep 17 23:04:17 2000 +0000
description:
Clean up formatting; partly from OpenBSD.
diffstat:
games/battlestar/com1.c | 9 +-
games/battlestar/com2.c | 28 +++----
games/battlestar/com4.c | 77 ++++++++----------
games/battlestar/com5.c | 61 +++++++-------
games/battlestar/com6.c | 76 ++++++++----------
games/battlestar/com7.c | 181 +++++++++++++++++++++------------------------
games/battlestar/getcom.c | 17 ++--
7 files changed, 209 insertions(+), 240 deletions(-)
diffs (truncated from 680 to 300 lines):
diff -r 46e76ddeb555 -r cbea27fca1f7 games/battlestar/com1.c
--- a/games/battlestar/com1.c Sun Sep 17 23:03:43 2000 +0000
+++ b/games/battlestar/com1.c Sun Sep 17 23:04:17 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: com1.c,v 1.11 2000/09/08 17:25:31 jsm Exp $ */
+/* $NetBSD: com1.c,v 1.12 2000/09/17 23:04:17 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)com1.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: com1.c,v 1.11 2000/09/08 17:25:31 jsm Exp $");
+__RCSID("$NetBSD: com1.c,v 1.12 2000/09/17 23:04:17 jsm Exp $");
#endif
#endif /* not lint */
@@ -51,7 +51,7 @@
wordnumber++;
if ((!notes[CANTMOVE] && !notes[LAUNCHED]) ||
testbit(location[position].objects, LAND) ||
- (fuel > 0 && notes[LAUNCHED]))
+ (fuel > 0 && notes[LAUNCHED])) {
if (thataway) {
position = thataway;
newway(token);
@@ -62,11 +62,12 @@
whichway(location[position]);
return (0);
}
- else
+ } 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);
}
diff -r 46e76ddeb555 -r cbea27fca1f7 games/battlestar/com2.c
--- a/games/battlestar/com2.c Sun Sep 17 23:03:43 2000 +0000
+++ b/games/battlestar/com2.c Sun Sep 17 23:04:17 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: com2.c,v 1.9 2000/09/10 10:51:16 jsm Exp $ */
+/* $NetBSD: com2.c,v 1.10 2000/09/17 23:04:17 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)com2.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: com2.c,v 1.9 2000/09/10 10:51:16 jsm Exp $");
+__RCSID("$NetBSD: com2.c,v 1.10 2000/09/17 23:04:17 jsm Exp $");
#endif
#endif /* not lint */
@@ -159,20 +159,16 @@
ourtime++;
notes[CANTSEE] = 0;
return (0);
- } else
- if (position == FINAL)
- puts("The amulet won't work in here.");
- else
- if (wordvalue[wordnumber] == COMPASS && testbit(inven, COMPASS))
- printf("Your compass points %s.\n", truedirec(NORTH, '-'));
- else
- if (wordvalue[wordnumber] == COMPASS)
- puts("You aren't holding the compass.");
- else
- if (wordvalue[wordnumber] == AMULET)
- puts("You aren't holding the amulet.");
- else
- puts("There is no apparent use.");
+ } else if (position == FINAL)
+ puts("The amulet won't work in here.");
+ else if (wordvalue[wordnumber] == COMPASS && testbit(inven, COMPASS))
+ printf("Your compass points %s.\n", truedirec(NORTH, '-'));
+ else if (wordvalue[wordnumber] == COMPASS)
+ puts("You aren't holding the compass.");
+ else if (wordvalue[wordnumber] == AMULET)
+ puts("You aren't holding the amulet.");
+ else
+ puts("There is no apparent use.");
return (-1);
}
diff -r 46e76ddeb555 -r cbea27fca1f7 games/battlestar/com4.c
--- a/games/battlestar/com4.c Sun Sep 17 23:03:43 2000 +0000
+++ b/games/battlestar/com4.c Sun Sep 17 23:04:17 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: com4.c,v 1.9 2000/09/10 10:51:17 jsm Exp $ */
+/* $NetBSD: com4.c,v 1.10 2000/09/17 23:04:17 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)com4.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: com4.c,v 1.9 2000/09/10 10:51:17 jsm Exp $");
+__RCSID("$NetBSD: com4.c,v 1.10 2000/09/17 23:04:17 jsm Exp $");
#endif
#endif /* not lint */
@@ -76,17 +76,14 @@
clearbit(from, value);
if (value == MEDALION)
win--;
- } else
- if (testbit(inven, value))
- printf("You're already holding%s%s.\n", (objsht[value][n - 1] == 's' ? " " : " a "), objsht[value]);
- else
- if (!heavy)
- printf("The %s %s too heavy.\n", objsht[value], (objsht[value][n - 1] == 's' ? "are" : "is"));
- else
- if (!bulky)
- printf("The %s %s too cumbersome to hold.\n", objsht[value], (objsht[value][n - 1] == 's' ? "are" : "is"));
- else
- printf("I dont see any %s around here.\n", objsht[value]);
+ } else if (testbit(inven, value))
+ printf("You're already holding%s%s.\n", (objsht[value][n - 1] == 's' ? " " : " a "), objsht[value]);
+ else if (!heavy)
+ printf("The %s %s too heavy.\n", objsht[value], (objsht[value][n - 1] == 's' ? "are" : "is"));
+ else if (!bulky)
+ printf("The %s %s too cumbersome to hold.\n", objsht[value], (objsht[value][n - 1] == 's' ? "are" : "is"));
+ else
+ printf("I dont see any %s around here.\n", objsht[value]);
if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND)
wordnumber++;
else
@@ -117,26 +114,25 @@
wordvalue[wordnumber] = MAID;
wordtype[wordnumber--] = OBJECT;
return (take(from));
- } else
- if (testbit(from, DEADWOOD)) {
- wordvalue[wordnumber] = DEADWOOD;
+ } else if (testbit(from, DEADWOOD)) {
+ wordvalue[wordnumber] = DEADWOOD;
+ wordtype[wordnumber--] = OBJECT;
+ return (take(from));
+ } else if (testbit(from, DEADNATIVE)) {
+ wordvalue[wordnumber] = DEADNATIVE;
+ wordtype[wordnumber--] = OBJECT;
+ return (take(from));
+ } else {
+ if (testbit(from, DEADGOD)) {
+ wordvalue[wordnumber] = DEADGOD;
wordtype[wordnumber--] = OBJECT;
return (take(from));
- } else
- if (testbit(from, DEADNATIVE)) {
- wordvalue[wordnumber] = DEADNATIVE;
- wordtype[wordnumber--] = OBJECT;
- return (take(from));
- } else
- if (testbit(from, DEADGOD)) {
- wordvalue[wordnumber] = DEADGOD;
- wordtype[wordnumber--] = OBJECT;
- return (take(from));
- } else {
- wordvalue[wordnumber] = DEADTIME;
- wordtype[wordnumber--] = OBJECT;
- return (take(from));
- }
+ } else {
+ wordvalue[wordnumber] = DEADTIME;
+ wordtype[wordnumber--] = OBJECT;
+ return (take(from));
+ }
+ }
break;
case AMULET:
@@ -306,9 +302,8 @@
if (testbit(location[position].objects, value)) {
if (*name == 'T')
puts("Kicked instead.");
- else
- if (*name == 'G')
- puts("Given anyway.");
+ else if (*name == 'G')
+ puts("Given anyway.");
}
} else
puts("Kicked.");
@@ -377,14 +372,12 @@
snooze += CYCLE / 10;
ourtime++;
puts("Eaten. You can explore a little longer now.");
- } else
- if (ourtime < ate - CYCLE)
- puts("You're stuffed.");
- else
- if (!testbit(inven, KNIFE))
- puts("You need a knife.");
- else
- printf("You aren't holding the %s.\n", objsht[value]);
+ } else if (ourtime < ate - CYCLE)
+ puts("You're stuffed.");
+ else if (!testbit(inven, KNIFE))
+ puts("You need a knife.");
+ else
+ printf("You aren't holding the %s.\n", objsht[value]);
if (wordnumber < wordcount - 1 && wordvalue[++wordnumber] == AND)
wordnumber++;
else
diff -r 46e76ddeb555 -r cbea27fca1f7 games/battlestar/com5.c
--- a/games/battlestar/com5.c Sun Sep 17 23:03:43 2000 +0000
+++ b/games/battlestar/com5.c Sun Sep 17 23:04:17 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: com5.c,v 1.12 2000/09/10 10:51:17 jsm Exp $ */
+/* $NetBSD: com5.c,v 1.13 2000/09/17 23:04:17 jsm Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)com5.c 8.2 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: com5.c,v 1.12 2000/09/10 10:51:17 jsm Exp $");
+__RCSID("$NetBSD: com5.c,v 1.13 2000/09/17 23:04:17 jsm Exp $");
#endif
#endif /* not lint */
@@ -189,7 +189,7 @@
{
if ((ourtime / CYCLE + 1) % 2 && OUTSIDE)
switch ((ourtime % CYCLE) / (CYCLE / 7)) {
- case 0:
+ case 0:
puts("It is just after sunrise.");
break;
case 1:
@@ -211,33 +211,32 @@
puts("It is near sunset.");
break;
}
+ else if (OUTSIDE)
+ switch ((ourtime % CYCLE) / (CYCLE / 7)) {
+ case 0:
+ puts("It is just after sunset.");
+ break;
+ case 1:
+ puts("It is early evening.");
+ break;
+ case 2:
+ puts("The evening is getting old.");
+ break;
+ case 3:
+ puts("It is near midnight.");
+ break;
+ case 4:
+ puts("These are the wee hours of the morning.");
+ break;
+ case 5:
+ puts("The night is waning.");
+ break;
+ case 6:
+ puts("It is almost morning.");
+ break;
+ }
else
- if (OUTSIDE)
- switch ((ourtime % CYCLE) / (CYCLE / 7)) {
- case 0:
- puts("It is just after sunset.");
- break;
- case 1:
- puts("It is early evening.");
- break;
- case 2:
- puts("The evening is getting old.");
- break;
- case 3:
- puts("It is near midnight.");
- break;
- case 4:
- puts("These are the wee hours of the morning.");
- break;
- case 5:
- puts("The night is waning.");
- break;
- case 6:
- puts("It is almost morning.");
- break;
- }
- else
- puts("I can't tell the time in here.");
+ puts("I can't tell the time in here.");
}
int
@@ -274,12 +273,12 @@
* that's no worse than what other commands than give do in
* the same place. */
Home |
Main Index |
Thread Index |
Old Index