shithub: map

Download patch

ref: 426d4a16d137b3a6612a336c0f1259ad5c488ad1
parent: ae0f1df36c66ee68ef3680808f161dc3c5708ffa
author: sirjofri <sirjofri@sirjofri.de>
date: Fri Mar 28 14:55:53 EDT 2025

fetch maximum zoom from mapfs, better scrolling

--- a/map.c
+++ b/map.c
@@ -176,7 +176,7 @@
 static int
 handlekeyboard(int kbdc)
 {
-	double off = 10./(currentloc.z <= 0 ? 1 : currentloc.z);
+	double off = 100./(currentloc.z <= 0 ? 1 : currentloc.z*tilesize);
 	
 	switch (kbdc) {
 	case Kdel:
@@ -219,6 +219,25 @@
 	}
 }
 
+static void
+initmapfs(void)
+{
+	int fd, n;
+	char buf[32];
+	
+	fd = open("/mnt/map/ctl", OREAD);
+	if (fd < 0)
+		sysfatal("mapfs error: open ctl: %r");
+	
+	n = read(fd, buf, sizeof(buf) - 1);
+	if (n < 0)
+		sysfatal("mapfs error: read ctl: %r");
+	close(fd);
+	buf[n] = 0;
+	
+	maxzoom = atoi(buf);
+}
+
 void
 main(int argc, char **argv)
 {
@@ -236,6 +255,7 @@
 	if (debug)
 		traperrout();
 
+	initmapfs();
 	gpsloc = getlocation();
 	currentloc = getbundle(gpsloc, zoom, &drawoffset);