shithub: map

Download patch

ref: 9fa9d91d1abbe4180632b98db65b872c34765f78
parent: 7b6082bf29c9239d93f33c55103668f7046189ca
author: sirjofri <sirjofri@sirjofri.de>
date: Sat Apr 12 10:56:32 EDT 2025

integrates new libnate dirty tracking

--- a/map.c
+++ b/map.c
@@ -151,6 +151,7 @@
 
 NWindow *mainwindow;
 NImage *nimage;
+NLabel *nstatusbar;
 
 void
 lockmapimage(void)
@@ -195,6 +196,9 @@
 	GBundle newloc;
 	Point off, o, oo;
 	
+	nsetdirty(nstatusbar, DRAW);
+	nsetdirty(nimage, DRAW);
+	
 	oo.x = viewsize.x/2.;
 	oo.y = viewsize.y/2.;
 	off.x = oo.x/tilesize + 1;
@@ -224,6 +228,9 @@
 void
 checkcondredraw(void)
 {
+	/* Theoretically, this can just call nateredraw(0) since libnate now
+	   handles dirty state tracking properly. */
+	
 	int b;
 	qlock(&shouldredrawl);
 	b = shouldredraw;
@@ -300,7 +307,7 @@
 	initimage();
 	redrawmap();
 	
-	nateredraw(0);
+	nateredraw(RESIZE);
 }
 
 int
@@ -510,7 +517,7 @@
 			->Border(1, display->black)
 			->Padding(NMargin2(5, 5))
 			->Slot(NSlot(),
-				New_Label(nil)
+				NAssign(NLabelAccessors, &nstatusbar, New_Label(nil))
 				->LabelFunc(getstatusline)
 				->Align(LEFT)
 			)