shithub: asif

Download patch

ref: c9f95c308362fed2f2d9cb5a309b1ed0338594e6
parent: 4387ce1075d24530a5b6fbc476f4d27217af08c7
author: qwx <[email protected]>
date: Wed Mar 23 18:06:47 EDT 2022

add key to clear all state

--- a/path/client.c
+++ b/path/client.c
@@ -56,6 +56,7 @@
 		case Akbd:
 			switch(r){
 			case Kdel: threadexitsall(nil);
+			case 'r': clearmap(); updatedrw(); break;
 			}
 			keyinput(r);
 			break;
--- a/path/fns.h
+++ b/path/fns.h
@@ -2,6 +2,7 @@
 void	evloop(void);
 void	initfs(void);
 void	resetmap(void);
+void	clearmap(void);
 void	initmap(void);
 void	initdrw(void);
 void	resetdrw(void);
--- a/path/map.c
+++ b/path/map.c
@@ -61,6 +61,15 @@
 }
 
 void
+clearmap(void)
+{
+	Node *n;
+
+	for(n=map; n<map+mapwidth*mapheight; n++)
+		memset(n, 0, sizeof *n);
+}
+
+void
 initmap(void)
 {
 	map = emalloc(mapwidth * mapheight * sizeof *map);