summaryrefslogtreecommitdiffstats
path: root/tetris
diff options
context:
space:
mode:
authorjsm <jsm@NetBSD.org>1999-09-08 21:17:44 +0000
committerjsm <jsm@NetBSD.org>1999-09-08 21:17:44 +0000
commit04f4d7044367099914cf1906ae27ac20c24e44cf (patch)
treec17cb5c2f270bbb70eeba18cbe2bcfa43cfd8e10 /tetris
parentf9706028dd6e2afabb6bd63d02d7bc90f78e4aab (diff)
downloadbsdgames-darwin-04f4d7044367099914cf1906ae27ac20c24e44cf.tar.gz
bsdgames-darwin-04f4d7044367099914cf1906ae27ac20c24e44cf.tar.zst
bsdgames-darwin-04f4d7044367099914cf1906ae27ac20c24e44cf.zip
Add use of `const' where appropriate to the games.
This merges in all such remaining changes from the Linux port of the NetBSD games, except in hunt (where substantial changes from OpenBSD need to be looked at). Some such changes were previously covered in PRs bin/6041, bin/6146, bin/6148, bin/6150, bin/6151, bin/6580, bin/6660, bin/7993, bin/7994, bin/8039, bin/8057 and bin/8093.
Diffstat (limited to 'tetris')
-rw-r--r--tetris/scores.c4
-rw-r--r--tetris/screen.c6
-rw-r--r--tetris/shapes.c8
-rw-r--r--tetris/tetris.c6
-rw-r--r--tetris/tetris.h14
5 files changed, 19 insertions, 19 deletions
diff --git a/tetris/scores.c b/tetris/scores.c
index 6afb1115..a93c2ef5 100644
--- a/tetris/scores.c
+++ b/tetris/scores.c
@@ -1,4 +1,4 @@
-/* $NetBSD: scores.c,v 1.4 1997/10/14 01:14:20 lukem Exp $ */
+/* $NetBSD: scores.c,v 1.5 1999/09/08 21:18:00 jsm Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -96,7 +96,7 @@ getscores(fpp)
FILE **fpp;
{
int sd, mint, lck;
- char *mstr, *human;
+ const char *mstr, *human;
FILE *sf;
if (fpp != NULL) {
diff --git a/tetris/screen.c b/tetris/screen.c
index 007705e9..c4a49fab 100644
--- a/tetris/screen.c
+++ b/tetris/screen.c
@@ -1,4 +1,4 @@
-/* $NetBSD: screen.c,v 1.10 1999/08/14 16:40:23 tron Exp $ */
+/* $NetBSD: screen.c,v 1.11 1999/09/08 21:18:00 jsm Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -339,7 +339,7 @@ scr_end()
void
stop(why)
- char *why;
+ const char *why;
{
if (isset)
@@ -376,7 +376,7 @@ scr_update()
register regcell so, cur_so = 0;
register int i, ccol, j;
sigset_t sigset, osigset;
- static struct shape *lastshape;
+ static const struct shape *lastshape;
sigemptyset(&sigset);
sigaddset(&sigset, SIGTSTP);
diff --git a/tetris/shapes.c b/tetris/shapes.c
index 86309e24..86f249cc 100644
--- a/tetris/shapes.c
+++ b/tetris/shapes.c
@@ -1,4 +1,4 @@
-/* $NetBSD: shapes.c,v 1.3 1997/10/12 02:03:47 lukem Exp $ */
+/* $NetBSD: shapes.c,v 1.4 1999/09/08 21:18:01 jsm Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -56,7 +56,7 @@
#define BC B_COLS /* bottom center */
#define BR B_COLS+1 /* bottom right */
-struct shape shapes[] = {
+const struct shape shapes[] = {
/* 0*/ { 7, { TL, TC, MR, } },
/* 1*/ { 8, { TC, TR, ML, } },
/* 2*/ { 9, { ML, MR, BC, } },
@@ -84,7 +84,7 @@ struct shape shapes[] = {
*/
int
fits_in(shape, pos)
- struct shape *shape;
+ const struct shape *shape;
register int pos;
{
register int *o = shape->off;
@@ -101,7 +101,7 @@ fits_in(shape, pos)
*/
void
place(shape, pos, onoff)
- struct shape *shape;
+ const struct shape *shape;
register int pos, onoff;
{
register int *o = shape->off;
diff --git a/tetris/tetris.c b/tetris/tetris.c
index 82517b2c..3ffbe8ff 100644
--- a/tetris/tetris.c
+++ b/tetris/tetris.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tetris.c,v 1.9 1999/03/22 06:12:23 abs Exp $ */
+/* $NetBSD: tetris.c,v 1.10 1999/09/08 21:18:01 jsm Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -117,7 +117,7 @@ main(argc, argv)
char *argv[];
{
register int pos, c;
- register char *keys;
+ register const char *keys;
register int level = 2;
char key_write[6][10];
int ch, i, j;
@@ -258,7 +258,7 @@ main(argc, argv)
}
if (c == keys[1]) {
/* turn */
- struct shape *new = &shapes[curshape->rot];
+ const struct shape *new = &shapes[curshape->rot];
if (fits_in(new, pos))
curshape = new;
diff --git a/tetris/tetris.h b/tetris/tetris.h
index d3aebd2c..97a28234 100644
--- a/tetris/tetris.h
+++ b/tetris/tetris.h
@@ -1,4 +1,4 @@
-/* $NetBSD: tetris.h,v 1.5 1999/01/03 17:13:51 hubertf Exp $ */
+/* $NetBSD: tetris.h,v 1.6 1999/09/08 21:18:01 jsm Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -129,11 +129,11 @@ struct shape {
int off[3]; /* offsets to other blots if center is at (0,0) */
};
-extern struct shape shapes[];
+extern const struct shape shapes[];
#define randshape() (&shapes[random() % 7])
-struct shape *curshape;
-struct shape *nextshape;
+const struct shape *curshape;
+const struct shape *nextshape;
/*
* Shapes fall at a rate faster than once per second.
@@ -170,6 +170,6 @@ int score; /* the obvious thing */
char key_msg[100];
int showpreview;
-int fits_in __P((struct shape *, int));
-void place __P((struct shape *, int, int));
-void stop __P((char *)) __attribute__((__noreturn__));
+int fits_in __P((const struct shape *, int));
+void place __P((const struct shape *, int, int));
+void stop __P((const char *)) __attribute__((__noreturn__));