| 603 | } |
| 604 | |
| 605 | void |
| 606 | light_sources_sanity_check(void) |
| 607 | { |
| 608 | light_source *ls; |
| 609 | struct monst *mtmp; |
| 610 | struct obj *otmp; |
| 611 | unsigned int auint; |
| 612 | |
| 613 | for (ls = gl.light_base; ls; ls = ls->next) { |
| 614 | if (!ls->id.a_monst) |
| 615 | panic("insane light source: no id!"); |
| 616 | if (ls->type == LS_OBJECT) { |
| 617 | otmp = ls->id.a_obj; |
| 618 | auint = otmp->o_id; |
| 619 | if (find_oid(auint) != otmp) |
| 620 | panic("insane light source: can't find obj #%u!", auint); |
| 621 | } else if (ls->type == LS_MONSTER) { |
| 622 | mtmp = (struct monst *) ls->id.a_monst; |
| 623 | auint = mtmp->m_id; |
| 624 | if (find_mid(auint, FM_EVERYWHERE) != mtmp) |
| 625 | panic("insane light source: can't find mon #%u!", auint); |
| 626 | } else { |
| 627 | panic("insane light source: bad ls type %d", ls->type); |
| 628 | } |
| 629 | } |
| 630 | } |
| 631 | |
| 632 | /* Write a light source structure to disk. */ |
| 633 | staticfn void |
no test coverage detected