MCPcopy Create free account
hub / github.com/NetHack/NetHack / change_sex

Function change_sex

src/polyself.c:270–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268}
269
270RESTORE_WARNING_FORMAT_NONLITERAL
271
272void
273change_sex(void)
274{
275 /* Some monsters are always of one sex and their sex can't be changed;
276 * Succubi/incubi can change, but are handled below.
277 *
278 * !Upolyd check necessary because is_male() and is_female()
279 * may be true for certain roles
280 */
281 if (!Upolyd
282 || (!is_male(gy.youmonst.data) && !is_female(gy.youmonst.data)
283 && !is_neuter(gy.youmonst.data)))
284 flags.female = !flags.female;
285 if (Upolyd) /* poly'd: also change saved sex */
286 u.mfemale = !u.mfemale;
287 max_rank_sz(); /* [this appears to be superfluous] */
288 if ((Upolyd ? u.mfemale : flags.female) && gu.urole.name.f)
289 Strcpy(svp.pl_character, gu.urole.name.f);
290 else
291 Strcpy(svp.pl_character, gu.urole.name.m);
292 if (!Upolyd) {
293 u.umonnum = u.umonster;
294 } else if (u.umonnum == PM_AMOROUS_DEMON) {
295 flags.female = !flags.female;
296#if 0
297 /* change monster type to match new sex; disabled with
298 PM_AMOROUS_DEMON */
299 u.umonnum = (u.umonnum == PM_SUCCUBUS) ? PM_INCUBUS : PM_SUCCUBUS;
300#endif
301 set_uasmon();
302 }
303}
304
305/* log a message if non-poly'd hero's gender has changed */
306void

Callers 3

Amulet_onFunction · 0.85
newmanFunction · 0.85
eataccessoryFunction · 0.85

Calls 2

max_rank_szFunction · 0.85
set_uasmonFunction · 0.85

Tested by

no test coverage detected