From: nethack.rankin Date: Thu, 28 Sep 2006 03:56:02 +0000 (+0000) Subject: wizard ^G tweaks X-Git-Tag: MOVE2GIT~874 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e6f9adcc539c0e41a88afcecbd407397670c3af8;p=nethack wizard ^G tweaks Wizard mode's ^G lets you specify "tame ", "peaceful ", or "hostile " to override the created monster's default disposition. Since it also lets you override the restriction against creating unique monsters and various other special ones like shopkeepers (a post-3.4.3 change), it became possible to produce tame versions of monsters that ordinarily are impossible to tame. That's pretty iffy even when it only applies to debugging, so switch from internal tameness conversion to use of tamedog() to get the non-tameable cases handled. (Minor side-effect: full moon might prevent a request for "tame dog" from starting out tame.) Also, for ^G, give up before the specified count is reached if creation fails when creating multiple copies of a specific type of monster, on the assumption that the level has become filled up. (When the type is random, keep trying in case you subsequently get something different which could survive on water or inside solid rock.) --- diff --git a/src/read.c b/src/read.c index 8d848572c..ae95f9938 100644 --- a/src/read.c +++ b/src/read.c @@ -2066,30 +2066,27 @@ create_particular() whichpm = &mons[which]; } for (i = 0; i <= multi; i++) { - if (randmonst) - whichpm = rndmonst(); if (monclass != MAXMCLASSES) whichpm = mkclass(monclass, 0); - if (maketame) { - mtmp = makemon(whichpm, u.ux, u.uy, MM_EDOG); - if (mtmp) { - initedog(mtmp); - set_malign(mtmp); - newsym(mtmp->mx, mtmp->my); - } - } else { - mtmp = makemon(whichpm, u.ux, u.uy, NO_MM_FLAGS); - if ((makepeaceful || makehostile) && mtmp) { - mtmp->mtame = 0; /* sanity precaution */ - mtmp->mpeaceful = makepeaceful ? 1 : 0; - set_malign(mtmp); - } + else if (randmonst) + whichpm = rndmonst(); + mtmp = makemon(whichpm, u.ux, u.uy, NO_MM_FLAGS); + if (!mtmp) { + /* quit trying if creation failed and is going to repeat */ + if (monclass == MAXMCLASSES && !randmonst) break; + /* otherwise try again */ + continue; } - if (mtmp) { - madeany = TRUE; - if (mtmp->cham >= LOW_PM && firstchoice != NON_PM) - (void)newcham(mtmp, &mons[firstchoice], FALSE, FALSE); + if (maketame) { + (void) tamedog(mtmp, (struct obj *) 0); + } else if (makepeaceful || makehostile) { + mtmp->mtame = 0; /* sanity precaution */ + mtmp->mpeaceful = makepeaceful ? 1 : 0; + set_malign(mtmp); } + madeany = TRUE; + if (mtmp->cham >= LOW_PM && firstchoice != NON_PM) + (void)newcham(mtmp, &mons[firstchoice], FALSE, FALSE); } } return madeany;