Remove workarounds for ancient compilers
This commit is contained in:
@@ -28,7 +28,6 @@
|
|||||||
#ifdef _DCC
|
#ifdef _DCC
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#define _SIZE_T
|
#define _SIZE_T
|
||||||
#define DCC30_BUG /* A bitfield bug (from dog.c, others) in DICE 3.0. */
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __GNUC__
|
#ifndef __GNUC__
|
||||||
|
|||||||
@@ -600,15 +600,8 @@ struct levelflags {
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
struct rm locations[COLNO][ROWNO];
|
struct rm locations[COLNO][ROWNO];
|
||||||
#ifndef MICROPORT_BUG
|
|
||||||
struct obj *objects[COLNO][ROWNO];
|
struct obj *objects[COLNO][ROWNO];
|
||||||
struct monst *monsters[COLNO][ROWNO];
|
struct monst *monsters[COLNO][ROWNO];
|
||||||
#else
|
|
||||||
struct obj *objects[1][ROWNO];
|
|
||||||
char *yuk1[COLNO - 1][ROWNO];
|
|
||||||
struct monst *monsters[1][ROWNO];
|
|
||||||
char *yuk2[COLNO - 1][ROWNO];
|
|
||||||
#endif
|
|
||||||
struct obj *objlist;
|
struct obj *objlist;
|
||||||
struct obj *buriedobjlist;
|
struct obj *buriedobjlist;
|
||||||
struct monst *monlist;
|
struct monst *monlist;
|
||||||
|
|||||||
@@ -79,9 +79,5 @@ extern int FDECL(strncmpi, (const char *, const char *, size_t));
|
|||||||
extern boolean colors_changed; /* in tos.c */
|
extern boolean colors_changed; /* in tos.c */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __GNUC__
|
|
||||||
#define GCC_BUG /* correct a gcc bug involving double for loops */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* TOSCONF_H */
|
#endif /* TOSCONF_H */
|
||||||
#endif /* TOS */
|
#endif /* TOS */
|
||||||
|
|||||||
@@ -70,18 +70,6 @@
|
|||||||
* Linux, Solaris 2.x
|
* Linux, Solaris 2.x
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* #define OPENWINBUG */ /* avoid a problem using OpenWindows 3.0 for
|
|
||||||
X11 on SunOS 4.1.x, x>= 2. Do not define
|
|
||||||
for other X11 implementations. */
|
|
||||||
/* #define PYRAMID_BUG */ /* avoid a bug on the Pyramid */
|
|
||||||
/* #define BSD_43_BUG */ /* for real 4.3BSD cc's without schain botch fix */
|
|
||||||
/* #define MICROPORT_BUG */ /* problems with large arrays in structs */
|
|
||||||
/* #define MICROPORT_286_BUG */ /* changes needed in termcap.c to get it to
|
|
||||||
run with Microport Sys V/AT version 2.4.
|
|
||||||
By Jay Maynard */
|
|
||||||
/* #define AIXPS_2BUG */ /* avoid a problem with little_to_big() optimization
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* #define RANDOM */ /* if neither random/srandom nor lrand48/srand48
|
/* #define RANDOM */ /* if neither random/srandom nor lrand48/srand48
|
||||||
is available from your system */
|
is available from your system */
|
||||||
|
|
||||||
|
|||||||
+1
-10
@@ -1704,16 +1704,7 @@ int
|
|||||||
dosearch0(aflag)
|
dosearch0(aflag)
|
||||||
register int aflag; /* intrinsic autosearch vs explicit searching */
|
register int aflag; /* intrinsic autosearch vs explicit searching */
|
||||||
{
|
{
|
||||||
#ifdef GCC_BUG
|
xchar x, y;
|
||||||
/* Some old versions of gcc seriously muck up nested loops. If you get
|
|
||||||
* strange crashes while searching in a version compiled with gcc, try
|
|
||||||
* putting #define GCC_BUG in *conf.h (or adding -DGCC_BUG to CFLAGS in
|
|
||||||
* the makefile).
|
|
||||||
*/
|
|
||||||
volatile xchar x, y;
|
|
||||||
#else
|
|
||||||
register xchar x, y;
|
|
||||||
#endif
|
|
||||||
register struct trap *trap;
|
register struct trap *trap;
|
||||||
register struct monst *mtmp;
|
register struct monst *mtmp;
|
||||||
|
|
||||||
|
|||||||
+1
-10
@@ -1330,16 +1330,7 @@ int mmflags;
|
|||||||
if (uwep && uwep->oartifact == ART_EXCALIBUR)
|
if (uwep && uwep->oartifact == ART_EXCALIBUR)
|
||||||
mtmp->mpeaceful = mtmp->mtame = FALSE;
|
mtmp->mpeaceful = mtmp->mtame = FALSE;
|
||||||
}
|
}
|
||||||
#ifndef DCC30_BUG
|
if (mndx == PM_LONG_WORM && (mtmp->wormno = get_wormno()) != 0) {
|
||||||
if (mndx == PM_LONG_WORM && (mtmp->wormno = get_wormno()) != 0)
|
|
||||||
#else
|
|
||||||
/* DICE 3.0 doesn't like assigning and comparing mtmp->wormno in the
|
|
||||||
same expression. */
|
|
||||||
if (mndx == PM_LONG_WORM
|
|
||||||
&& (mtmp->wormno = get_wormno(), mtmp->wormno != 0))
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
/* we can now create worms with tails - 11/91 */
|
|
||||||
initworm(mtmp, rn2(5));
|
initworm(mtmp, rn2(5));
|
||||||
if (count_wsegs(mtmp))
|
if (count_wsegs(mtmp))
|
||||||
place_worm_tail_randomly(mtmp, x, y);
|
place_worm_tail_randomly(mtmp, x, y);
|
||||||
|
|||||||
@@ -598,13 +598,6 @@ clear_level_structures()
|
|||||||
lev = &levl[x][0];
|
lev = &levl[x][0];
|
||||||
for (y = 0; y < ROWNO; y++) {
|
for (y = 0; y < ROWNO; y++) {
|
||||||
*lev++ = zerorm;
|
*lev++ = zerorm;
|
||||||
/*
|
|
||||||
* These used to be '#if MICROPORT_BUG',
|
|
||||||
* with use of memset(0) for '#if !MICROPORT_BUG' below,
|
|
||||||
* but memset is not appropriate for initializing pointers,
|
|
||||||
* so do these g.level.objects[][] and level.monsters[][]
|
|
||||||
* initializations unconditionally.
|
|
||||||
*/
|
|
||||||
g.level.objects[x][y] = (struct obj *) 0;
|
g.level.objects[x][y] = (struct obj *) 0;
|
||||||
g.level.monsters[x][y] = (struct monst *) 0;
|
g.level.monsters[x][y] = (struct monst *) 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,6 @@
|
|||||||
/*-Copyright (c) Derek S. Ray, 2015. */
|
/*-Copyright (c) Derek S. Ray, 2015. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
/* If you're using precompiled headers, you don't want this either */
|
|
||||||
#ifdef MICROPORT_BUG
|
|
||||||
#define MKROOM_H
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
#include "mfndpos.h"
|
#include "mfndpos.h"
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
@@ -3895,16 +3890,7 @@ boolean msg; /* "The oldmon turns into a newmon!" */
|
|||||||
unstuck(mtmp);
|
unstuck(mtmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef DCC30_BUG
|
|
||||||
if (mdat == &mons[PM_LONG_WORM] && (mtmp->wormno = get_wormno()) != 0) {
|
if (mdat == &mons[PM_LONG_WORM] && (mtmp->wormno = get_wormno()) != 0) {
|
||||||
#else
|
|
||||||
/* DICE 3.0 doesn't like assigning and comparing mtmp->wormno in the
|
|
||||||
* same expression.
|
|
||||||
*/
|
|
||||||
if (mdat == &mons[PM_LONG_WORM]
|
|
||||||
&& (mtmp->wormno = get_wormno(), mtmp->wormno != 0)) {
|
|
||||||
#endif
|
|
||||||
/* we can now create worms with tails - 11/91 */
|
|
||||||
initworm(mtmp, rn2(5));
|
initworm(mtmp, rn2(5));
|
||||||
place_worm_tail_randomly(mtmp, mtmp->mx, mtmp->my);
|
place_worm_tail_randomly(mtmp, mtmp->mx, mtmp->my);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1147,16 +1147,8 @@ register struct trobj *trop;
|
|||||||
if (obj->oclass == SPBOOK_CLASS && obj->otyp != SPE_BLANK_PAPER)
|
if (obj->oclass == SPBOOK_CLASS && obj->otyp != SPE_BLANK_PAPER)
|
||||||
initialspell(obj);
|
initialspell(obj);
|
||||||
|
|
||||||
#if !defined(PYRAMID_BUG) && !defined(MAC)
|
|
||||||
if (--trop->trquan)
|
if (--trop->trquan)
|
||||||
continue; /* make a similar object */
|
continue; /* make a similar object */
|
||||||
#else
|
|
||||||
if (trop->trquan) { /* check if zero first */
|
|
||||||
--trop->trquan;
|
|
||||||
if (trop->trquan)
|
|
||||||
continue; /* make a similar object */
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
trop++;
|
trop++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -305,9 +305,6 @@ xchar *rx, *ry;
|
|||||||
void
|
void
|
||||||
invault()
|
invault()
|
||||||
{
|
{
|
||||||
#ifdef BSD_43_BUG
|
|
||||||
int dummy; /* hack to avoid schain botch */
|
|
||||||
#endif
|
|
||||||
struct monst *guard;
|
struct monst *guard;
|
||||||
boolean gsensed;
|
boolean gsensed;
|
||||||
int trycount, vaultroom = (int) vault_occupied(u.urooms);
|
int trycount, vaultroom = (int) vault_occupied(u.urooms);
|
||||||
|
|||||||
@@ -136,11 +136,5 @@ II.B.3. Compiling NetHack with the commercial version of DICE
|
|||||||
however, this is not recommended, and you should upgrade to the
|
however, this is not recommended, and you should upgrade to the
|
||||||
commercial version.)
|
commercial version.)
|
||||||
|
|
||||||
DICE 3.0 (the first commercial release) has a couple of bugs in it which
|
|
||||||
turn up in several of the NetHack sources; the DCC30_BUG define fixes
|
|
||||||
them. If you have a more recent version of the compiler, you may be
|
|
||||||
able to compile without this (and get slightly more efficient code) by
|
|
||||||
commenting out the define in amiconf.h.
|
|
||||||
|
|
||||||
During compilation, DICE will output a lot of warnings; they can be
|
During compilation, DICE will output a lot of warnings; they can be
|
||||||
safely ignored.
|
safely ignored.
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ Notes:
|
|||||||
config.h: UNIX, TTY_GRAPHICS
|
config.h: UNIX, TTY_GRAPHICS
|
||||||
unixconf.h: SYSV, SVR4, TERMINFO, POSIX_JOB_CONTROL, POSIX_TYPES
|
unixconf.h: SYSV, SVR4, TERMINFO, POSIX_JOB_CONTROL, POSIX_TYPES
|
||||||
|
|
||||||
X11_GRAPHICS does work. Do not define OPENWINBUG. You may safely define
|
X11_GRAPHICS does work. You may safely define
|
||||||
NETWORK, TEXTCOLOR if desired. Other #defines in these files may be
|
NETWORK, TEXTCOLOR if desired. Other #defines in these files may be
|
||||||
defined too, as needed. Just make sure that the set mentioned here are
|
defined too, as needed. Just make sure that the set mentioned here are
|
||||||
not misdefined, or your compile will fail (do _not_ define BSD or SUNOS4).
|
not misdefined, or your compile will fail (do _not_ define BSD or SUNOS4).
|
||||||
|
|||||||
+1
-35
@@ -128,39 +128,6 @@ support is only a small, optional, part of nethack, and the Makefile is
|
|||||||
needed for systems that don't use X11.
|
needed for systems that don't use X11.
|
||||||
|
|
||||||
|
|
||||||
Notes for Sun's OpenWindows:
|
|
||||||
1. For OpenWindows 3.0 (NOT 2.x), define OPENWINBUG in include/unixconf.h.
|
|
||||||
The library bug from SunOS 4.1.x is fixed in Solaris 2.x (or when
|
|
||||||
proper Sun patches have been applied to 4.1.x), so it is also
|
|
||||||
unnecessary there. (Defining it when unnecessary causes the same
|
|
||||||
problem being avoided when it is necessary. :-)
|
|
||||||
|
|
||||||
2. In addition to the changes suggested by the comments in src/Makefile,
|
|
||||||
|
|
||||||
-- for OpenWindows 2.x and 3.0 (NOT 3.1) (i.e., versions for SunOS 4.x),
|
|
||||||
add -I/usr/openwin/include to CFLAGS, -L/usr/openwin/lib to LFLAGS,
|
|
||||||
and -lm to WINX11LIB in src/Makefile.
|
|
||||||
|
|
||||||
-- for OpenWindows 3.1 (i.e., versions for Solaris 2.x), add
|
|
||||||
-I/usr/openwin/include to CFLAGS, -L/usr/openwin/lib -L/usr/ccs/lib
|
|
||||||
-R/usr/openwin/lib to LFLAGS, and -lsocket -lnsl -lm
|
|
||||||
to WINX11LIB in src/Makefile.
|
|
||||||
|
|
||||||
(Naturally, if your OpenWindows is installed elsewhere, adapt the
|
|
||||||
openwin paths.) This will allow you to create a game executable.
|
|
||||||
|
|
||||||
3. Run the fonts through convertfont and run bldfamily on the directory.
|
|
||||||
Now you must let your X server know where to find the fonts. For a
|
|
||||||
personal installation, the simplest thing is to include the directory
|
|
||||||
of the fonts in the environment variable FONTPATH, as set in your
|
|
||||||
.profile or .login before starting the server. For a multi-user
|
|
||||||
installation, you have the various "xset fp+" options outlined
|
|
||||||
above for standard X.
|
|
||||||
|
|
||||||
4. Something must still be done with the NetHack.ad file -- all three
|
|
||||||
of the possibilities mentioned for standard X11 should work.
|
|
||||||
|
|
||||||
|
|
||||||
Notes for AIX 3.2:
|
Notes for AIX 3.2:
|
||||||
1. AIX 3.2 includes the Athena Widget Toolkit library (and other things)
|
1. AIX 3.2 includes the Athena Widget Toolkit library (and other things)
|
||||||
under the /usr/lpp/X11/Xamples tree, so you will have to add
|
under the /usr/lpp/X11/Xamples tree, so you will have to add
|
||||||
@@ -170,8 +137,7 @@ Notes for AIX 3.2:
|
|||||||
|
|
||||||
Notes for XFree86 - (on linux and BSD386 platforms)
|
Notes for XFree86 - (on linux and BSD386 platforms)
|
||||||
|
|
||||||
1. Edit src/Makefile for linux/BSD386. Even though you use the
|
1. Edit src/Makefile for linux/BSD386. Use the
|
||||||
Open Look Window manager, do not define OPENWINBUG. Use the
|
|
||||||
standard X11 object and library options.
|
standard X11 object and library options.
|
||||||
|
|
||||||
2. Follow the standard installation directions defined above.
|
2. Follow the standard installation directions defined above.
|
||||||
|
|||||||
@@ -2609,19 +2609,6 @@ int dir;
|
|||||||
if (dir != WININIT)
|
if (dir != WININIT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef OPENWINBUG
|
|
||||||
/* With the OpenWindows 3.0 libraries and the SunOS 4.1.2 ld, these
|
|
||||||
* two routines will not be found when linking. An apparently correct
|
|
||||||
* executable is produced, along with nasty messages and a failure code
|
|
||||||
* returned to make. The routines are in the static libXmu.a and
|
|
||||||
* libXmu.sa.4.0, but not in libXmu.so.4.0. Rather than fiddle with
|
|
||||||
* static linking, we do this.
|
|
||||||
*/
|
|
||||||
if (rn2(2) > 2) { /* i.e., FALSE that an optimizer probably can't find */
|
|
||||||
get_wmShellWidgetClass();
|
|
||||||
get_applicationShellWidgetClass();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,11 +10,7 @@
|
|||||||
#include "wintty.h"
|
#include "wintty.h"
|
||||||
#include "tcap.h"
|
#include "tcap.h"
|
||||||
|
|
||||||
#ifdef MICROPORT_286_BUG
|
|
||||||
#define Tgetstr(key) (tgetstr(key, tbuf))
|
|
||||||
#else
|
|
||||||
#define Tgetstr(key) (tgetstr(key, &tbufptr))
|
#define Tgetstr(key) (tgetstr(key, &tbufptr))
|
||||||
#endif /* MICROPORT_286_BUG **/
|
|
||||||
|
|
||||||
static char *FDECL(s_atr2str, (int));
|
static char *FDECL(s_atr2str, (int));
|
||||||
static char *FDECL(e_atr2str, (int));
|
static char *FDECL(e_atr2str, (int));
|
||||||
|
|||||||
Reference in New Issue
Block a user