Make throwable prioritize weapons and other throwables

master
kts of kettek (nyaa) 2019-08-13 17:22:22 -07:00
parent b2d044ce6a
commit 89b5ea6db0
1 changed files with 17 additions and 1 deletions

View File

@ -1792,7 +1792,23 @@ static object *find_throw_ob(object *op, const char *request) {
}
}
/* look through the inventory */
/* look through the inventory for high-priority throwables first */
if (tmp == NULL) {
for (tmp = op->inv; tmp != NULL; tmp = tmp->below) {
if (!(tmp->type == WEAPON || tmp->subtype == POT_THROW || tmp->subtype == POT_DUST))
continue;
/* can't toss invisible or inv-locked items */
if (tmp->invisible || QUERY_FLAG(tmp, FLAG_INV_LOCKED))
continue;
query_name(tmp, name, MAX_BUF);
if (!request
|| !strcmp(name, request)
|| !strcmp(tmp->name, request))
break;
}
}
/* look through the inventory for others */
if (tmp == NULL) {
for (tmp = op->inv; tmp != NULL; tmp = tmp->below) {
/* can't toss invisible or inv-locked items */