| 849 | * will create a worm tail chain of (num_segs + 1) and return pointer to it. |
| 850 | */ |
| 851 | staticfn struct wseg * |
| 852 | create_worm_tail(int num_segs) |
| 853 | { |
| 854 | int i = 0; |
| 855 | struct wseg *new_tail, *curr; |
| 856 | |
| 857 | if (!num_segs) |
| 858 | return (struct wseg *) 0; |
| 859 | |
| 860 | new_tail = curr = newseg(); |
| 861 | curr->nseg = (struct wseg *) 0; |
| 862 | curr->wx = 0; |
| 863 | curr->wy = 0; |
| 864 | |
| 865 | while (i < num_segs) { |
| 866 | curr->nseg = newseg(); |
| 867 | curr = curr->nseg; |
| 868 | curr->nseg = (struct wseg *) 0; |
| 869 | curr->wx = 0; |
| 870 | curr->wy = 0; |
| 871 | i++; |
| 872 | } |
| 873 | |
| 874 | return new_tail; |
| 875 | } |
| 876 | |
| 877 | /* worm_known() |
| 878 | * Is any segment of this worm in viewing range? Note: caller must check |