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

Function left_side

src/vision.c:1857–1985  ·  view source on GitHub ↗

* This routine is the mirror image of right_side(). See right_side() for * extensive comments. */

Source from the content-addressed store, hash-verified

1855 * extensive comments.
1856 */
1857staticfn void
1858left_side(
1859 int row,
1860 int left_mark,
1861 int right,
1862 const coordxy *limits)
1863{
1864 int left, left_edge, nrow, deeper, result;
1865 int i;
1866 seenV *rowp = NULL;
1867 coordxy *row_min = NULL;
1868 coordxy *row_max = NULL;
1869 int lim_min;
1870
1871 nrow = row + step;
1872 deeper = good_row(nrow) && (!limits || (*limits >= *(limits + 1)));
1873 if (!vis_func) {
1874 rowp = cs_rows[row];
1875 row_min = &cs_left[row];
1876 row_max = &cs_right[row];
1877 }
1878 if (limits) {
1879 lim_min = start_col - *limits;
1880 if (lim_min < 0)
1881 lim_min = 0;
1882 if (left_mark < lim_min)
1883 left_mark = lim_min;
1884 limits++; /* prepare for next row */
1885 } else
1886 lim_min = 0;
1887
1888 while (right >= left_mark) {
1889 left_edge = left_ptrs[row][right];
1890 if (left_edge < lim_min)
1891 left_edge = lim_min;
1892
1893 if (!is_clear(row, right)) {
1894 /* Jump to the far side of a stone wall. */
1895 if (left_edge < left_mark) {
1896 /* Maybe see more (kludge). */
1897 left_edge = is_clear(row - step, left_mark) ? left_mark - 1
1898 : left_mark;
1899 }
1900 if (vis_func) {
1901 for (i = left_edge; i <= right; i++)
1902 (*vis_func)(i, row, varg);
1903 } else {
1904 for (i = left_edge; i <= right; i++)
1905 set_cs(rowp, i);
1906 set_min(left_edge);
1907 set_max(right);
1908 }
1909 right = left_edge - 1; /* no limit check necessary */
1910 continue;
1911 }
1912
1913 if (right != start_col) {
1914 /* Find the right side. */

Callers 1

view_fromFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected