restoring air bubbles on Plane of Water or clouds on Plane of Air */
| 1747 | |
| 1748 | /* restoring air bubbles on Plane of Water or clouds on Plane of Air */ |
| 1749 | void |
| 1750 | restore_waterlevel(NHFILE *nhfp) |
| 1751 | { |
| 1752 | struct bubble *b = (struct bubble *) 0, *btmp; |
| 1753 | int i, n = 0; |
| 1754 | |
| 1755 | #ifdef SFCTOOL |
| 1756 | svb.bbubbles = (struct bubble *) 0; |
| 1757 | /* set_wportal(); */ |
| 1758 | #endif |
| 1759 | |
| 1760 | Sfi_int(nhfp, &n, "waterlevel-bubble_count"); |
| 1761 | Sfi_int(nhfp, &svx.xmin, "waterlevel-xmin"); |
| 1762 | Sfi_int(nhfp, &svy.ymin, "waterlevel-ymin"); |
| 1763 | Sfi_int(nhfp, &svx.xmax, "waterlevel-xmax"); |
| 1764 | Sfi_int(nhfp, &svy.ymax, "waterlevel-ymax"); |
| 1765 | for (i = 0; i < n; i++) { |
| 1766 | btmp = b; |
| 1767 | b = (struct bubble *) alloc((unsigned) sizeof *b); |
| 1768 | Sfi_bubble(nhfp, b, "waterlevel-bubble"); |
| 1769 | if (btmp) { |
| 1770 | btmp->next = b; |
| 1771 | b->prev = btmp; |
| 1772 | } else { |
| 1773 | svb.bbubbles = b; |
| 1774 | b->prev = (struct bubble *) 0; |
| 1775 | } |
| 1776 | #ifndef SFCTOOL |
| 1777 | mv_bubble(b, 0, 0, TRUE); |
| 1778 | #endif |
| 1779 | } |
| 1780 | #ifndef SFCTOOL |
| 1781 | ge.ebubbles = b; |
| 1782 | if (b) { |
| 1783 | b->next = (struct bubble *) 0; |
| 1784 | } else { |
| 1785 | /* avoid "saving and reloading may fix this" */ |
| 1786 | program_state.something_worth_saving = 0; |
| 1787 | /* during restore, information about what level this is might not |
| 1788 | be available so we're wishy-washy about what we describe */ |
| 1789 | impossible("No %s to restore?", |
| 1790 | (Is_waterlevel(&u.uz) || Is_waterlevel(&gu.uz_save)) |
| 1791 | ? "air bubbles" |
| 1792 | : (Is_airlevel(&u.uz) || Is_airlevel(&gu.uz_save)) |
| 1793 | ? "clouds" |
| 1794 | : "air bubbles or clouds"); |
| 1795 | program_state.something_worth_saving = 1; |
| 1796 | } |
| 1797 | #endif |
| 1798 | } |
| 1799 | |
| 1800 | #ifndef SFCTOOL |
| 1801 | staticfn void |
no test coverage detected