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

Function online2

src/hacklib.c:703–711  ·  view source on GitHub ↗

are two points lined up (on a straight line)? */

Source from the content-addressed store, hash-verified

701
702/* are two points lined up (on a straight line)? */
703boolean
704online2(coordxy x0, coordxy y0, coordxy x1, coordxy y1)
705{
706 int dx = x0 - x1, dy = y0 - y1;
707 /* If either delta is zero then they're on an orthogonal line,
708 * else if the deltas are equal (signs ignored) they're on a diagonal.
709 */
710 return (boolean) (!dy || !dx || dy == dx || dy == -dx);
711}
712
713#ifndef STRNCMPI
714/* case-insensitive counted string comparison */

Callers 1

monlineuFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected