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

Function create_worm_tail

src/worm.c:851–875  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

849 * will create a worm tail chain of (num_segs + 1) and return pointer to it.
850 */
851staticfn struct wseg *
852create_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

Callers 1

initwormFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected