filling antholes

From a bug report:  when creating a
level, anthole rooms can be generated even when no ants are left, unlike
beehives which get suppressed once killer bees are gone.  Also, if some
ants are available but the type chosen for the current level isn't (in his
case, soldier ants had been genocided), the anthole was filled will random
monsters instead of picking another type of ant.  This fixes both issues.
Random monsters will only occur if the last type of ant gets used up while
filling an anthole that was started when some ants were available, same as
how monster generation for beehives and barracks works.
This commit is contained in:
nethack.rankin
2006-03-09 05:39:38 +00:00
parent 354f4254bc
commit e1ef0f1042
4 changed files with 18 additions and 11 deletions

View File

@@ -199,6 +199,7 @@ make baby long worms have lower level than full grown ones
use "your kraken" instead of "a kraken" when searching reveals a tame
hidden monster
Magicbane should not produce "<something> are confused" message
handle antholes more sensibly when ants aren't available
Platform- and/or Interface-Specific Fixes

View File

@@ -1150,6 +1150,7 @@ E void NDECL(obj_sanity_check);
E void FDECL(mkroom, (int));
E void FDECL(fill_zoo, (struct mkroom *));
E struct permonst *NDECL(antholemon);
E boolean FDECL(nexttodoor, (int,int));
E boolean FDECL(has_dnstairs, (struct mkroom *));
E boolean FDECL(has_upstairs, (struct mkroom *));

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)mklev.c 3.5 2006/01/28 */
/* SCCS Id: @(#)mklev.c 3.5 2006/03/06 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -736,7 +736,7 @@ makelevel()
else if (u_depth > 9 && !rn2(5) &&
!(mvitals[PM_KILLER_BEE].mvflags & G_GONE)) mkroom(BEEHIVE);
else if (u_depth > 11 && !rn2(6)) mkroom(MORGUE);
else if (u_depth > 12 && !rn2(8)) mkroom(ANTHOLE);
else if (u_depth > 12 && !rn2(8) && antholemon()) mkroom(ANTHOLE);
else if (u_depth > 14 && !rn2(4) &&
!(mvitals[PM_SOLDIER].mvflags & G_GONE)) mkroom(BARRACKS);
else if (u_depth > 15 && !rn2(6)) mkroom(SWAMP);

View File

@@ -1,4 +1,4 @@
/* SCCS Id: @(#)mkroom.c 3.5 2006/01/28 */
/* SCCS Id: @(#)mkroom.c 3.5 2006/03/06 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -21,7 +21,6 @@ STATIC_DCL void NDECL(mkshop), FDECL(mkzoo,(int)), NDECL(mkswamp);
STATIC_DCL void NDECL(mktemple);
STATIC_DCL coord * FDECL(shrine_pos, (int));
STATIC_DCL struct permonst * NDECL(morguemon);
STATIC_DCL struct permonst * NDECL(antholemon);
STATIC_DCL struct permonst * NDECL(squadmon);
STATIC_DCL void FDECL(save_room, (int,struct mkroom *));
STATIC_DCL void FDECL(rest_room, (int,struct mkroom *));
@@ -426,17 +425,23 @@ morguemon()
: (i < 40) ? &mons[PM_WRAITH] : mkclass(S_ZOMBIE,0));
}
STATIC_OVL struct permonst *
struct permonst *
antholemon()
{
int mtyp;
int mtyp, indx, trycnt = 0;
/* casts are for dealing with time_t */
indx = (int)((long)u.ubirthday % 3L);
indx += level_difficulty();
/* Same monsters within a level, different ones between levels */
switch ((level_difficulty() + ((long)u.ubirthday)) % 3) {
default: mtyp = PM_GIANT_ANT; break;
case 0: mtyp = PM_SOLDIER_ANT; break;
case 1: mtyp = PM_FIRE_ANT; break;
}
do {
switch ((indx + trycnt) % 3) {
case 0: mtyp = PM_SOLDIER_ANT; break;
case 1: mtyp = PM_FIRE_ANT; break;
default: mtyp = PM_GIANT_ANT; break;
}
/* try again if chosen type has been genocided or used up */
} while (++trycnt < 3 && (mvitals[mtyp].mvflags & G_GONE));
return ((mvitals[mtyp].mvflags & G_GONE) ?
(struct permonst *)0 : &mons[mtyp]);
}