* Snuff an object light source if at (x,y). This currently works * only for burning light sources. */
| 726 | * only for burning light sources. |
| 727 | */ |
| 728 | void |
| 729 | snuff_light_source(coordxy x, coordxy y) |
| 730 | { |
| 731 | light_source *ls; |
| 732 | struct obj *obj; |
| 733 | |
| 734 | for (ls = gl.light_base; ls; ls = ls->next) |
| 735 | /* |
| 736 | * Is this position check valid??? Can I assume that the positions |
| 737 | * will always be correct because the objects would have been |
| 738 | * updated with the last vision update? [Is that recent enough???] |
| 739 | */ |
| 740 | if (ls->type == LS_OBJECT && ls->x == x && ls->y == y) { |
| 741 | obj = ls->id.a_obj; |
| 742 | if (obj_is_burning(obj)) { |
| 743 | /* The only way to snuff Sunsword is to unwield it. Darkness |
| 744 | * scrolls won't affect it. (If we got here because it was |
| 745 | * dropped or thrown inside a monster, this won't matter |
| 746 | * anyway because it will go out when dropped.) |
| 747 | */ |
| 748 | if (artifact_light(obj)) |
| 749 | continue; |
| 750 | end_burn(obj, obj->otyp != MAGIC_LAMP); |
| 751 | /* |
| 752 | * The current ls element has just been removed (and |
| 753 | * ls->next is now invalid). Return assuming that there |
| 754 | * is only one light source attached to each object. |
| 755 | */ |
| 756 | return; |
| 757 | } |
| 758 | } |
| 759 | } |
| 760 | |
| 761 | /* Return TRUE if object sheds any light at all. */ |
| 762 | boolean |
no test coverage detected