From 5f56440956476d78291f8f788c248f4be5799bb6 Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 10 May 2019 14:59:03 -0400 Subject: [PATCH] instead of BETA or not, have devel states of release, wip, beta Now that development sources are made public prior to BETA testing, it is useful to have a work-in-progress state prior to BETA. --- include/global.h | 16 +++++++++++++--- src/cmd.c | 6 +++--- src/dog.c | 3 ++- src/mkobj.c | 4 ++-- src/questpgr.c | 2 +- src/rnd.c | 8 ++++---- src/sys.c | 2 +- src/version.c | 2 +- sys/amiga/amidos.c | 2 +- sys/unix/sysconf | 3 ++- sys/vms/sysconf | 3 ++- sys/vms/vmsmain.c | 2 +- util/makedefs.c | 20 ++++++++++++++++---- 13 files changed, 49 insertions(+), 24 deletions(-) diff --git a/include/global.h b/include/global.h index cd421345b..d00697fbe 100644 --- a/include/global.h +++ b/include/global.h @@ -8,7 +8,17 @@ #include -#define BETA /* development or beta testing [MRS] */ +/* + * Development status possibilities. + */ +#define NH_STATUS_RELEASED 0 /* Released */ +#define NH_STATUS_WIP 1 /* Work in progress */ +#define NH_STATUS_BETA 2 /* BETA testing */ + +/* + * Development status of this NetHack version. + */ +#define NH_DEVEL_STATUS NH_STATUS_WIP #ifndef DEBUG /* allow tool chains to define without causing warnings */ #define DEBUG @@ -339,9 +349,9 @@ struct savefile_info { #define MAXMONNO 120 /* extinct monst after this number created */ #define MHPMAX 500 /* maximum monster hp */ -/* PANICTRACE: Always defined for BETA but only for supported platforms. */ +/* PANICTRACE: Always defined for NH_DEVEL_STATUS == NH_STATUS_BETA but only for supported platforms. */ #ifdef UNIX -#ifdef BETA +#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) /* see end.c */ #ifndef PANICTRACE #define PANICTRACE diff --git a/src/cmd.c b/src/cmd.c index 148f63ca1..f32d16062 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -582,11 +582,11 @@ extcmd_via_menu() if ((len = (int) strlen(efp->ef_desc)) > biggest) biggest = len; if (++i > MAX_EXT_CMD) { -#if defined(BETA) +#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) impossible( "Exceeded %d extended commands in doextcmd() menu; 'extmenu' disabled.", MAX_EXT_CMD); -#endif /* BETA */ +#endif /* NH_DEVEL_STATUS != NH_STATUS_RELEASED */ iflags.extmenu = 0; return -1; } @@ -660,7 +660,7 @@ extcmd_via_menu() if (n == 1) { if (matchlevel > (QBUFSZ - 2)) { free((genericptr_t) pick_list); -#if defined(BETA) +#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) impossible("Too many chars (%d) entered in extcmd_via_menu()", matchlevel); #endif diff --git a/src/dog.c b/src/dog.c index b5913de35..5c50eb69c 100644 --- a/src/dog.c +++ b/src/dog.c @@ -468,7 +468,8 @@ long nmv; /* number of moves */ { int imv = 0; /* avoid zillions of casts and lint warnings */ -#if defined(DEBUG) || defined(BETA) +#if defined(DEBUG) || (NH_DEVEL_STATUS != NH_STATUS_RELEASED) + if (nmv < 0L) { /* crash likely... */ panic("catchup from future time?"); /*NOTREACHED*/ diff --git a/src/mkobj.c b/src/mkobj.c index 195de0b4a..f87beb554 100644 --- a/src/mkobj.c +++ b/src/mkobj.c @@ -2476,7 +2476,7 @@ STATIC_OVL void sanity_check_worn(obj) struct obj *obj; { -#if defined(BETA) || defined(DEBUG) +#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) || defined(DEBUG) static unsigned long wearbits[] = { W_ARM, W_ARMC, W_ARMH, W_ARMS, W_ARMG, W_ARMF, W_ARMU, W_WEP, W_QUIVER, W_SWAPWEP, W_AMUL, W_RINGL, W_RINGR, W_TOOL, @@ -2659,7 +2659,7 @@ struct obj *obj; insane_object(obj, ofmt0, maskbuf, mon); } } -#else /* not (BETA || DEBUG) */ +#else /* not (NH_DEVEL_STATUS != NH_STATUS_RELEASED) || DEBUG) */ /* dummy use of obj to avoid "arg not used" complaint */ if (!obj) insane_object(obj, ofmt0, "", (struct monst *) 0); diff --git a/src/questpgr.c b/src/questpgr.c index cf6fbdd38..7d58fd89a 100644 --- a/src/questpgr.c +++ b/src/questpgr.c @@ -565,7 +565,7 @@ int how; if (qt_msg->summary_size) { (void) dlb_fgets(in_line, sizeof in_line, msg_file); convert_line(in_line, out_line); -#ifdef BETA +#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) } else if (qt_msg->delivery == 'c') { /* skip for 'qtdump' of 'p' */ /* delivery 'c' and !summary_size, summary expected but not present; this doesn't prefix the number with role code vs 'general' diff --git a/src/rnd.c b/src/rnd.c index 8f92e42ab..0ca649fbb 100644 --- a/src/rnd.c +++ b/src/rnd.c @@ -101,7 +101,7 @@ int rn2(x) register int x; { -#ifdef BETA +#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) if (x <= 0) { impossible("rn2(%d) attempted", x); return 0; @@ -121,7 +121,7 @@ register int x; { register int i, adjustment; -#ifdef BETA +#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) if (x <= 0) { impossible("rnl(%d) attempted", x); return 0; @@ -163,7 +163,7 @@ int rnd(x) register int x; { -#ifdef BETA +#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) if (x <= 0) { impossible("rnd(%d) attempted", x); return 1; @@ -180,7 +180,7 @@ register int n, x; { register int tmp = n; -#ifdef BETA +#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) if (x < 0 || n < 0 || (x == 0 && n != 0)) { impossible("d(%d,%d) attempted", n, x); return 1; diff --git a/src/sys.c b/src/sys.c index 1ff73d57a..d8aafbe9b 100644 --- a/src/sys.c +++ b/src/sys.c @@ -63,7 +63,7 @@ sys_early_init() /* panic options */ sysopt.gdbpath = dupstr(GDBPATH); sysopt.greppath = dupstr(GREPPATH); -#ifdef BETA +#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) sysopt.panictrace_gdb = 1; #ifdef PANICTRACE_LIBC sysopt.panictrace_libc = 2; diff --git a/src/version.c b/src/version.c index 1ed62b7d3..468aae711 100644 --- a/src/version.c +++ b/src/version.c @@ -63,7 +63,7 @@ char *buf; Sprintf(eos(buf), "%s%s", c++ ? "," : "", NetHack_git_sha); #endif #if defined(NETHACK_GIT_BRANCH) -#if defined(BETA) +#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) if (NetHack_git_branch) Sprintf(eos(buf), "%sbranch:%s", c++ ? "," : "", NetHack_git_branch); diff --git a/sys/amiga/amidos.c b/sys/amiga/amidos.c index 2ae3bee19..3fe520bb3 100644 --- a/sys/amiga/amidos.c +++ b/sys/amiga/amidos.c @@ -210,7 +210,7 @@ const char *path, *files; BPTR dirLock, dirLock2; struct FileInfoBlock *fibp; int chklen; -#ifdef BETA +#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) if(files != alllevels)panic("eraseall"); #endif chklen=(int)index(files,'*')-(int)files; diff --git a/sys/unix/sysconf b/sys/unix/sysconf index debb2de5b..5986f54a5 100644 --- a/sys/unix/sysconf +++ b/sys/unix/sysconf @@ -110,7 +110,8 @@ MAXPLAYERS=10 # Try to get more info in case of a program bug or crash. Only used # if the program is built with the PANICTRACE compile-time option enabled. -# By default PANICTRACE is enabled if BETA is defined, otherwise disabled. +# By default PANICTRACE is enabled if (NH_DEVEL_STATUS != NH_STATUS_RELEASED), +# otherwise disabled. # Using GDB can get more information and works on more systems but requires # 'gdb' be available; using LIBC only works if NetHack is linked with a # libc that supports the backtrace(3) API. Both require certain compilation diff --git a/sys/vms/sysconf b/sys/vms/sysconf index 21aa347e7..b4ffd357b 100644 --- a/sys/vms/sysconf +++ b/sys/vms/sysconf @@ -71,7 +71,8 @@ # Try to get more info in case of a program bug or crash. Only used # if the program is built with the PANICTRACE compile-time option enabled. -# By default PANICTRACE is enabled if BETA is defined, otherwise disabled. +# By default PANICTRACE is enabled if (NH_DEVEL_STATUS != NH_STATUS_RELEASED), +# otherwise disabled. # (GDBPATH, GREPPATH, and PANICTRACE_LIBC aren't used on VMS. # PANICTRACE_GDB is repurposed, with nothing to do with 'gdb'. # Values are 1: show traceback and exit, 2: show traceback and diff --git a/sys/vms/vmsmain.c b/sys/vms/vmsmain.c index 98f04be23..0a8572007 100644 --- a/sys/vms/vmsmain.c +++ b/sys/vms/vmsmain.c @@ -415,7 +415,7 @@ genericptr_t sigargs, mechargs; /* [0] is argc, [1..argc] are the real args */ || (condition >= SS$_ASTFLT && condition <= SS$_TBIT) || (condition >= SS$_ARTRES && condition <= SS$_INHCHME)) { program_state.done_hup = TRUE; /* pretend hangup has been attempted */ -#ifndef BETA +#if (NH_DEVEL_STATUS == NH_STATUS_RELEASED) if (wizard) #endif abort(); /* enter the debugger */ diff --git a/util/makedefs.c b/util/makedefs.c index b167c18c3..b85fe3dca 100644 --- a/util/makedefs.c +++ b/util/makedefs.c @@ -1182,7 +1182,7 @@ const char *delim; { Sprintf(outbuf, "%d%s%d%s%d", VERSION_MAJOR, delim, VERSION_MINOR, delim, PATCHLEVEL); -#ifdef BETA +#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) Sprintf(eos(outbuf), "-%d", EDITLEVEL); #endif return outbuf; @@ -1196,8 +1196,12 @@ const char *build_date; char subbuf[64], versbuf[64]; char betabuf[64]; -#ifdef BETA +#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) +#if (NH_DEVEL_STATUS == NH_STATUS_BETA) Strcpy(betabuf, " Beta"); +#else + Strcpy(betabuf, " Work-in-progress"); +#endif #else betabuf[0] = '\0'; #endif @@ -1226,8 +1230,12 @@ const char *build_date; subbuf[0] = ' '; Strcpy(&subbuf[1], PORT_SUB_ID); #endif -#ifdef BETA +#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) +#if (NH_DEVEL_STATUS == NH_STATUS_BETA) Strcat(subbuf, " Beta"); +#else + Strcat(subbuf, " Work-in-progress"); +#endif #endif Sprintf(outbuf, " Version %s %s%s, %s %s.", @@ -1813,8 +1821,12 @@ do_options() Fprintf(ofp, "\n%sNetHack version %d.%d.%d%s\n", opt_indent, VERSION_MAJOR, VERSION_MINOR, PATCHLEVEL, -#ifdef BETA +#if (NH_DEVEL_STATUS != NH_STATUS_RELEASED) +#if (NH_DEVEL_STATUS == NH_STATUS_BETA) " [beta]" +#else + " [work-in-progress]" +#endif #else "" #endif -- 2.40.0