| 231 | } |
| 232 | |
| 233 | staticfn int |
| 234 | glyph_find_core( |
| 235 | const char *id, |
| 236 | struct find_struct *findwhat) |
| 237 | { |
| 238 | int glyph; |
| 239 | boolean do_callback, end_find = FALSE; |
| 240 | |
| 241 | if (parse_id(id, findwhat)) { |
| 242 | if (findwhat->findtype == find_glyph) { |
| 243 | (*findwhat->callback)(findwhat->val, findwhat); |
| 244 | } else { |
| 245 | for (glyph = 0; glyph < MAX_GLYPH; ++glyph) { |
| 246 | do_callback = FALSE; |
| 247 | switch (findwhat->findtype) { |
| 248 | case find_cmap: |
| 249 | if (glyph_to_cmap(glyph) == findwhat->val) |
| 250 | do_callback = TRUE; |
| 251 | break; |
| 252 | case find_pm: |
| 253 | if (glyph_is_monster(glyph) |
| 254 | && mons[glyph_to_mon(glyph)].mlet |
| 255 | == findwhat->val) |
| 256 | do_callback = TRUE; |
| 257 | break; |
| 258 | case find_oc: |
| 259 | if (glyph_is_object(glyph) |
| 260 | && glyph_to_obj(glyph) == findwhat->val) |
| 261 | do_callback = TRUE; |
| 262 | break; |
| 263 | case find_glyph: |
| 264 | if (glyph == findwhat->val) { |
| 265 | do_callback = TRUE; |
| 266 | end_find = TRUE; |
| 267 | } |
| 268 | break; |
| 269 | case find_nothing: |
| 270 | default: |
| 271 | end_find = TRUE; |
| 272 | break; |
| 273 | } |
| 274 | if (do_callback) |
| 275 | (findwhat->callback)(glyph, findwhat); |
| 276 | if (end_find) |
| 277 | break; |
| 278 | } |
| 279 | } |
| 280 | return 1; |
| 281 | } |
| 282 | return 0; |
| 283 | } |
| 284 | |
| 285 | /* |
| 286 | When we start to process a config file or a symbol file, |
no test coverage detected