| 377 | } |
| 378 | |
| 379 | staticfn void |
| 380 | look_at_object( |
| 381 | char *buf, /* output buffer */ |
| 382 | coordxy x, coordxy y, |
| 383 | int glyph) |
| 384 | { |
| 385 | struct obj *otmp = 0; |
| 386 | boolean fakeobj = object_from_map(glyph, x, y, &otmp); |
| 387 | |
| 388 | if (otmp) { |
| 389 | Strcpy(buf, (otmp->otyp != STRANGE_OBJECT) |
| 390 | ? distant_name(otmp, otmp->dknown ? doname_with_price |
| 391 | : doname_vague_quan) |
| 392 | : obj_descr[STRANGE_OBJECT].oc_name); |
| 393 | if (fakeobj) { |
| 394 | otmp->where = OBJ_FREE; /* object_from_map set it to OBJ_FLOOR */ |
| 395 | dealloc_obj(otmp), otmp = NULL; /* has no contents */ |
| 396 | } |
| 397 | } else { |
| 398 | Strcpy(buf, something); /* sanity precaution */ |
| 399 | } |
| 400 | |
| 401 | if (otmp && otmp->where == OBJ_BURIED) |
| 402 | Strcat(buf, " (buried)"); |
| 403 | /* check TREE before STONE due to level.flags.arboreal */ |
| 404 | else if (IS_TREE(levl[x][y].typ)) |
| 405 | /* "dangling": "hanging" could imply that it's growing on this tree */ |
| 406 | Snprintf(eos(buf), BUFSZ - strlen(buf), " %s in a tree", |
| 407 | (otmp && is_treefruit(otmp)) ? "dangling" : "stuck"); |
| 408 | else if (levl[x][y].typ == STONE || levl[x][y].typ == SCORR) |
| 409 | Strcat(buf, " embedded in stone"); |
| 410 | else if (IS_WALL(levl[x][y].typ) || levl[x][y].typ == SDOOR) |
| 411 | Strcat(buf, " embedded in a wall"); |
| 412 | else if (closed_door(x, y)) |
| 413 | Strcat(buf, " embedded in a door"); |
| 414 | else if (is_pool(x, y)) |
| 415 | Strcat(buf, " in water"); |
| 416 | else if (is_lava(x, y)) |
| 417 | Strcat(buf, " in molten lava"); /* [can this ever happen?] */ |
| 418 | return; |
| 419 | } |
| 420 | |
| 421 | staticfn void |
| 422 | look_at_monster( |
no test coverage detected