From fddc966a3e4f84479f1e2eb14741b4268d0bde22 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 26 Mar 2024 11:22:42 -0700 Subject: [PATCH] alternate symbol parsing Make the array of alternate symbol names 'static' and move it to the top if its routine. Add S_suit as another alternate for S_armor. --- src/symbols.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/symbols.c b/src/symbols.c index 23e618a72..d456f3922 100644 --- a/src/symbols.c +++ b/src/symbols.c @@ -1,4 +1,4 @@ -/* NetHack 3.7 symbols.c $NHDT-Date: 1661295669 2022/08/23 23:01:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.90 $ */ +/* NetHack 3.7 symbols.c $NHDT-Date: 1711477037 2024/03/26 18:17:17 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.120 $ */ /* Copyright (c) NetHack Development Team 2020. */ /* NetHack may be freely redistributed. See license for details. */ @@ -851,17 +851,19 @@ parsesymbols(char *opts, int which_set) const struct symparse * match_sym(char *buf) { - int i; - struct alternate_parse { + static struct alternate_parse { const char *altnm; const char *nm; } alternates[] = { - { "S_armour", "S_armor" }, { "S_explode1", "S_expl_tl" }, + { "S_armour", "S_armor" }, { "S_suit", "S_armor" }, + /* alt explosion names are numbered in phone key/button layout */ + { "S_explode1", "S_expl_tl" }, { "S_explode2", "S_expl_tc" }, { "S_explode3", "S_expl_tr" }, { "S_explode4", "S_expl_ml" }, { "S_explode5", "S_expl_mc" }, { "S_explode6", "S_expl_mr" }, { "S_explode7", "S_expl_bl" }, { "S_explode8", "S_expl_bc" }, { "S_explode9", "S_expl_br" }, }; + int i; size_t len = strlen(buf); const char *p = strchr(buf, ':'), *q = strchr(buf, '='); const struct symparse *sp = loadsyms;