Dehardcode number of glass gems

This commit is contained in:
Pasi Kallinen
2021-06-21 10:06:46 +03:00
parent 0bb77f455d
commit f84538aa8c
4 changed files with 20 additions and 4 deletions

View File

@@ -572,7 +572,8 @@ make_corpse(struct monst *mtmp, unsigned int corpseflags)
case PM_GLASS_GOLEM:
num = d(2, 4); /* very low chance of creating all glass gems */
while (num--)
obj = mksobj_at((LAST_GEM + rnd(9)), x, y, TRUE, FALSE);
obj = mksobj_at((LAST_GEM + rnd(NUM_GLASS_GEMS)),
x, y, TRUE, FALSE);
free_mgivenname(mtmp);
break;
case PM_CLAY_GOLEM:

View File

@@ -556,7 +556,7 @@ m_throw(
nomul(0);
if (singleobj->oclass == GEM_CLASS
&& singleobj->otyp <= LAST_GEM + 9 /* 9 glass colors */
&& singleobj->otyp <= LAST_GEM + NUM_GLASS_GEMS
&& is_unicorn(g.youmonst.data)) {
if (singleobj->otyp > LAST_GEM) {
You("catch the %s.", xname(singleobj));

View File

@@ -3956,7 +3956,7 @@ readobjnam_postparse2(struct _readobjnam_data *d)
s += 9;
if (!strcmpi(s, "glass")) { /* choose random color */
/* 9 different kinds */
d->typ = LAST_GEM + rnd(9);
d->typ = LAST_GEM + rnd(NUM_GLASS_GEMS);
if (objects[d->typ].oc_class == GEM_CLASS)
return 2; /*goto typfnd;*/
else