From c0acf2f89f38732ee6e1faa5538c2712787ea4e4 Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 15 Dec 2023 19:59:26 -0500 Subject: [PATCH] add artifact_nums to nethack --dumpenums --- include/artilist.h | 9 +++++++-- src/allmain.c | 20 ++++++++++++++++---- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/include/artilist.h b/include/artilist.h index 71c26ecf8..66a005914 100644 --- a/include/artilist.h +++ b/include/artilist.h @@ -13,8 +13,13 @@ static const char *const artifact_names[] = { #elif defined(ARTI_ENUM) #define A(nam, typ, s1, s2, mt, atk, dfn, cry, inv, al, cl, rac, \ - cost, clr, bn) \ + cost, clr, bn) \ ART_##bn + +#elif defined(DUMP_ARTI_ENUM) +#define A(nam, typ, s1, s2, mt, atk, dfn, cry, inv, al, cl, rac, \ + cost, clr, bn) \ + { ART_##bn, "ART_" #bn } #else /* in artifact.c, set up the actual artifact list structure */ @@ -259,7 +264,7 @@ A("The Palantir of Westernesse", CRYSTAL_BALL, NO_ATTK, DFNS(AD_MAGM), NO_CARY, CREATE_PORTAL, A_NEUTRAL, PM_WIZARD, NON_PM, 4000L, NO_COLOR, EYE_OF_THE_AETHIOPICA), -#if !defined(ARTI_ENUM) +#if !defined(ARTI_ENUM) && !defined(DUMP_ARTI_ENUM) /* * terminator; otyp must be zero */ diff --git a/src/allmain.c b/src/allmain.c index f0bf8e8e6..fda143822 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -1143,8 +1143,16 @@ struct enum_dump objclass_syms_dump[] = { }; #undef DUMP_ENUMS_OBJCLASS_SYMS +#define DUMP_ARTI_ENUM +struct enum_dump arti_enum_dump[] = { +#include "artilist.h" + { AFTER_LAST_ARTIFACT, "AFTER_LAST_ARTIFACT" } +}; +#undef DUMP_ARTI_ENUM + #undef DUMP_ENUMS + #ifndef NODUMPENUMS static void @@ -1160,14 +1168,16 @@ dump_enums(void) objclass_defchars_enum, objclass_classes_enum, objclass_syms_enum, + arti_enum, NUM_ENUM_DUMPS }; static const char *const titles[NUM_ENUM_DUMPS] = { "monnums", "objects_nums" , "misc_object_nums", "cmap_symbols", "mon_syms", "mon_defchars", "objclass_defchars", "objclass_classes", - "objclass_syms", + "objclass_syms", "artifacts_nums", }; + #define dump_om(om) { om, #om } static const struct enum_dump omdump[] = { dump_om(LAST_GENERIC), @@ -1194,19 +1204,21 @@ dump_enums(void) objclass_defchars_dump, objclass_classes_dump, objclass_syms_dump, + arti_enum_dump, }; static const char *const pfx[NUM_ENUM_DUMPS] = { "PM_", "", "", "", "", "", "", - "", "" }; + "", "", "" }; /* 0 = dump numerically only, 1 = add 'char' comment */ - static const int dumpflgs[NUM_ENUM_DUMPS] = { 0, 0, 0, 0, 0, 1, 1, 0, 0}; + static const int dumpflgs[NUM_ENUM_DUMPS] = { 0, 0, 0, 0, 0, 1, 1, 0, 0, 0 }; static int szd[NUM_ENUM_DUMPS] = { SIZE(monsdump), SIZE(objdump), SIZE(omdump), SIZE(defsym_cmap_dump), SIZE(defsym_mon_syms_dump), SIZE(defsym_mon_defchars_dump), SIZE(objclass_defchars_dump), SIZE(objclass_classes_dump), - SIZE(objclass_syms_dump) + SIZE(objclass_syms_dump), + SIZE(arti_enum_dump), }; const char *nmprefix; int i, j, nmwidth;