shithub: asif

Download patch

ref: 114fd38270ce1ed89694548e11f854ad501376f4
parent: 7e0b29380740aebbe6bee1cfb8a7863b57dfb847
author: qwx <qwx@sciops.net>
date: Sat Mar 26 12:26:07 EDT 2022

map: add node to screen coordinates conversion

--- a/path/fns.h
+++ b/path/fns.h
@@ -11,4 +11,5 @@
 double	manhdist(Node*, Node*);
 Vertex	n2p(Node*);
 Node*	p2n(Vertex);
+Vertex	n2s(Node*);
 int	isblocked(Node*);
--- a/path/map.c
+++ b/path/map.c
@@ -20,6 +20,17 @@
 	return map + p.y * mapwidth + p.x;
 }
 
+Vertex
+n2s(Node *n)
+{
+	Vertex v;
+
+	v = n2p(n);
+	v.x = v.x * Nodesz + 1;
+	v.y = v.y * Nodesz + 1;
+	return v;
+}
+
 double
 eucdist(Node *a, Node *b)
 {