Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/games/sail Change the macro to roll a six-sided die from die...



details:   https://anonhg.NetBSD.org/src/rev/baa3588cd7df
branches:  trunk
changeset: 499856:baa3588cd7df
user:      jwise <jwise%NetBSD.org@localhost>
date:      Thu Nov 30 22:02:20 2000 +0000

description:
Change the macro to roll a six-sided die from die() to dieroll() (for
obvious reasons of convention).

diffstat:

 games/sail/assorted.c |   6 +++---
 games/sail/dr_1.c     |  18 +++++++++---------
 games/sail/dr_2.c     |   6 +++---
 games/sail/dr_3.c     |   6 +++---
 games/sail/dr_4.c     |   8 ++++----
 games/sail/extern.h   |   4 ++--
 games/sail/main.c     |   5 ++---
 games/sail/pl_3.c     |  12 ++++++------
 8 files changed, 32 insertions(+), 33 deletions(-)

diffs (286 lines):

diff -r 05fa4538a44b -r baa3588cd7df games/sail/assorted.c
--- a/games/sail/assorted.c     Thu Nov 30 21:50:58 2000 +0000
+++ b/games/sail/assorted.c     Thu Nov 30 22:02:20 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: assorted.c,v 1.8 1999/09/08 21:17:58 jsm Exp $ */
+/*     $NetBSD: assorted.c,v 1.9 2000/11/30 22:02:20 jwise Exp $       */
 
 /*
  * Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)assorted.c 8.2 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: assorted.c,v 1.8 1999/09/08 21:17:58 jsm Exp $");
+__RCSID("$NetBSD: assorted.c,v 1.9 2000/11/30 22:02:20 jwise Exp $");
 #endif
 #endif /* not lint */
 
@@ -283,7 +283,7 @@
        Write(W_POINTS, from, points, 0, 0, 0);
        unboard(ship, ship, 0);         /* all offense */
        unboard(ship, ship, 1);         /* all defense */
-       switch (die()) {
+       switch (dieroll()) {
        case 3:
        case 4:         /* ship may sink */
                Write(W_SINK, ship, 1, 0, 0, 0);
diff -r 05fa4538a44b -r baa3588cd7df games/sail/dr_1.c
--- a/games/sail/dr_1.c Thu Nov 30 21:50:58 2000 +0000
+++ b/games/sail/dr_1.c Thu Nov 30 22:02:20 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dr_1.c,v 1.10 1999/09/30 18:01:33 jsm Exp $    */
+/*     $NetBSD: dr_1.c,v 1.11 2000/11/30 22:02:20 jwise Exp $  */
 
 /*
  * Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)dr_1.c     8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: dr_1.c,v 1.10 1999/09/30 18:01:33 jsm Exp $");
+__RCSID("$NetBSD: dr_1.c,v 1.11 2000/11/30 22:02:20 jwise Exp $");
 #endif
 #endif /* not lint */
 
@@ -62,7 +62,7 @@
                            !is_toughmelee(sp, to, 0, 0))
                                continue;
                        for (i = fouled2(sp, to); --i >= 0;)
-                               if (die() <= 2)
+                               if (dieroll() <= 2)
                                        cleanfoul(sp, to, 0);
                }
        }
@@ -173,12 +173,12 @@
                index = fromstrength/10;
                if (index > 8)
                        index = 8;
-               toinjured = MT[index][2 - die() / 3];
+               toinjured = MT[index][2 - dieroll() / 3];
                totalto += toinjured;
                index = strengthto/10;
                if (index > 8)
                        index = 8;
-               frominjured = MT[index][2 - die() / 3];
+               frominjured = MT[index][2 - dieroll() / 3];
                totalfrom += frominjured;
                menfrom -= frominjured;
                mento -= toinjured;
@@ -392,7 +392,7 @@
                        if (hit >= 0) {
                                if (load != L_GRAPE)
                                        hit = hit > 10 ? 10 : hit;
-                               table(shootat, load, hit, closest, sp, die());
+                               table(shootat, load, hit, closest, sp, dieroll());
                        }
                }
        }
@@ -439,8 +439,8 @@
                return -1;
        }
        Write(W_TURN, SHIP(0), turn, 0, 0, 0);
-       if (turn % 7 == 0 && (die() >= cc->windchange || !windspeed)) {
-               switch (die()) {
+       if (turn % 7 == 0 && (dieroll() >= cc->windchange || !windspeed)) {
+               switch (dieroll()) {
                case 1:
                        winddir = 1;
                        break;
@@ -464,7 +464,7 @@
                if (winddir < 1)
                        winddir += 8;
                if (windspeed)
-                       switch (die()) {
+                       switch (dieroll()) {
                        case 1:
                        case 2:
                                windspeed--;
diff -r 05fa4538a44b -r baa3588cd7df games/sail/dr_2.c
--- a/games/sail/dr_2.c Thu Nov 30 21:50:58 2000 +0000
+++ b/games/sail/dr_2.c Thu Nov 30 22:02:20 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dr_2.c,v 1.11 1999/09/30 18:01:33 jsm Exp $    */
+/*     $NetBSD: dr_2.c,v 1.12 2000/11/30 22:02:20 jwise Exp $  */
 
 /*
  * Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)dr_2.c     8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: dr_2.c,v 1.11 1999/09/30 18:01:33 jsm Exp $");
+__RCSID("$NetBSD: dr_2.c,v 1.12 2000/11/30 22:02:20 jwise Exp $");
 #endif
 #endif /* not lint */
 
@@ -91,7 +91,7 @@
                sink = sp->file->sink;
                if (explode != 1 && sink != 1)
                        continue;
-               if (die() < 5)
+               if (dieroll() < 5)
                        continue;
                Write(sink == 1 ? W_SINK : W_EXPLODE, sp, 2, 0, 0, 0);
                Write(W_DIR, sp, 0, 0, 0, 0);
diff -r 05fa4538a44b -r baa3588cd7df games/sail/dr_3.c
--- a/games/sail/dr_3.c Thu Nov 30 21:50:58 2000 +0000
+++ b/games/sail/dr_3.c Thu Nov 30 22:02:20 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dr_3.c,v 1.7 1999/09/30 18:01:33 jsm Exp $     */
+/*     $NetBSD: dr_3.c,v 1.8 2000/11/30 22:02:20 jwise Exp $   */
 
 /*
  * Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)dr_3.c     8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: dr_3.c,v 1.7 1999/09/30 18:01:33 jsm Exp $");
+__RCSID("$NetBSD: dr_3.c,v 1.8 2000/11/30 22:02:20 jwise Exp $");
 #endif
 #endif /* not lint */
 
@@ -135,7 +135,7 @@
                                        snap++;
                                if (!range(sp, sq) && !fouled2(sp, sq)) {
                                        makesignal(sp, "collision with $$", sq);
-                                       if (die() < 4) {
+                                       if (dieroll() < 4) {
                                                makesignal(sp, "fouled with $$",
                                                    sq);
                                                Write(W_FOUL, sp, l, 0, 0, 0);
diff -r 05fa4538a44b -r baa3588cd7df games/sail/dr_4.c
--- a/games/sail/dr_4.c Thu Nov 30 21:50:58 2000 +0000
+++ b/games/sail/dr_4.c Thu Nov 30 22:02:20 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dr_4.c,v 1.7 1999/02/10 00:45:45 hubertf Exp $ */
+/*     $NetBSD: dr_4.c,v 1.8 2000/11/30 22:02:20 jwise Exp $   */
 
 /*
  * Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)dr_4.c     8.2 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: dr_4.c,v 1.7 1999/02/10 00:45:45 hubertf Exp $");
+__RCSID("$NetBSD: dr_4.c,v 1.8 2000/11/30 22:02:20 jwise Exp $");
 #endif
 #endif /* not lint */
 
@@ -56,7 +56,7 @@
                return;
        friend = capship(from)->nationality == capship(to)->nationality;
        while (--k >= 0) {
-               if (friend || die() < 3) {
+               if (friend || dieroll() < 3) {
                        cleangrapple(from, to, 0);
                        makesignal(from, "ungrappling $$", to);
                }
@@ -67,7 +67,7 @@
 grap(from, to)
 struct ship *from, *to;
 {
-       if (capship(from)->nationality != capship(to)->nationality && die() > 2)
+       if (capship(from)->nationality != capship(to)->nationality && dieroll() > 2)
                return;
        Write(W_GRAP, from, to->file->index, 0, 0, 0);
        Write(W_GRAP, to, from->file->index, 0, 0, 0);
diff -r 05fa4538a44b -r baa3588cd7df games/sail/extern.h
--- a/games/sail/extern.h       Thu Nov 30 21:50:58 2000 +0000
+++ b/games/sail/extern.h       Thu Nov 30 22:02:20 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: extern.h,v 1.15 2000/11/30 21:50:58 jwise Exp $ */
+/*     $NetBSD: extern.h,v 1.16 2000/11/30 22:02:20 jwise Exp $ */
 
 /*
  * Copyright (c) 1983, 1993
@@ -60,7 +60,7 @@
 extern gid_t gid;
 extern gid_t egid;
 
-#define die()          ((rand() >> 3) % 6 + 1)
+#define dieroll()              ((rand() >> 3) % 6 + 1)
 #define sqr(a)         ((a) * (a))
 #define abs(a)         ((a) > 0 ? (a) : -(a))
 #define min(a,b)       ((a) < (b) ? (a) : (b))
diff -r 05fa4538a44b -r baa3588cd7df games/sail/main.c
--- a/games/sail/main.c Thu Nov 30 21:50:58 2000 +0000
+++ b/games/sail/main.c Thu Nov 30 22:02:20 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.10 2000/11/30 21:38:57 jwise Exp $  */
+/*     $NetBSD: main.c,v 1.11 2000/11/30 22:02:20 jwise Exp $  */
 
 /*
  * Copyright (c) 1983, 1993
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c     8.2 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: main.c,v 1.10 2000/11/30 21:38:57 jwise Exp $");
+__RCSID("$NetBSD: main.c,v 1.11 2000/11/30 22:02:20 jwise Exp $");
 #endif
 #endif /* not lint */
 
@@ -55,7 +55,6 @@
 
 int main (int, char **);
 
-/*ARGSUSED*/
 int
 main(int argc, char **argv)
 {
diff -r 05fa4538a44b -r baa3588cd7df games/sail/pl_3.c
--- a/games/sail/pl_3.c Thu Nov 30 21:50:58 2000 +0000
+++ b/games/sail/pl_3.c Thu Nov 30 22:02:20 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pl_3.c,v 1.8 1999/09/08 21:17:59 jsm Exp $     */
+/*     $NetBSD: pl_3.c,v 1.9 2000/11/30 22:02:20 jwise Exp $   */
 
 /*
  * Copyright (c) 1983, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)pl_3.c     8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: pl_3.c,v 1.8 1999/09/08 21:17:59 jsm Exp $");
+__RCSID("$NetBSD: pl_3.c,v 1.9 2000/11/30 22:02:20 jwise Exp $");
 #endif
 #endif /* not lint */
 
@@ -177,7 +177,7 @@
                if (windspeed == 6 && temp <= 3)
                        hit--;
                if (hit >= 0) {
-                       roll = die();
+                       roll = dieroll();
                        if (load == L_GRAPE)
                                chits = hit;
                        else {
@@ -232,7 +232,7 @@
                switch (sgetch("Attempt to grapple or ungrapple $$: ",
                        sp, 1)) {
                case 'g':
-                       if (die() < 3
+                       if (dieroll() < 3
                            || ms->nationality == capship(sp)->nationality) {
                                Write(W_GRAP, ms, sp->file->index, 0, 0, 0);
                                Write(W_GRAP, sp, player, 0, 0, 0);
@@ -245,7 +245,7 @@
                        for (i = grappled2(ms, sp); --i >= 0;) {
                                if (ms->nationality
                                        == capship(sp)->nationality
-                                   || die() < 3) {
+                                   || dieroll() < 3) {
                                        cleangrapple(ms, sp, 0);
                                        Msg("Attempt succeeds!");
                                        makesignal(ms, "ungrappling with $$",
@@ -270,7 +270,7 @@
                if (sgetch("Attempt to unfoul with the $$? ", to, 1) != 'y')
                        continue;
                for (i = fouled2(ms, to); --i >= 0;) {
-                       if (die() <= 2) {
+                       if (dieroll() <= 2) {
                                cleanfoul(ms, to, 0);
                                Msg("Attempt succeeds!");
                                makesignal(ms, "Unfouling $$", to);



Home | Main Index | Thread Index | Old Index