| 268 | } |
| 269 | |
| 270 | RESTORE_WARNING_FORMAT_NONLITERAL |
| 271 | |
| 272 | void |
| 273 | change_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 */ |
| 306 | void |
no test coverage detected