Skip to content

Commit 48253eb

Browse files
jwisejwise
authored andcommitted
Change the macro to roll a six-sided die from die() to dieroll() (for
obvious reasons of convention).
1 parent f876814 commit 48253eb

File tree

8 files changed

+32
-33
lines changed

8 files changed

+32
-33
lines changed

games/sail/assorted.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: assorted.c,v 1.8 1999/09/08 21:17:58 jsm Exp $ */
1+
/* $NetBSD: assorted.c,v 1.9 2000/11/30 22:02:20 jwise Exp $ */
22

33
/*
44
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
3838
#if 0
3939
static char sccsid[] = "@(#)assorted.c 8.2 (Berkeley) 4/28/95";
4040
#else
41-
__RCSID("$NetBSD: assorted.c,v 1.8 1999/09/08 21:17:58 jsm Exp $");
41+
__RCSID("$NetBSD: assorted.c,v 1.9 2000/11/30 22:02:20 jwise Exp $");
4242
#endif
4343
#endif /* not lint */
4444

@@ -283,7 +283,7 @@ struct ship *ship, *from;
283283
Write(W_POINTS, from, points, 0, 0, 0);
284284
unboard(ship, ship, 0); /* all offense */
285285
unboard(ship, ship, 1); /* all defense */
286-
switch (die()) {
286+
switch (dieroll()) {
287287
case 3:
288288
case 4: /* ship may sink */
289289
Write(W_SINK, ship, 1, 0, 0, 0);

games/sail/dr_1.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: dr_1.c,v 1.10 1999/09/30 18:01:33 jsm Exp $ */
1+
/* $NetBSD: dr_1.c,v 1.11 2000/11/30 22:02:20 jwise Exp $ */
22

33
/*
44
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
3838
#if 0
3939
static char sccsid[] = "@(#)dr_1.c 8.1 (Berkeley) 5/31/93";
4040
#else
41-
__RCSID("$NetBSD: dr_1.c,v 1.10 1999/09/30 18:01:33 jsm Exp $");
41+
__RCSID("$NetBSD: dr_1.c,v 1.11 2000/11/30 22:02:20 jwise Exp $");
4242
#endif
4343
#endif /* not lint */
4444

@@ -62,7 +62,7 @@ unfoul()
6262
!is_toughmelee(sp, to, 0, 0))
6363
continue;
6464
for (i = fouled2(sp, to); --i >= 0;)
65-
if (die() <= 2)
65+
if (dieroll() <= 2)
6666
cleanfoul(sp, to, 0);
6767
}
6868
}
@@ -173,12 +173,12 @@ int key;
173173
index = fromstrength/10;
174174
if (index > 8)
175175
index = 8;
176-
toinjured = MT[index][2 - die() / 3];
176+
toinjured = MT[index][2 - dieroll() / 3];
177177
totalto += toinjured;
178178
index = strengthto/10;
179179
if (index > 8)
180180
index = 8;
181-
frominjured = MT[index][2 - die() / 3];
181+
frominjured = MT[index][2 - dieroll() / 3];
182182
totalfrom += frominjured;
183183
menfrom -= frominjured;
184184
mento -= toinjured;
@@ -392,7 +392,7 @@ compcombat()
392392
if (hit >= 0) {
393393
if (load != L_GRAPE)
394394
hit = hit > 10 ? 10 : hit;
395-
table(shootat, load, hit, closest, sp, die());
395+
table(shootat, load, hit, closest, sp, dieroll());
396396
}
397397
}
398398
}
@@ -439,8 +439,8 @@ next()
439439
return -1;
440440
}
441441
Write(W_TURN, SHIP(0), turn, 0, 0, 0);
442-
if (turn % 7 == 0 && (die() >= cc->windchange || !windspeed)) {
443-
switch (die()) {
442+
if (turn % 7 == 0 && (dieroll() >= cc->windchange || !windspeed)) {
443+
switch (dieroll()) {
444444
case 1:
445445
winddir = 1;
446446
break;
@@ -464,7 +464,7 @@ next()
464464
if (winddir < 1)
465465
winddir += 8;
466466
if (windspeed)
467-
switch (die()) {
467+
switch (dieroll()) {
468468
case 1:
469469
case 2:
470470
windspeed--;

games/sail/dr_2.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: dr_2.c,v 1.11 1999/09/30 18:01:33 jsm Exp $ */
1+
/* $NetBSD: dr_2.c,v 1.12 2000/11/30 22:02:20 jwise Exp $ */
22

33
/*
44
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
3838
#if 0
3939
static char sccsid[] = "@(#)dr_2.c 8.1 (Berkeley) 5/31/93";
4040
#else
41-
__RCSID("$NetBSD: dr_2.c,v 1.11 1999/09/30 18:01:33 jsm Exp $");
41+
__RCSID("$NetBSD: dr_2.c,v 1.12 2000/11/30 22:02:20 jwise Exp $");
4242
#endif
4343
#endif /* not lint */
4444

@@ -91,7 +91,7 @@ checkup()
9191
sink = sp->file->sink;
9292
if (explode != 1 && sink != 1)
9393
continue;
94-
if (die() < 5)
94+
if (dieroll() < 5)
9595
continue;
9696
Write(sink == 1 ? W_SINK : W_EXPLODE, sp, 2, 0, 0, 0);
9797
Write(W_DIR, sp, 0, 0, 0, 0);

games/sail/dr_3.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: dr_3.c,v 1.7 1999/09/30 18:01:33 jsm Exp $ */
1+
/* $NetBSD: dr_3.c,v 1.8 2000/11/30 22:02:20 jwise Exp $ */
22

33
/*
44
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
3838
#if 0
3939
static char sccsid[] = "@(#)dr_3.c 8.1 (Berkeley) 5/31/93";
4040
#else
41-
__RCSID("$NetBSD: dr_3.c,v 1.7 1999/09/30 18:01:33 jsm Exp $");
41+
__RCSID("$NetBSD: dr_3.c,v 1.8 2000/11/30 22:02:20 jwise Exp $");
4242
#endif
4343
#endif /* not lint */
4444

@@ -135,7 +135,7 @@ moveall() /* move all comp ships */
135135
snap++;
136136
if (!range(sp, sq) && !fouled2(sp, sq)) {
137137
makesignal(sp, "collision with $$", sq);
138-
if (die() < 4) {
138+
if (dieroll() < 4) {
139139
makesignal(sp, "fouled with $$",
140140
sq);
141141
Write(W_FOUL, sp, l, 0, 0, 0);

games/sail/dr_4.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: dr_4.c,v 1.7 1999/02/10 00:45:45 hubertf Exp $ */
1+
/* $NetBSD: dr_4.c,v 1.8 2000/11/30 22:02:20 jwise Exp $ */
22

33
/*
44
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
3838
#if 0
3939
static char sccsid[] = "@(#)dr_4.c 8.2 (Berkeley) 4/28/95";
4040
#else
41-
__RCSID("$NetBSD: dr_4.c,v 1.7 1999/02/10 00:45:45 hubertf Exp $");
41+
__RCSID("$NetBSD: dr_4.c,v 1.8 2000/11/30 22:02:20 jwise Exp $");
4242
#endif
4343
#endif /* not lint */
4444

@@ -56,7 +56,7 @@ struct ship *from, *to;
5656
return;
5757
friend = capship(from)->nationality == capship(to)->nationality;
5858
while (--k >= 0) {
59-
if (friend || die() < 3) {
59+
if (friend || dieroll() < 3) {
6060
cleangrapple(from, to, 0);
6161
makesignal(from, "ungrappling $$", to);
6262
}
@@ -67,7 +67,7 @@ void
6767
grap(from, to)
6868
struct ship *from, *to;
6969
{
70-
if (capship(from)->nationality != capship(to)->nationality && die() > 2)
70+
if (capship(from)->nationality != capship(to)->nationality && dieroll() > 2)
7171
return;
7272
Write(W_GRAP, from, to->file->index, 0, 0, 0);
7373
Write(W_GRAP, to, from->file->index, 0, 0, 0);

games/sail/extern.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: extern.h,v 1.15 2000/11/30 21:50:58 jwise Exp $ */
1+
/* $NetBSD: extern.h,v 1.16 2000/11/30 22:02:20 jwise Exp $ */
22

33
/*
44
* Copyright (c) 1983, 1993
@@ -60,7 +60,7 @@ extern char nobells; /* -b, don't ring bell before Signal */
6060
extern gid_t gid;
6161
extern gid_t egid;
6262

63-
#define die() ((rand() >> 3) % 6 + 1)
63+
#define dieroll() ((rand() >> 3) % 6 + 1)
6464
#define sqr(a) ((a) * (a))
6565
#define abs(a) ((a) > 0 ? (a) : -(a))
6666
#define min(a,b) ((a) < (b) ? (a) : (b))

games/sail/main.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: main.c,v 1.10 2000/11/30 21:38:57 jwise Exp $ */
1+
/* $NetBSD: main.c,v 1.11 2000/11/30 22:02:20 jwise Exp $ */
22

33
/*
44
* Copyright (c) 1983, 1993
@@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\
4343
#if 0
4444
static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 4/28/95";
4545
#else
46-
__RCSID("$NetBSD: main.c,v 1.10 2000/11/30 21:38:57 jwise Exp $");
46+
__RCSID("$NetBSD: main.c,v 1.11 2000/11/30 22:02:20 jwise Exp $");
4747
#endif
4848
#endif /* not lint */
4949

@@ -55,7 +55,6 @@ __RCSID("$NetBSD: main.c,v 1.10 2000/11/30 21:38:57 jwise Exp $");
5555

5656
int main (int, char **);
5757

58-
/*ARGSUSED*/
5958
int
6059
main(int argc, char **argv)
6160
{

games/sail/pl_3.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: pl_3.c,v 1.8 1999/09/08 21:17:59 jsm Exp $ */
1+
/* $NetBSD: pl_3.c,v 1.9 2000/11/30 22:02:20 jwise Exp $ */
22

33
/*
44
* Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
3838
#if 0
3939
static char sccsid[] = "@(#)pl_3.c 8.1 (Berkeley) 5/31/93";
4040
#else
41-
__RCSID("$NetBSD: pl_3.c,v 1.8 1999/09/08 21:17:59 jsm Exp $");
41+
__RCSID("$NetBSD: pl_3.c,v 1.9 2000/11/30 22:02:20 jwise Exp $");
4242
#endif
4343
#endif /* not lint */
4444

@@ -177,7 +177,7 @@ acceptcombat()
177177
if (windspeed == 6 && temp <= 3)
178178
hit--;
179179
if (hit >= 0) {
180-
roll = die();
180+
roll = dieroll();
181181
if (load == L_GRAPE)
182182
chits = hit;
183183
else {
@@ -232,7 +232,7 @@ grapungrap()
232232
switch (sgetch("Attempt to grapple or ungrapple $$: ",
233233
sp, 1)) {
234234
case 'g':
235-
if (die() < 3
235+
if (dieroll() < 3
236236
|| ms->nationality == capship(sp)->nationality) {
237237
Write(W_GRAP, ms, sp->file->index, 0, 0, 0);
238238
Write(W_GRAP, sp, player, 0, 0, 0);
@@ -245,7 +245,7 @@ grapungrap()
245245
for (i = grappled2(ms, sp); --i >= 0;) {
246246
if (ms->nationality
247247
== capship(sp)->nationality
248-
|| die() < 3) {
248+
|| dieroll() < 3) {
249249
cleangrapple(ms, sp, 0);
250250
Msg("Attempt succeeds!");
251251
makesignal(ms, "ungrappling with $$",
@@ -270,7 +270,7 @@ unfoulplayer()
270270
if (sgetch("Attempt to unfoul with the $$? ", to, 1) != 'y')
271271
continue;
272272
for (i = fouled2(ms, to); --i >= 0;) {
273-
if (die() <= 2) {
273+
if (dieroll() <= 2) {
274274
cleanfoul(ms, to, 0);
275275
Msg("Attempt succeeds!");
276276
makesignal(ms, "Unfouling $$", to);

0 commit comments

Comments
 (0)