diff --git a/doc/fixes34.4 b/doc/fixes34.4 index 1020b45a3..2bdfe73ca 100644 --- a/doc/fixes34.4 +++ b/doc/fixes34.4 @@ -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 " are confused" message +handle antholes more sensibly when ants aren't available Platform- and/or Interface-Specific Fixes diff --git a/include/extern.h b/include/extern.h index 81546a0fb..8330cd989 100644 --- a/include/extern.h +++ b/include/extern.h @@ -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 *)); diff --git a/src/mklev.c b/src/mklev.c index dcc87a307..e86596ff1 100644 --- a/src/mklev.c +++ b/src/mklev.c @@ -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); diff --git a/src/mkroom.c b/src/mkroom.c index 1c1946bd6..0d17f0a6d 100644 --- a/src/mkroom.c +++ b/src/mkroom.c @@ -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]); }