return a string describing the dungeon feature at if there is one worth mentioning at that location; otherwise null */
| 4034 | /* return a string describing the dungeon feature at <x,y> if there |
| 4035 | is one worth mentioning at that location; otherwise null */ |
| 4036 | const char * |
| 4037 | dfeature_at(coordxy x, coordxy y, char *buf) |
| 4038 | { |
| 4039 | struct rm *lev = &levl[x][y]; |
| 4040 | int ltyp = lev->typ, cmap = -1; |
| 4041 | const char *dfeature = 0; |
| 4042 | static char altbuf[BUFSZ]; |
| 4043 | stairway *stway = stairway_at(x, y); |
| 4044 | |
| 4045 | if (IS_DOOR(ltyp)) { |
| 4046 | switch (lev->doormask) { |
| 4047 | case D_NODOOR: |
| 4048 | cmap = S_ndoor; |
| 4049 | break; /* "doorway" */ |
| 4050 | case D_ISOPEN: |
| 4051 | cmap = S_vodoor; |
| 4052 | break; /* "open door" */ |
| 4053 | case D_BROKEN: |
| 4054 | dfeature = "broken door"; |
| 4055 | break; |
| 4056 | default: |
| 4057 | cmap = S_vcdoor; |
| 4058 | break; /* "closed door" */ |
| 4059 | } |
| 4060 | /* override door description for open drawbridge */ |
| 4061 | if (is_drawbridge_wall(x, y) >= 0) |
| 4062 | dfeature = "open drawbridge portcullis", cmap = -1; |
| 4063 | } else if (IS_FOUNTAIN(ltyp)) |
| 4064 | cmap = S_fountain; /* "fountain" */ |
| 4065 | else if (IS_THRONE(ltyp)) |
| 4066 | cmap = S_throne; /* "opulent throne" */ |
| 4067 | else if (is_lava(x, y)) |
| 4068 | cmap = S_lava; /* "molten lava" */ |
| 4069 | else if (is_ice(x, y)) |
| 4070 | dfeature = ice_descr(x, y, altbuf), cmap = -1; /* "ice" */ |
| 4071 | else if (is_pool(x, y)) |
| 4072 | dfeature = "pool of water"; |
| 4073 | else if (IS_SINK(ltyp)) |
| 4074 | cmap = S_sink; /* "sink" */ |
| 4075 | else if (IS_ALTAR(ltyp)) { |
| 4076 | Sprintf(altbuf, "%saltar to %s (%s)", |
| 4077 | (lev->altarmask & AM_SANCTUM) ? "high " : "", |
| 4078 | a_gname(), |
| 4079 | align_str(Amask2align(lev->altarmask & ~AM_SHRINE))); |
| 4080 | dfeature = altbuf; |
| 4081 | } else if (stway) { |
| 4082 | dfeature = stairs_description(stway, altbuf, TRUE); |
| 4083 | } else if (ltyp == DRAWBRIDGE_DOWN) |
| 4084 | cmap = S_vodbridge; /* "lowered drawbridge" */ |
| 4085 | else if (ltyp == DBWALL) |
| 4086 | cmap = S_vcdbridge; /* "raised drawbridge" */ |
| 4087 | else if (IS_GRAVE(ltyp)) |
| 4088 | cmap = S_grave; /* "grave" */ |
| 4089 | else if (ltyp == TREE) |
| 4090 | cmap = S_tree; /* "tree" */ |
| 4091 | else if (ltyp == IRONBARS) |
| 4092 | dfeature = "set of iron bars"; |
| 4093 |
no test coverage detected