Fixed bug in getrandomobofclass() causing "get random food" to fail.
This commit is contained in:
parent
3e3bc4a334
commit
cd58efb772
16
objects.c
16
objects.c
|
@ -5346,6 +5346,10 @@ objecttype_t *getrandomobofclass(enum OBCLASS ocid, int minrarity, int maxrarity
|
|||
}
|
||||
poss = malloc(totcount*sizeof(objecttype_t *));
|
||||
|
||||
if (wantrr == RR_NONE) {
|
||||
wantrr = NA;
|
||||
}
|
||||
|
||||
|
||||
tryagain = B_TRUE;
|
||||
while (tryagain) {
|
||||
|
@ -5366,7 +5370,7 @@ objecttype_t *getrandomobofclass(enum OBCLASS ocid, int minrarity, int maxrarity
|
|||
rarityok = B_TRUE;
|
||||
}
|
||||
|
||||
if (wantrr) {
|
||||
if (wantrr != NA) {
|
||||
int rrok = B_FALSE;
|
||||
if (f->val[2] == NA) {
|
||||
rrok = B_TRUE;
|
||||
|
@ -5376,7 +5380,7 @@ objecttype_t *getrandomobofclass(enum OBCLASS ocid, int minrarity, int maxrarity
|
|||
if (!rrok) rarityok = B_FALSE;
|
||||
}
|
||||
} else {
|
||||
|
||||
rarityok = B_TRUE;
|
||||
}
|
||||
|
||||
// if we're randomly selecting an object for a lf, make sure it matches their
|
||||
|
@ -5387,14 +5391,18 @@ objecttype_t *getrandomobofclass(enum OBCLASS ocid, int minrarity, int maxrarity
|
|||
if (!sk || getskill(forlf, sk->id)) {
|
||||
skillok = B_TRUE;
|
||||
}
|
||||
} else skillok = B_TRUE;
|
||||
} else {
|
||||
skillok = B_TRUE;
|
||||
}
|
||||
|
||||
|
||||
if (cs) {
|
||||
if (otmeets(ot, cs)) {
|
||||
condok = B_TRUE;
|
||||
}
|
||||
} else condok = B_TRUE;
|
||||
} else {
|
||||
condok = B_TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
// minar only applies if we're asking for armour
|
||||
|
|
18
spell.c
18
spell.c
|
@ -5964,14 +5964,16 @@ int dospelleffects(lifeform_t *caster, enum OBTYPE spellid, int power, lifeform_
|
|||
while (pickagain) {
|
||||
pickagain = B_FALSE;
|
||||
ot = getrandomobofclass(OC_FOOD, NA, NA, NA, NULL, NULL);
|
||||
if (hasflag(ot->flags, F_VENOMSAC)) {
|
||||
pickagain = B_TRUE;
|
||||
continue;
|
||||
}
|
||||
f = hasflag(ot->flags, F_EDIBLE);
|
||||
if (!f || (f->val[1] <= 5)) {
|
||||
pickagain = B_TRUE;
|
||||
continue;
|
||||
if (ot) {
|
||||
if (hasflag(ot->flags, F_VENOMSAC)) {
|
||||
pickagain = B_TRUE;
|
||||
continue;
|
||||
}
|
||||
f = hasflag(ot->flags, F_EDIBLE);
|
||||
if (!f || (f->val[1] <= 5)) {
|
||||
pickagain = B_TRUE;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue