MCPcopy Create free account
hub / github.com/NetHack/NetHack / wseg_at

Function wseg_at

src/worm.c:945–965  ·  view source on GitHub ↗

construct an index number for a worm tail segment */

Source from the content-addressed store, hash-verified

943
944/* construct an index number for a worm tail segment */
945int
946wseg_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
967void
968flip_worm_segs_vertical(struct monst *worm, int miny, int maxy)

Callers 1

mstatuslineFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected