From: Ray Chason Date: Mon, 7 Nov 2022 02:51:19 +0000 (-0500) Subject: Parse only Unicode symbols in the current symset X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5181c287d3c419b553ca025199b36094131d91ca;p=nethack Parse only Unicode symbols in the current symset --- diff --git a/src/symbols.c b/src/symbols.c index 0b517addd..29ddf9f7c 100644 --- a/src/symbols.c +++ b/src/symbols.c @@ -332,6 +332,10 @@ clear_symsetentry(int which_set, boolean name_too) free((genericptr_t) g.symset[which_set].name); g.symset[which_set].name = (char *) 0; } +#ifdef ENHANCED_SYMBOLS + free_all_glyphmap_u(); + purge_custom_entries(which_set); +#endif } boolean symset_is_compatible(enum symset_handling_types handling, unsigned long wincap2) @@ -462,7 +466,11 @@ parse_sym_line(char *buf, int which_set) symp = match_sym(buf); if (!symp && buf[0] == 'G' && buf[1] == '_') { #ifdef ENHANCED_SYMBOLS - is_glyph = match_glyph(buf); + if (g.chosen_symset_start) { + is_glyph = match_glyph(buf); + } else { + is_glyph = TRUE; /* report error only once */ + } #else enhanced_unavailable = TRUE; #endif @@ -608,7 +616,9 @@ parse_sym_line(char *buf, int which_set) } #ifdef ENHANCED_SYMBOLS } else { - glyphrep_to_custom_map_entries(buf, &glyph); + if (g.chosen_symset_start) { + glyphrep_to_custom_map_entries(buf, &glyph); + } #endif } } @@ -1058,11 +1068,11 @@ apply_customizations_to_symset(enum graphics_sets which_set) struct customization_detail *details; if (g.symset[which_set].handling == H_UTF8 - && g.sym_customizations[UNICODESET].count - && g.sym_customizations[UNICODESET].details) { + && g.sym_customizations[which_set].count + && g.sym_customizations[which_set].details) { /* These UTF-8 customizations get applied to the glyphmap array, not to symset entries */ - details = g.sym_customizations[UNICODESET].details; + details = g.sym_customizations[which_set].details; while (details) { gm = &glyphmap[details->content.urep.glyphidx]; (void) set_map_u(gm, diff --git a/src/utf8map.c b/src/utf8map.c index fbffe18b7..35e390fbb 100644 --- a/src/utf8map.c +++ b/src/utf8map.c @@ -65,7 +65,7 @@ to_custom_symset_entry_callback(int glyph, struct find_struct *findwhat) (findwhat->color != 0L) ? findwhat->color : 0L); #endif add_custom_urep_entry(known_handling[H_UTF8], glyph, - uval, utf8str, findwhat->color, UNICODESET); + uval, utf8str, findwhat->color, g.symset_which_set); } }