ref: 15d72b39beda5af6024b645493facd5b9d0d4a9c
parent: fd9da88e582c0d1a4340bbc51fd899c719ed60b3
author: qwx <qwx@sciops.net>
date: Thu Mar 17 03:07:42 EDT 2022
dijkstra: shim
--- a/path/dijkstra.c
+++ b/path/dijkstra.c
@@ -8,9 +8,31 @@
#include "dat.h"
#include "fns.h"
+Node *start, *goal;
+
+static int
+dijkstra(Node *a, Node *g)
+{
+ USED(a,g);
+ return 0;
+}
+
+static int
+findpath(void)
+{
+ if(start == nil || goal == nil)
+ return -1;
+ return dijkstra(start, goal);
+}
+
int
-mouseinput(Node *, Mouse)
+mouseinput(Node *n, Mouse m)
{
+ switch(m.buttons & 7){
+ case 1: goal = n; findpath(); break;
+ case 2: start = n; findpath(); break;
+ case 4: n->blocked ^= 1; break;
+ }
return 0;
}