From adc455129df305f4726ee5bb223671257e7ec2a4 Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 28 Nov 2019 15:00:54 -0800 Subject: [PATCH] 3.7: goldX and other stuff Move option variable goldX (True: treat gold as BUC unknown, False: treat gold as uncursed during BUCX filtering) from iflags to flags so that it persists across save/restore. Get rid of a few obsolete things from struct flags. Try to make the 'cursesgraphics' option work although I don't think that it was ever functional enough for anybody to use so probably could have been removed instead. Bump EDITLEVEL; any current save files are invalid. Demote status from Beta to Work-in-Progress. I modified src/sfdata.c manually (not included here) to get a full build. The Unix Makefile.src needs to be taught when and how to regenerate it. --- include/flag.h | 47 +++++++------------------------------------- include/global.h | 4 ++-- include/patchlevel.h | 4 ++-- src/invent.c | 8 ++++---- src/options.c | 12 +++++------ src/pickup.c | 4 ++-- 6 files changed, 23 insertions(+), 56 deletions(-) diff --git a/include/flag.h b/include/flag.h index 19c1ec9f6..d0237d628 100644 --- a/include/flag.h +++ b/include/flag.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 flag.h $NHDT-Date: 1574900824 2019/11/28 00:27:04 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.160 $ */ +/* NetHack 3.7 flag.h $NHDT-Date: 1574982014 2019/11/28 23:00:14 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.166 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -32,6 +32,7 @@ struct flag { #define discover flags.explore boolean female; boolean friday13; /* it's Friday the 13th */ + boolean goldX; /* for BUCX filtering, whether gold is X or U */ boolean help; /* look in data file for info about stuff */ boolean ignintr; /* ignore interrupts */ boolean ins_chkpt; /* checkpoint as appropriate; INSURANCE */ @@ -40,7 +41,6 @@ struct flag { boolean lit_corridor; /* show a dark corr as lit if it is in sight */ boolean nap; /* `timed_delay' option for display effects */ boolean null; /* OK to send nulls to the terminal */ - boolean p__obsolete; /* [3.6.2: perm_invent moved to iflags] */ boolean pickup; /* whether you pickup or move and look */ boolean pickup_thrown; /* auto-pickup items you threw */ boolean pushweapon; /* When wielding, push old weapon into second slot */ @@ -49,27 +49,6 @@ struct flag { boolean showexp; /* show experience points */ boolean showscore; /* show score */ boolean silent; /* whether the bell rings or not */ - /* The story so far: - * 'sortloot' originally took a True/False value but was changed - * to use a letter instead. 3.6.0 was released without changing its - * type from 'boolean' to 'char'. A compiler was smart enough to - * complain that assigning any of the relevant letters was not 0 or 1 - * so not appropriate for boolean (by a configuration which used - * SKIP_BOOLEAN to bypass nethack's 'boolean' and use a C++-compatible - * one). So the type was changed to 'xchar', which is guaranteed to - * match the size of 'boolean' (this guarantee only applies for the - * !SKIP_BOOLEAN config, unfortunately). Since xchar does not match - * actual use, the type was later changed to 'char'. But that would - * break 3.6.0 savefile compatibility for configurations which typedef - * 'schar' to 'short int' instead of to 'char'. (Needed by pre-ANSI - * systems that use unsigned characters without a way to force them - * to be signed.) So, the type has been changed back to 'xchar' for - * 3.6.x. - * - * TODO: change to 'char' (and move out of this block of booleans, - * and get rid of these comments...) once 3.6.0 savefile compatibility - * eventually ends. - */ boolean sortpack; /* sorted inventory */ boolean sparkle; /* show "resisting" special FX (Scott Bigham) */ boolean standout; /* use standout for --More-- */ @@ -94,7 +73,7 @@ struct flag { #define PARANOID_EATING 0x0200 int pickup_burden; /* maximum burden before prompt */ int pile_limit; /* controls feedback when walking over objects */ - char sortloot; /* 'n'=none, 'l'=loot (pickup), 'f'=full ('l'+invent) */ + char sortloot; /* 'n'=none, 'l'=loot (pickup), 'f'=full ('l'+invent) */ char inv_order[MAXOCLASSES]; char pickup_types[MAXOCLASSES]; #define NUM_DISCLOSURE_OPTIONS 6 /* i,a,v,g,c,o (decl.c) */ @@ -273,9 +252,6 @@ struct instance_flags { boolean deferred_X; /* deferred entry into explore mode */ boolean echo; /* 1 to echo characters */ boolean force_invmenu; /* always menu when handling inventory */ - /* FIXME: goldX belongs in flags, but putting it in iflags avoids - breaking 3.6.[01] save files */ - boolean goldX; /* for BUCX filtering, whether gold is X or U */ boolean hilite_pile; /* mark piles of objects with a hilite */ boolean implicit_uncursed; /* maybe omit "uncursed" status in inventory */ boolean mention_walls; /* give feedback when bumping walls */ @@ -296,25 +272,16 @@ struct instance_flags { boolean use_background_glyph; /* use background glyph when appropriate */ boolean use_menu_color; /* use color in menus; only if wc_color */ #ifdef STATUS_HILITES - long hilite_delta; /* number of moves to leave a temp hilite lit */ + long hilite_delta; /* number of moves to leave a temp hilite lit */ long unhilite_deadline; /* time when oldest temp hilite should be unlit */ #endif boolean zerocomp; /* write zero-compressed save files */ boolean rlecomp; /* alternative to zerocomp; run-length encoding * compression of levels when writing savefile */ uchar num_pad_mode; - boolean cursesgraphics; /* Use portable curses extended characters */ -#if 0 /* XXXgraphics superseded by symbol sets */ - boolean DECgraphics; /* use DEC VT-xxx extended character set */ - boolean IBMgraphics; /* use IBM extended character set */ -#ifdef MAC_GRAPHICS_ENV - boolean MACgraphics; /* use Macintosh extended character set, as - as defined in the special font HackFont */ -#endif -#endif - uchar bouldersym; /* symbol for boulder display */ - char prevmsg_window; /* type of old message window to use */ - boolean extmenu; /* extended commands use menu interface */ + uchar bouldersym; /* symbol for boulder display */ + char prevmsg_window; /* type of old message window to use */ + boolean extmenu; /* extended commands use menu interface */ #ifdef MFLOPPY boolean checkspace; /* check disk space before writing files */ /* (in iflags to allow restore after moving diff --git a/include/global.h b/include/global.h index 7bc33dcd8..b9f7c2e42 100644 --- a/include/global.h +++ b/include/global.h @@ -1,4 +1,4 @@ -/* NetHack 3.7 global.h $NHDT-Date: 1557510460 2019/05/10 17:47:40 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.72 $ */ +/* NetHack 3.7 global.h $NHDT-Date: 1574982019 2019/11/28 23:00:19 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.92 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2006. */ /* NetHack may be freely redistributed. See license for details. */ @@ -18,7 +18,7 @@ /* * Development status of this NetHack version. */ -#define NH_DEVEL_STATUS NH_STATUS_BETA +#define NH_DEVEL_STATUS NH_STATUS_WIP #ifndef DEBUG /* allow tool chains to define without causing warnings */ #define DEBUG diff --git a/include/patchlevel.h b/include/patchlevel.h index c43ba0fc8..f86626926 100644 --- a/include/patchlevel.h +++ b/include/patchlevel.h @@ -1,4 +1,4 @@ -/* NetHack 3.7 patchlevel.h $NHDT-Date: 1557510467 2019/05/10 17:47:47 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.127 $ */ +/* NetHack 3.7 patchlevel.h $NHDT-Date: 1574982020 2019/11/28 23:00:20 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.134 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -14,7 +14,7 @@ * Incrementing EDITLEVEL can be used to force invalidation of old bones * and save files. */ -#define EDITLEVEL 0 +#define EDITLEVEL 1 #define COPYRIGHT_BANNER_A "NetHack, Copyright 1985-2019" #define COPYRIGHT_BANNER_B \ diff --git a/src/invent.c b/src/invent.c index 925d4abf2..34fe3c083 100644 --- a/src/invent.c +++ b/src/invent.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 invent.c $NHDT-Date: 1573346190 2019/11/10 00:36:30 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.266 $ */ +/* NetHack 3.6 invent.c $NHDT-Date: 1574982020 2019/11/28 23:00:20 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.280 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Derek S. Ray, 2015. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2895,7 +2895,7 @@ boolean FDECL((*filterfunc), (OBJ_P)); /* coins are either uncursed or unknown based upon option setting */ if (list->oclass == COIN_CLASS) { - if (type == (iflags.goldX ? BUC_UNKNOWN : BUC_UNCURSED)) + if (type == (flags.goldX ? BUC_UNKNOWN : BUC_UNCURSED)) ++count; continue; } @@ -2931,7 +2931,7 @@ int *bcp, *ucp, *ccp, *xcp, *ocp; list->bknown = (list->oclass != COIN_CLASS); /* coins are either uncursed or unknown based upon option setting */ if (list->oclass == COIN_CLASS) { - if (iflags.goldX) + if (flags.goldX) ++(*xcp); else ++(*ucp); @@ -3095,7 +3095,7 @@ struct obj *obj; /* if filtering by bless/curse state, gold is classified as either unknown or uncursed based on user option setting */ if (g.this_type && index("BUCX", g.this_type)) - res = (g.this_type == (iflags.goldX ? 'X' : 'U')); + res = (g.this_type == (flags.goldX ? 'X' : 'U')); } else { switch (g.this_type) { case 'B': diff --git a/src/options.c b/src/options.c index 632598e28..ded48e7ae 100644 --- a/src/options.c +++ b/src/options.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 options.c $NHDT-Date: 1574900826 2019/11/28 00:27:06 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.388 $ */ +/* NetHack 3.6 options.c $NHDT-Date: 1574982022 2019/11/28 23:00:22 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.416 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Michael Allison, 2008. */ /* NetHack may be freely redistributed. See license for details. */ @@ -134,7 +134,7 @@ static const struct Bool_Opt { #endif { "force_invmenu", &iflags.force_invmenu, FALSE, SET_IN_GAME }, { "fullscreen", &iflags.wc2_fullscreen, FALSE, SET_IN_FILE }, /*WC2*/ - { "goldX", &iflags.goldX, FALSE, SET_IN_GAME }, + { "goldX", &flags.goldX, FALSE, SET_IN_GAME }, { "guicolor", &iflags.wc2_guicolor, TRUE, SET_IN_GAME}, /*WC2*/ { "help", &flags.help, TRUE, SET_IN_GAME }, { "herecmd_menu", &iflags.herecmd_menu, FALSE, SET_IN_GAME }, @@ -3840,10 +3840,13 @@ boolean tinitial, tfrom_file; } fullname = "DECgraphics"; - if (match_optname(opts, fullname, 3, TRUE)) { + if (match_optname(opts, fullname, 3, FALSE) + || match_optname(opts, "cursesgraphics", 4, FALSE)) { #ifdef BACKWARD_COMPAT boolean badflag = FALSE; + if (lowc(*opts) == 'c') + fullname = "curses"; /* symbol set name is shorter than optname */ if (duplicate) complain_about_duplicate(opts, 1); if (!negated) { @@ -4052,9 +4055,6 @@ boolean tinitial, tfrom_file; || boolopt[i].addr == &iflags.use_inverse || boolopt[i].addr == &iflags.hilite_pile || boolopt[i].addr == &iflags.perm_invent -#ifdef CURSES_GRAPHICS - || boolopt[i].addr == &iflags.cursesgraphics -#endif || boolopt[i].addr == &iflags.wc_ascii_map || boolopt[i].addr == &iflags.wc_tiled_map) { g.opt_need_redraw = TRUE; diff --git a/src/pickup.c b/src/pickup.c index 4c1a51300..cc793a66b 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 pickup.c $NHDT-Date: 1570566381 2019/10/08 20:26:21 $ $NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.235 $ */ +/* NetHack 3.6 pickup.c $NHDT-Date: 1574982023 2019/11/28 23:00:23 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.249 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /*-Copyright (c) Robert Patrick Rankin, 2012. */ /* NetHack may be freely redistributed. See license for details. */ @@ -392,7 +392,7 @@ struct obj *obj; : g.shop_filter /* coins are never unpaid, but check anyway */ ? (obj->unpaid ? TRUE : FALSE) : g.bucx_filter - ? (index(g.valid_menu_classes, iflags.goldX ? 'X' : 'U') + ? (index(g.valid_menu_classes, flags.goldX ? 'X' : 'U') ? TRUE : FALSE) : TRUE; /* catchall: no filters specified, so accept */