shithub: sce

Download patch

ref: 710b64171c4f486abbe52bcd03e225dc6761abc4
parent: 5d7a20f136c8628e34c66815069c5d4a1b55235e
author: qwx <qwx@sciops.net>
date: Sun Dec 19 18:35:58 EST 2021

path: fix typo in successor directions

--- a/path.c
+++ b/path.c
@@ -402,7 +402,7 @@
 	static Node *dir[8+1];
 	static dtab[2*(nelem(dir)-1)]={
 		-1,-1, 0,-1, 1,-1,
-		-1,0, 0,1,
+		-1,0, 1,0,
 		-1,1, 0,1, 1,1,
 	};
 	int i;
@@ -463,6 +463,7 @@
 				n->len = x->len + n->Δlen;
 				n->g -= Δg;
 				decreasekey(n->p, Δg, &queue);
+				assert(n->g >= 0);
 			}
 			if(nearest == nil || n->h < nearest->h)
 				nearest = n;