… | |
… | |
1351 | * found object is returned. |
1351 | * found object is returned. |
1352 | */ |
1352 | */ |
1353 | object * |
1353 | object * |
1354 | find_arrow (object *op, const char *type) |
1354 | find_arrow (object *op, const char *type) |
1355 | { |
1355 | { |
1356 | object *tmp = 0; |
|
|
1357 | |
|
|
1358 | for (op = op->inv; op; op = op->below) |
1356 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
1359 | if (!tmp && op->type == CONTAINER && op->race == type && QUERY_FLAG (op, FLAG_APPLIED)) |
|
|
1360 | tmp = find_arrow (splay (op), type); |
|
|
1361 | else if (op->type == ARROW && op->race == type) |
1357 | if (tmp->type == ARROW && !strcmp (tmp->race, type)) |
1362 | return splay (op); |
1358 | return splay (tmp); |
1363 | |
1359 | |
|
|
1360 | for (object *tmp = op->inv; tmp; tmp = tmp->below) |
|
|
1361 | if (tmp->type == CONTAINER && QUERY_FLAG (tmp, FLAG_APPLIED) && !strcmp (tmp->race, type)) |
|
|
1362 | if (object *arrow = find_arrow (tmp, type)) |
|
|
1363 | { |
|
|
1364 | splay (tmp); |
|
|
1365 | return arrow; |
|
|
1366 | } |
|
|
1367 | |
1364 | return tmp; |
1368 | return 0; |
1365 | } |
1369 | } |
1366 | |
1370 | |
1367 | /* |
1371 | /* |
1368 | * Similar to find_arrow, but looks for (roughly) the best arrow to use |
1372 | * Similar to find_arrow, but looks for (roughly) the best arrow to use |
1369 | * against the target. A full test is not performed, simply a basic test |
1373 | * against the target. A full test is not performed, simply a basic test |