From 38161f3e4a90d4ba771ef4b00e89f44aaad26b50 Mon Sep 17 00:00:00 2001 From: nhmall Date: Mon, 6 Oct 2025 11:49:31 -0400 Subject: [PATCH] relocate customization application Resolves #1450 --- include/extern.h | 1 + include/flag.h | 1 + src/allmain.c | 2 ++ src/glyphs.c | 13 ++++++++++--- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/include/extern.h b/include/extern.h index 670fb77a8..d533e0d49 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1155,6 +1155,7 @@ extern void dump_glyphids(void); extern void clear_all_glyphmap_colors(void); extern void reset_customcolors(void); extern int glyph_to_cmap(int); +extern void maybe_shuffle_customizations(void); /* ### hack.c ### */ diff --git a/include/flag.h b/include/flag.h index bd6a5dc58..a566c04de 100644 --- a/include/flag.h +++ b/include/flag.h @@ -254,6 +254,7 @@ struct instance_flags { boolean remember_getpos; /* save getpos() positioning in do-again queue */ boolean sad_feeling; /* unseen pet is dying */ boolean showdamage; /* extra message reporting damage hero has taken */ + boolean pending_customizations; /* at least one custom. was specified */ xint8 debug_fuzzer; /* fuzz testing */ int at_midnight; /* only valid during end of game disclosure */ int at_night; /* also only valid during end of game disclosure */ diff --git a/src/allmain.c b/src/allmain.c index a1fad95c9..f6d1ee503 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -178,6 +178,8 @@ moveloop_core(void) #ifdef POSITIONBAR do_positionbar(); #endif + if (iflags.pending_customizations) + maybe_shuffle_customizations(); dobjsfree(); diff --git a/src/glyphs.c b/src/glyphs.c index c584e212f..d92bef9fc 100644 --- a/src/glyphs.c +++ b/src/glyphs.c @@ -568,15 +568,22 @@ apply_customizations( } } } - if (at_least_one) { - shuffle_customizations(); - } + iflags.pending_customizations = at_least_one; } /* Shuffle the customizations to match shuffled object descriptions, * so a red potion isn't displayed with a blue customization, and so on. */ +void +maybe_shuffle_customizations(void) +{ + if (iflags.pending_customizations) { + shuffle_customizations(); + iflags.pending_customizations = 0; + } +} + #if 0 staticfn void shuffle_customizations(void)