svn commit: r565951 - in head/games/golddig: . files
Adriaan de Groot
adridg at FreeBSD.org
Thu Feb 18 16:37:41 UTC 2021
Author: adridg
Date: Thu Feb 18 16:37:39 2021
New Revision: 565951
URL: https://svnweb.freebsd.org/changeset/ports/565951
Log:
Fix games/golddig in the face of picky compilers
C (and linkers) has changed a little since 2001, so patch up the
places where "extern" is needed, add <string.h> and missing
cases in switch() to silence warnings. golddig runs nearly as
well as on my Apple //c (see games/kgoldrunner for a newer take
on the same concept, though)
Not taking maintainership, I just spotted this among the recent
fallout-cleanup and thought "I can do that while I wait for the
potatoes to boil."
Added:
head/games/golddig/files/patch-badguy.c (contents, props changed)
head/games/golddig/files/patch-golddig.c (contents, props changed)
head/games/golddig/files/patch-golddig.h (contents, props changed)
head/games/golddig/files/patch-moveall.c (contents, props changed)
head/games/golddig/files/patch-movement.c (contents, props changed)
head/games/golddig/files/patch-shared.c (contents, props changed)
Modified:
head/games/golddig/Makefile
Modified: head/games/golddig/Makefile
==============================================================================
--- head/games/golddig/Makefile Thu Feb 18 16:35:53 2021 (r565950)
+++ head/games/golddig/Makefile Thu Feb 18 16:37:39 2021 (r565951)
@@ -3,16 +3,13 @@
PORTNAME= golddig
PORTVERSION= 3.1
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= games
MASTER_SITES= http://www.NetBSD.org/~chuck/gz/
DISTNAME= ${PORTNAME}C${PORTVERSION}
MAINTAINER= ports at FreeBSD.org
COMMENT= Getting the Gold and Avoiding Death
-
-BROKEN_FreeBSD_13= ld: error: duplicate symbol: background
-BROKEN_FreeBSD_14= ld: error: duplicate symbol: background
USES= xorg
USE_XORG= x11
Added: head/games/golddig/files/patch-badguy.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/games/golddig/files/patch-badguy.c Thu Feb 18 16:37:39 2021 (r565951)
@@ -0,0 +1,19 @@
+--- badguy.c.orig 2001-03-16 00:44:30 UTC
++++ badguy.c
+@@ -20,7 +20,7 @@ int badscore; /* Score given during current
+ /* killing bad guys */
+
+ /* Graphics cursors for drawing the possible states of the badguys */
+-GC badguy1gc,badguy2gc,badguy3gc;
++extern GC badguy1gc,badguy2gc,badguy3gc;
+
+ /* Initialize data structure for bad guys from level data */
+ void start_badguy()
+@@ -421,6 +421,7 @@ void move_badguys()
+ case RIGHT: dir = LEFT; break;
+ case UP: dir = DOWN; break;
+ case DOWN: dir = UP; break;
++ case UNMOVE: case STAND: case DIGLEFT: case DIGRIGHT: case PUTDOWN: break;
+ }
+
+ /* Execute computed movement. */
Added: head/games/golddig/files/patch-golddig.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/games/golddig/files/patch-golddig.c Thu Feb 18 16:37:39 2021 (r565951)
@@ -0,0 +1,10 @@
+--- golddig.c.orig 2021-02-18 16:25:22 UTC
++++ golddig.c
+@@ -8,6 +8,7 @@
+
+ #include <stdio.h>
+ #include <stdlib.h>
++#include <string.h>
+ #include <unistd.h>
+ #include <X11/Xlib.h>
+ #include <X11/keysym.h>
Added: head/games/golddig/files/patch-golddig.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/games/golddig/files/patch-golddig.h Thu Feb 18 16:37:39 2021 (r565951)
@@ -0,0 +1,91 @@
+--- golddig.h.orig 2001-03-19 19:26:10 UTC
++++ golddig.h
+@@ -11,43 +11,47 @@
+ #ifdef VMS
+ #define LIB "GOLDDIG$:" /* Default path name */
+ #endif
+-
+-int xsize,ysize; /* Current level width and height */
+-int levelstart; /* Level that player started at */
+-int levelnum; /* Current level number */
+-int score; /* Total score */
+-int speed; /* Speed of game. 1 is slowest, 5 is default */
++
++#ifndef GOLDDIG_EXTERN
++#define GOLDDIG_EXTERN extern
++#endif
++
++GOLDDIG_EXTERN int xsize,ysize; /* Current level width and height */
++GOLDDIG_EXTERN int levelstart; /* Level that player started at */
++GOLDDIG_EXTERN int levelnum; /* Current level number */
++GOLDDIG_EXTERN int score; /* Total score */
++GOLDDIG_EXTERN int speed; /* Speed of game. 1 is slowest, 5 is default */
+ extern int lives; /* How many player lives left */
+ extern int angelleft; /* How many movement on angelhood are left */
+-int goldleft; /* Total number of treasure blocks left */
+-char *worldname; /* Name of world (set of levels) */
+-int curtick; /* Current clock tick number */
++GOLDDIG_EXTERN int goldleft; /* Total number of treasure blocks left */
++GOLDDIG_EXTERN char *worldname; /* Name of world (set of levels) */
++GOLDDIG_EXTERN int curtick; /* Current clock tick number */
+ extern int newlevel; /* Non-zero if a new level was just drawn */
+-extern int savehighscore; /* only save highscores if only default levels */
++GOLDDIG_EXTERN int savehighscore; /* only save highscores if only default levels */
+ /* were used */
+
+ /* Variables from controlling input and output scripts */
+-FILE *inscr,*outscr; /* Incoming and outgoing script file */
+-int incount,outcount; /* Current script input and */
++GOLDDIG_EXTERN FILE *inscr,*outscr; /* Incoming and outgoing script file */
++GOLDDIG_EXTERN int incount,outcount; /* Current script input and */
+ /* output order count */
+
+-Display *disp; /* X11 display of client */
+-Window wind; /* X11 window where game is displayed */
+-int scrn; /* Which screen is in use */
+-unsigned long background; /* background color (color displays) */
+-char *geom; /* Display geometry description string */
++GOLDDIG_EXTERN Display *disp; /* X11 display of client */
++GOLDDIG_EXTERN Window wind; /* X11 window where game is displayed */
++GOLDDIG_EXTERN int scrn; /* Which screen is in use */
++GOLDDIG_EXTERN unsigned long background; /* background color (color displays) */
++GOLDDIG_EXTERN char *geom; /* Display geometry description string */
+
+ /* Enumerated type to described direction or activity */
+ enum directs {
+ UNMOVE = 0,STAND = 1,UP = 2,DOWN = 3,LEFT = 4,RIGHT = 5,
+ DIGLEFT = 6,DIGRIGHT = 7,PUTDOWN = 8
+ };
+-enum directs curorder; /* Current order which player has */
++GOLDDIG_EXTERN enum directs curorder; /* Current order which player has */
+ /* typed at the keyboard. */
+-enum directs inorder,outorder; /* Current script input and */
++GOLDDIG_EXTERN enum directs inorder,outorder; /* Current script input and */
+ /* output order */
+ /* Structure describing all stats of thing */
+-struct thing_s {
++GOLDDIG_EXTERN struct thing_s {
+ int xstart,ystart; /* Starting position of thing. For both */
+ /* this pair and (xpos,ypos), the value is */
+ /* actually 2 times the expected value. */
+@@ -111,9 +115,9 @@ struct thing_s {
+ #define BADGUY 'b'
+
+ #define MAXLEVEL 5000 /* Maximum size of a level */
+-unsigned char level[MAXLEVEL]; /* Array describing level using */
++GOLDDIG_EXTERN unsigned char level[MAXLEVEL]; /* Array describing level using */
+ /* characters from above */
+-unsigned char moveallow[MAXLEVEL]; /* Array describing which directions can */
++GOLDDIG_EXTERN unsigned char moveallow[MAXLEVEL]; /* Array describing which directions can */
+ /* be moved out of any position in level */
+ /* Bit patterns for moveallow array */
+ #define MOVEUP 0x1 /* Upward movement is allowed */
+@@ -146,7 +150,7 @@ struct symbs_s {
+
+ /* Array for fast lookup of block types. This array is index by the */
+ /* actual block character. */
+-struct fast_s {
++GOLDDIG_EXTERN struct fast_s {
+ GC gc; /* Graphics cursor used for drawing block */
+ long code; /* Code describing block properties */
+ } fast_lookup[256];
Added: head/games/golddig/files/patch-moveall.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/games/golddig/files/patch-moveall.c Thu Feb 18 16:37:39 2021 (r565951)
@@ -0,0 +1,13 @@
+--- moveall.c.orig 2021-02-18 16:19:37 UTC
++++ moveall.c
+@@ -9,8 +9,8 @@ extern int numbadguy;
+
+ /* These are the graphics cursors used for drawing the player at */
+ /* various times. */
+-GC standgc,angelgc,angelugc,angellgc,flygc,hang1gc,hang2gc,up1gc,up2gc;
+-GC left1gc,left2gc,right1gc,right2gc;
++extern GC standgc,angelgc,angelugc,angellgc,flygc,hang1gc,hang2gc,up1gc,up2gc;
++extern GC left1gc,left2gc,right1gc,right2gc;
+
+ /* Redraw the player. The graphics cursors all use the GXor function */
+ /* so they will not erase what is underneath. */
Added: head/games/golddig/files/patch-movement.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/games/golddig/files/patch-movement.c Thu Feb 18 16:37:39 2021 (r565951)
@@ -0,0 +1,26 @@
+--- movement.c.orig 1991-04-02 06:46:54 UTC
++++ movement.c
+@@ -426,6 +426,7 @@ int num; /* Number of bad g
+ newdir = thing->dir;
+ }
+ break;
++ case STAND: case DIGLEFT: case DIGRIGHT: case UNMOVE: case PUTDOWN: break;
+ }
+
+ /* By default, the thing is standing in place */
+@@ -498,6 +499,7 @@ int num; /* Number of bad g
+ thing->dir = RIGHT;
+ }
+ break;
++ case STAND: case UNMOVE: break;
+ }
+ return(0);
+ }
+@@ -602,6 +604,7 @@ int num; /* Number of bad g
+ thing->dir = RIGHT;
+ }
+ break;
++ case STAND: case DIGLEFT: case DIGRIGHT: case UNMOVE: case PUTDOWN: break;
+ }
+ return(0);
+ }
Added: head/games/golddig/files/patch-shared.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ head/games/golddig/files/patch-shared.c Thu Feb 18 16:37:39 2021 (r565951)
@@ -0,0 +1,12 @@
+--- shared.c.orig 2021-02-18 15:46:01 UTC
++++ shared.c
+@@ -14,6 +14,9 @@
+ #include <X11/Xutil.h>
+ #include <errno.h>
+ #include <string.h>
++
++#define GOLDDIG_EXTERN
++
+ #include <golddig.h>
+ /* Include all the bitmaps for the terrain blocks */
+ #include <bitmaps.h>
More information about the svn-ports-all
mailing list