Dehardcode number of glass gems
This commit is contained in:
@@ -572,7 +572,8 @@ make_corpse(struct monst *mtmp, unsigned int corpseflags)
|
|||||||
case PM_GLASS_GOLEM:
|
case PM_GLASS_GOLEM:
|
||||||
num = d(2, 4); /* very low chance of creating all glass gems */
|
num = d(2, 4); /* very low chance of creating all glass gems */
|
||||||
while (num--)
|
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);
|
free_mgivenname(mtmp);
|
||||||
break;
|
break;
|
||||||
case PM_CLAY_GOLEM:
|
case PM_CLAY_GOLEM:
|
||||||
|
|||||||
+1
-1
@@ -556,7 +556,7 @@ m_throw(
|
|||||||
nomul(0);
|
nomul(0);
|
||||||
|
|
||||||
if (singleobj->oclass == GEM_CLASS
|
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)) {
|
&& is_unicorn(g.youmonst.data)) {
|
||||||
if (singleobj->otyp > LAST_GEM) {
|
if (singleobj->otyp > LAST_GEM) {
|
||||||
You("catch the %s.", xname(singleobj));
|
You("catch the %s.", xname(singleobj));
|
||||||
|
|||||||
+1
-1
@@ -3956,7 +3956,7 @@ readobjnam_postparse2(struct _readobjnam_data *d)
|
|||||||
s += 9;
|
s += 9;
|
||||||
if (!strcmpi(s, "glass")) { /* choose random color */
|
if (!strcmpi(s, "glass")) { /* choose random color */
|
||||||
/* 9 different kinds */
|
/* 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)
|
if (objects[d->typ].oc_class == GEM_CLASS)
|
||||||
return 2; /*goto typfnd;*/
|
return 2; /*goto typfnd;*/
|
||||||
else
|
else
|
||||||
|
|||||||
+16
-1
@@ -2018,6 +2018,8 @@ do_objs(void)
|
|||||||
int prefix = 0;
|
int prefix = 0;
|
||||||
char class = '\0';
|
char class = '\0';
|
||||||
boolean sumerr = FALSE;
|
boolean sumerr = FALSE;
|
||||||
|
int n_glass_gems = 0;
|
||||||
|
int start_glass_gems = 0;
|
||||||
|
|
||||||
filename[0] = '\0';
|
filename[0] = '\0';
|
||||||
#ifdef FILE_PREFIX
|
#ifdef FILE_PREFIX
|
||||||
@@ -2091,6 +2093,14 @@ do_objs(void)
|
|||||||
if (objects[i].oc_material == GLASS) {
|
if (objects[i].oc_material == GLASS) {
|
||||||
Fprintf(ofp, "/* #define\t%s\t%d */\n", objnam, i);
|
Fprintf(ofp, "/* #define\t%s\t%d */\n", objnam, i);
|
||||||
prefix = -1;
|
prefix = -1;
|
||||||
|
if (!n_glass_gems)
|
||||||
|
start_glass_gems = i;
|
||||||
|
if (i != n_glass_gems + start_glass_gems) {
|
||||||
|
Fprintf(stderr, "glass gems not sequential\n");
|
||||||
|
(void) fflush(stderr);
|
||||||
|
sumerr = TRUE;
|
||||||
|
}
|
||||||
|
n_glass_gems++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/*FALLTHRU*/
|
/*FALLTHRU*/
|
||||||
@@ -2112,15 +2122,20 @@ do_objs(void)
|
|||||||
prefix = 0;
|
prefix = 0;
|
||||||
|
|
||||||
sum += objects[i].oc_prob;
|
sum += objects[i].oc_prob;
|
||||||
|
|
||||||
|
if (sumerr)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check last set of probabilities */
|
/* check last set of probabilities */
|
||||||
if (sum && sum != 1000) {
|
if (!sumerr && sum && sum != 1000) {
|
||||||
Fprintf(stderr, "prob error for class %d (%d%%)", class, sum);
|
Fprintf(stderr, "prob error for class %d (%d%%)", class, sum);
|
||||||
(void) fflush(stderr);
|
(void) fflush(stderr);
|
||||||
sumerr = TRUE;
|
sumerr = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Fprintf(ofp, "\n");
|
||||||
|
Fprintf(ofp, "#define\tNUM_GLASS_GEMS\t%d\n", n_glass_gems);
|
||||||
Fprintf(ofp, "#define\tLAST_GEM\t(JADE)\n");
|
Fprintf(ofp, "#define\tLAST_GEM\t(JADE)\n");
|
||||||
Fprintf(ofp, "#define\tMAXSPELL\t%d\n", nspell + 1);
|
Fprintf(ofp, "#define\tMAXSPELL\t%d\n", nspell + 1);
|
||||||
Fprintf(ofp, "#define\tNUM_OBJECTS\t%d\n", i);
|
Fprintf(ofp, "#define\tNUM_OBJECTS\t%d\n", i);
|
||||||
|
|||||||
Reference in New Issue
Block a user