| 862 | } |
| 863 | |
| 864 | staticfn void |
| 865 | sense_trap(struct trap *trap, coordxy x, coordxy y, int src_cursed) |
| 866 | { |
| 867 | if (Hallucination || src_cursed) { |
| 868 | struct obj obj; /* fake object */ |
| 869 | |
| 870 | obj = cg.zeroobj; |
| 871 | if (trap) { |
| 872 | obj.ox = trap->tx; |
| 873 | obj.oy = trap->ty; |
| 874 | } else { |
| 875 | obj.ox = x; |
| 876 | obj.oy = y; |
| 877 | } |
| 878 | obj.otyp = !Hallucination ? GOLD_PIECE : random_object(rn2); |
| 879 | obj.quan = (long) ((obj.otyp == GOLD_PIECE) ? rnd(10) |
| 880 | : objects[obj.otyp].oc_merge ? rnd(2) : 1); |
| 881 | obj.corpsenm = random_monster(rn2); /* if otyp == CORPSE */ |
| 882 | map_object(&obj, 1); |
| 883 | } else if (trap) { |
| 884 | map_trap(trap, 1); |
| 885 | trap->tseen = 1; |
| 886 | } else { |
| 887 | /* |
| 888 | * OBSOLETE; this was for trapped door or trapped chest |
| 889 | * but those are handled by 'if (trap) {map_trap()}' now |
| 890 | * and this block of code shouldn't be reachable anymore. |
| 891 | */ |
| 892 | dummytrap.tx = x; |
| 893 | dummytrap.ty = y; |
| 894 | dummytrap.ttyp = BEAR_TRAP; /* some kind of trap */ |
| 895 | map_trap(&dummytrap, 1); |
| 896 | } |
| 897 | } |
| 898 | |
| 899 | #define OTRAP_NONE 0 /* nothing found */ |
| 900 | #define OTRAP_HERE 1 /* found at hero's location */ |
no test coverage detected