construct an index number for a worm tail segment */
| 943 | |
| 944 | /* construct an index number for a worm tail segment */ |
| 945 | int |
| 946 | wseg_at(struct monst *worm, int x, int y) |
| 947 | { |
| 948 | int res = 0; |
| 949 | |
| 950 | if (worm && worm->wormno && m_at(x, y) == worm) { |
| 951 | struct wseg *curr; |
| 952 | int i, n; |
| 953 | coordxy wx = (coordxy) x, wy = (coordxy) y; |
| 954 | |
| 955 | for (i = 0, curr = wtails[worm->wormno]; curr; curr = curr->nseg) { |
| 956 | if (curr->wx == wx && curr->wy == wy) |
| 957 | break; |
| 958 | ++i; |
| 959 | } |
| 960 | for (n = i; curr; curr = curr->nseg) |
| 961 | ++n; |
| 962 | res = n - i; |
| 963 | } |
| 964 | return res; |
| 965 | } |
| 966 | |
| 967 | void |
| 968 | flip_worm_segs_vertical(struct monst *worm, int miny, int maxy) |