Fix statue and figurine genders in special levels

When a random statue or a figurine was generated in special levels,
the gender was not initialized correctly, so you ended up getting
eg. "dwarf ruler"

It now works correctly, and you can still specifically request
a non-gendered version with the montype-parameter.

For example

des.object({ id = "statue" });
des.object({ id = "statue", montype = "dwarf ruler" });
This commit is contained in:
Pasi Kallinen
2026-05-14 17:38:29 +03:00
parent 342bbc85c4
commit f000fed16d
2 changed files with 6 additions and 2 deletions
+1
View File
@@ -21,6 +21,7 @@ doc: fix a paste error in Guidebook.tex
doc: fix spelling correction in nethack.6 doc: fix spelling correction in nethack.6
spelling: "Flanian Pobble Bead" to "Flainian Pobble Bead" spelling: "Flanian Pobble Bead" to "Flainian Pobble Bead"
obey statue type gender (gnome king statue in minetn-5) obey statue type gender (gnome king statue in minetn-5)
fix statue and figurine genders in special levels in general
Platform- and/or Interface-Specific Fixes Platform- and/or Interface-Specific Fixes
+5 -2
View File
@@ -3691,11 +3691,13 @@ lspo_object(lua_State *L)
for (i = LOW_PM; i < NUMMONS; i++) for (i = LOW_PM; i < NUMMONS; i++)
if (!strcmpi(mons[i].pmnames[NEUTRAL], montype)) { if (!strcmpi(mons[i].pmnames[NEUTRAL], montype)) {
pm = &mons[i]; pm = &mons[i];
tmpobj.spe = 0;
break; break;
} else if (mons[i].pmnames[MALE] != 0 } else if (mons[i].pmnames[MALE] != 0
&& !strcmpi(mons[i].pmnames[MALE], montype)) { && !strcmpi(mons[i].pmnames[MALE], montype)) {
lflags |= CORPSTAT_MALE; lflags |= CORPSTAT_MALE;
pm = &mons[i]; pm = &mons[i];
break;
} else if (mons[i].pmnames[FEMALE] != 0 } else if (mons[i].pmnames[FEMALE] != 0
&& !strcmpi(mons[i].pmnames[FEMALE], montype)) { && !strcmpi(mons[i].pmnames[FEMALE], montype)) {
lflags |= CORPSTAT_FEMALE; lflags |= CORPSTAT_FEMALE;
@@ -3709,7 +3711,7 @@ lspo_object(lua_State *L)
else if (!nonpmobj) else if (!nonpmobj)
nhl_error(L, "Unknown montype"); nhl_error(L, "Unknown montype");
} }
if (tmpobj.id == STATUE || tmpobj.id == CORPSE) { if (tmpobj.id == STATUE || tmpobj.id == CORPSE || tmpobj.id == FIGURINE) {
if (get_table_boolean_opt(L, "historic", 0)) if (get_table_boolean_opt(L, "historic", 0))
lflags |= CORPSTAT_HISTORIC; lflags |= CORPSTAT_HISTORIC;
@@ -3717,7 +3719,8 @@ lspo_object(lua_State *L)
lflags |= CORPSTAT_MALE; lflags |= CORPSTAT_MALE;
if (get_table_boolean_opt(L, "female", 0)) if (get_table_boolean_opt(L, "female", 0))
lflags |= CORPSTAT_FEMALE; lflags |= CORPSTAT_FEMALE;
tmpobj.spe = lflags; if (lflags |= 0)
tmpobj.spe = lflags;
} else if (tmpobj.id == EGG) { } else if (tmpobj.id == EGG) {
tmpobj.spe = get_table_boolean_opt(L, "laid_by_you", 0) ? 1 : 0; tmpobj.spe = get_table_boolean_opt(L, "laid_by_you", 0) ? 1 : 0;
} else if (!nonpmobj) { /* tmpobj.spe is already set for nonpmobj */ } else if (!nonpmobj) { /* tmpobj.spe is already set for nonpmobj */