From 17f5642faf45669a6bf2cc7ab6d191ba62328a6e Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Wed, 13 May 2026 23:05:44 +0300 Subject: [PATCH] Obey statue type gender The gnome king statue in minetn-5 was generated as a gnome leader, obey the gender of the statue name, so generating a statue of for example "gnome king" and "gnome queen" works correctly. --- doc/fixes5-0-1.txt | 1 + src/sp_lev.c | 17 +++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/doc/fixes5-0-1.txt b/doc/fixes5-0-1.txt index 259399e64..f5c5f25f1 100644 --- a/doc/fixes5-0-1.txt +++ b/doc/fixes5-0-1.txt @@ -20,6 +20,7 @@ doc: use full URL for nethack.org in Guidebook.mn doc: fix a paste error in Guidebook.tex doc: fix spelling correction in nethack.6 spelling: "Flanian Pobble Bead" to "Flainian Pobble Bead" +obey statue type gender (gnome king statue in minetn-5) Platform- and/or Interface-Specific Fixes diff --git a/src/sp_lev.c b/src/sp_lev.c index ab86cd3a5..a894c5e46 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -3671,6 +3671,7 @@ lspo_object(lua_State *L) boolean nonpmobj = FALSE; int i; char *montype = get_table_str_opt(L, "montype", NULL); + int lflags = 0; if (montype) { if ((tmpobj.id == TIN && (!strcmpi(montype, "spinach") @@ -3688,11 +3689,16 @@ lspo_object(lua_State *L) G_NOGEN | G_IGNORE); } else { for (i = LOW_PM; i < NUMMONS; i++) - if (!strcmpi(mons[i].pmnames[NEUTRAL], montype) - || (mons[i].pmnames[MALE] != 0 - && !strcmpi(mons[i].pmnames[MALE], montype)) - || (mons[i].pmnames[FEMALE] != 0 - && !strcmpi(mons[i].pmnames[FEMALE], montype))) { + if (!strcmpi(mons[i].pmnames[NEUTRAL], montype)) { + pm = &mons[i]; + break; + } else if (mons[i].pmnames[MALE] != 0 + && !strcmpi(mons[i].pmnames[MALE], montype)) { + lflags |= CORPSTAT_MALE; + pm = &mons[i]; + } else if (mons[i].pmnames[FEMALE] != 0 + && !strcmpi(mons[i].pmnames[FEMALE], montype)) { + lflags |= CORPSTAT_FEMALE; pm = &mons[i]; break; } @@ -3704,7 +3710,6 @@ lspo_object(lua_State *L) nhl_error(L, "Unknown montype"); } if (tmpobj.id == STATUE || tmpobj.id == CORPSE) { - int lflags = 0; if (get_table_boolean_opt(L, "historic", 0)) lflags |= CORPSTAT_HISTORIC;