summaryrefslogtreecommitdiff
path: root/games
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2021-01-27 01:57:38 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2021-01-27 01:57:38 +0000
commit74a8048d03163c9ff6ddc91c7a62b0bcfb9f766e (patch)
tree23d648fa050d42a7cbb56e68c490c475ea6442ba /games
parentb11e0e8bbbebb1634b94f87686b7c3a51599bc64 (diff)
satisfy -fno-common
similar to the approach used by mortimer
Diffstat (limited to 'games')
-rw-r--r--games/trek/main.c12
-rw-r--r--games/trek/trek.h38
2 files changed, 21 insertions, 29 deletions
diff --git a/games/trek/main.c b/games/trek/main.c
index d4b348b4c2a..a0070e0ecd3 100644
--- a/games/trek/main.c
+++ b/games/trek/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.18 2018/08/09 17:51:22 mestre Exp $ */
+/* $OpenBSD: main.c,v 1.19 2021/01/27 01:57:37 deraadt Exp $ */
/* $NetBSD: main.c,v 1.4 1995/04/22 10:59:10 cgd Exp $ */
/*
@@ -39,6 +39,16 @@
#include "getpar.h"
#include "trek.h"
+struct quad Quad[NQUADS][NQUADS];
+char Sect[NSECTS][NSECTS];
+struct event Event[MAXEVENTS];
+struct Ship Ship;
+struct Game Game;
+struct Move Move;
+struct Param Param;
+struct Now Now;
+struct Etc Etc;
+
/*
** #### ##### # #### ##### #### ##### # #
** # # # # # # # # # # # #
diff --git a/games/trek/trek.h b/games/trek/trek.h
index 41511703db9..7f8eaf7795c 100644
--- a/games/trek/trek.h
+++ b/games/trek/trek.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: trek.h,v 1.14 2017/05/26 19:19:23 tedu Exp $ */
+/* $OpenBSD: trek.h,v 1.15 2021/01/27 01:57:37 deraadt Exp $ */
/* $NetBSD: trek.h,v 1.3 1995/04/22 10:59:36 cgd Exp $ */
/*
@@ -32,24 +32,6 @@
* @(#)trek.h 8.1 (Berkeley) 5/31/93
*/
-/*
-** Global Declarations
-**
-** Virtually all non-local variable declarations are made in this
-** file. Exceptions are those things which are initialized, which
-** are defined in "externs.c", and things which are local to one
-** program file.
-**
-** So far as I know, nothing in here must be preinitialized to
-** zero.
-**
-** You may have problems from the loader if you move this to a
-** different machine. These things actually get allocated in each
-** source file, which UNIX allows; however, you may (on other
-** systems) have to change everything in here to be "extern" and
-** actually allocate stuff in "externs.c"
-*/
-
/********************* GALAXY **************************/
/* galactic parameters */
@@ -88,7 +70,7 @@ struct quad /* definition for each quadrant */
extern const char *const Systemname[NINHAB];
/* quadrant definition */
-struct quad Quad[NQUADS][NQUADS];
+extern struct quad Quad[NQUADS][NQUADS];
/* defines for sector map (below) */
#define EMPTY '.'
@@ -101,7 +83,7 @@ struct quad Quad[NQUADS][NQUADS];
#define HOLE ' '
/* current sector map */
-char Sect[NSECTS][NSECTS];
+extern char Sect[NSECTS][NSECTS];
/************************ DEVICES ******************************/
@@ -171,7 +153,7 @@ struct event
#define MAXEVENTS 25 /* max number of concurrently pending events */
-struct event Event[MAXEVENTS]; /* dynamic event list; one entry per pending event */
+extern struct event Event[MAXEVENTS]; /* dynamic event list; one entry per pending event */
/***************************** KLINGONS *******************************/
@@ -216,7 +198,7 @@ struct xy
/* information regarding the state of the starship */
-struct
+extern struct Ship
{
double warp; /* warp factor */
double warp2; /* warp factor squared */
@@ -244,7 +226,7 @@ struct
/* sinsbad is set if SINS is working but not calibrated */
/* game related information, mostly scoring */
-struct
+extern struct Game
{
int killk; /* number of klingons killed */
int deaths; /* number of deaths onboard Enterprise */
@@ -263,7 +245,7 @@ struct
} Game;
/* per move information */
-struct
+extern struct Move
{
char free; /* set if a move is free */
char endgame; /* end of game flag */
@@ -274,7 +256,7 @@ struct
} Move;
/* parametric information */
-struct
+extern struct Param
{
unsigned char bases; /* number of starbases */
char klings; /* number of klingons */
@@ -310,7 +292,7 @@ struct
/* Sum of damage probabilities must add to 1000 */
/* other information kept in a snapshot */
-struct
+extern struct Now
{
unsigned char bases; /* number of starbases */
char klings; /* number of klingons */
@@ -323,7 +305,7 @@ struct
} Now;
/* Other stuff, not dumped in a snapshot */
-struct
+extern struct Etc
{
struct kling klingon[MAXKLQUAD]; /* sorted Klingon list */
short nkling; /* number of Klingons in this sector */