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

Function clear_path

src/vision.c:1612–1636  ·  view source on GitHub ↗

* Use vision tables to determine if there is a clear path from * (col1,row1) to (col2,row2). This is used by: * m_cansee() * m_canseeu() * do_light_sources() */

Source from the content-addressed store, hash-verified

1610 * do_light_sources()
1611 */
1612boolean
1613clear_path(int col1, int row1, int col2, int row2)
1614{
1615 int result;
1616
1617 if (col1 < col2) {
1618 if (row1 > row2) {
1619 q1_path(row1, col1, row2, col2, cleardone);
1620 } else {
1621 q4_path(row1, col1, row2, col2, cleardone);
1622 }
1623 } else {
1624 if (row1 > row2) {
1625 q2_path(row1, col1, row2, col2, cleardone);
1626 } else if (row1 == row2 && col1 == col2) {
1627 result = 1;
1628 } else {
1629 q3_path(row1, col1, row2, col2, cleardone);
1630 }
1631 }
1632#ifdef MACRO_CPATH
1633 cleardone:
1634#endif
1635 return (boolean) result;
1636}
1637
1638/*==========================================================================*\
1639 GENERAL LINE OF SIGHT

Callers 2

do_light_sourcesFunction · 0.85
linedupFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected