Display the contents of a container in inventory style. Used for wand of probing of non-empty containers and statues. */
| 5443 | /* Display the contents of a container in inventory style. |
| 5444 | Used for wand of probing of non-empty containers and statues. */ |
| 5445 | struct obj * |
| 5446 | display_cinventory(struct obj *obj) |
| 5447 | { |
| 5448 | struct obj *ret; |
| 5449 | char qbuf[QBUFSZ]; |
| 5450 | int n; |
| 5451 | menu_item *selected = 0; |
| 5452 | |
| 5453 | (void) safe_qbuf(qbuf, "Contents of ", ":", obj, |
| 5454 | /* custom formatting routines to insert "trapped" |
| 5455 | into the object's name when appropriate; |
| 5456 | last resort "that" won't ever get used */ |
| 5457 | cinv_doname, cinv_ansimpleoname, "that"); |
| 5458 | |
| 5459 | if (obj->cobj) { |
| 5460 | n = query_objlist(qbuf, &(obj->cobj), INVORDER_SORT, |
| 5461 | &selected, PICK_NONE, allow_all); |
| 5462 | } else { |
| 5463 | invdisp_nothing(qbuf, "(empty)"); |
| 5464 | n = 0; |
| 5465 | } |
| 5466 | if (n > 0) { |
| 5467 | ret = selected[0].item.a_obj; |
| 5468 | free((genericptr_t) selected); |
| 5469 | } else |
| 5470 | ret = (struct obj *) 0; |
| 5471 | obj->cknown = 1; |
| 5472 | return ret; |
| 5473 | } |
| 5474 | |
| 5475 | |
| 5476 | staticfn boolean |
no test coverage detected