summaryrefslogtreecommitdiffstats
path: root/tetris
diff options
context:
space:
mode:
authorjsm <jsm@NetBSD.org>2000-01-01 10:15:17 +0000
committerjsm <jsm@NetBSD.org>2000-01-01 10:15:17 +0000
commite52594208cfeed7af6be03a9000f99c31d0f403d (patch)
treedb31bd8f7d1544326fcf09706b21b3ad15aa1ba1 /tetris
parentc83a77b4ec3b4473778b5ea0a5ae283fc4114a4c (diff)
downloadbsdgames-darwin-e52594208cfeed7af6be03a9000f99c31d0f403d.tar.gz
bsdgames-darwin-e52594208cfeed7af6be03a9000f99c31d0f403d.tar.zst
bsdgames-darwin-e52594208cfeed7af6be03a9000f99c31d0f403d.zip
Declare variables as extern in headers rather than using linker commons.
Diffstat (limited to 'tetris')
-rw-r--r--tetris/screen.h6
-rw-r--r--tetris/tetris.c15
-rw-r--r--tetris/tetris.h18
3 files changed, 26 insertions, 13 deletions
diff --git a/tetris/screen.h b/tetris/screen.h
index d17544cb..0b12171a 100644
--- a/tetris/screen.h
+++ b/tetris/screen.h
@@ -1,4 +1,4 @@
-/* $NetBSD: screen.h,v 1.4 1999/10/04 23:27:03 lukem Exp $ */
+/* $NetBSD: screen.h,v 1.5 2000/01/01 10:15:17 jsm Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -41,8 +41,8 @@
/*
* Capabilities from TERMCAP (used in the score code).
*/
-char *SEstr; /* end standout mode */
-char *SOstr; /* begin standout mode */
+extern char *SEstr; /* end standout mode */
+extern char *SOstr; /* begin standout mode */
/*
* putpad() is for padded strings with count=1.
diff --git a/tetris/tetris.c b/tetris/tetris.c
index f1f096a8..ba6eb439 100644
--- a/tetris/tetris.c
+++ b/tetris/tetris.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tetris.c,v 1.12 1999/09/12 09:02:24 jsm Exp $ */
+/* $NetBSD: tetris.c,v 1.13 2000/01/01 10:15:17 jsm Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -62,8 +62,21 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\
#include "screen.h"
#include "tetris.h"
+cell board[B_SIZE]; /* 1 => occupied, 0 => empty */
+
+int Rows, Cols; /* current screen size */
+
+const struct shape *curshape;
+const struct shape *nextshape;
+
+long fallrate; /* less than 1 million; smaller => faster */
+
+int score; /* the obvious thing */
gid_t gid, egid;
+char key_msg[100];
+int showpreview;
+
static void elide __P((void));
static void setup_board __P((void));
int main __P((int, char **));
diff --git a/tetris/tetris.h b/tetris/tetris.h
index 44a8b3b9..769f2d2d 100644
--- a/tetris/tetris.h
+++ b/tetris/tetris.h
@@ -1,4 +1,4 @@
-/* $NetBSD: tetris.h,v 1.7 1999/09/12 09:02:24 jsm Exp $ */
+/* $NetBSD: tetris.h,v 1.8 2000/01/01 10:15:17 jsm Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -60,7 +60,7 @@
#define B_SIZE (B_ROWS * B_COLS)
typedef unsigned char cell;
-cell board[B_SIZE]; /* 1 => occupied, 0 => empty */
+extern cell board[B_SIZE]; /* 1 => occupied, 0 => empty */
/* the displayed area (rows) */
#define D_FIRST 1
@@ -76,7 +76,7 @@ cell board[B_SIZE]; /* 1 => occupied, 0 => empty */
#define MINROWS 23
#define MINCOLS 40
-int Rows, Cols; /* current screen size */
+extern int Rows, Cols; /* current screen size */
/*
* Translations from board coordinates to display coordinates.
@@ -134,8 +134,8 @@ struct shape {
extern const struct shape shapes[];
#define randshape() (&shapes[random() % 7])
-const struct shape *curshape;
-const struct shape *nextshape;
+extern const struct shape *curshape;
+extern const struct shape *nextshape;
/*
* Shapes fall at a rate faster than once per second.
@@ -147,7 +147,7 @@ const struct shape *nextshape;
* The value eventually reaches a limit, and things stop going faster,
* but by then the game is utterly impossible.
*/
-long fallrate; /* less than 1 million; smaller => faster */
+extern long fallrate; /* less than 1 million; smaller => faster */
#define faster() (fallrate -= fallrate / 3000)
/*
@@ -167,11 +167,11 @@ long fallrate; /* less than 1 million; smaller => faster */
* we find that it is at rest and integrate it---until then, it can
* still be moved or rotated).
*/
-int score; /* the obvious thing */
+extern int score; /* the obvious thing */
extern gid_t gid, egid;
-char key_msg[100];
-int showpreview;
+extern char key_msg[100];
+extern int showpreview;
int fits_in __P((const struct shape *, int));
void place __P((const struct shape *, int, int));