wm: glendy

Download patch

ref: 2ef6cfea72549d08835a77a05c477668a4f518f2
parent: 5abc1df8a765868db4c097753d50495d677e464e
author: mkf <mkf@cloud9p.org>
date: Sat May 11 13:14:29 EDT 2024

engine: remove unused (and unrelated? what was it even doing) checkstate function. also make game end once glendy reachs edge

--- a/engine.c
+++ b/engine.c
@@ -6,6 +6,9 @@
 #include <draw.h>
 #endif
 
+// XXX
+#include "util.h"
+
 #include "engine.h"
 #include "netclient.h"
 
@@ -161,9 +164,9 @@
 	if(networked)
 		return netmove(dir);
 
-	if(src.x == 0 || src.x == SzX-1 || src.y == 0 || src.y == SzY-1)
+	if(dst.x == 0 || dst.x == SzX-1 || dst.y == 0 || dst.y == SzY-1)
 		goto done;
-
+	
 	grid[dst.x][dst.y] = Glenda;
 done:
 	grid[src.x][src.y] = Prev;
@@ -341,15 +344,4 @@
 	memcpy(g, grid, sizeof grid);
 	memcpy(grid, pgrid, sizeof grid);
 	memcpy(pgrid, g, sizeof grid);
-}
-
-int
-checkstate(void)
-{
-	int i, j;
-	for(i = 0; i < SzX; i++)
-		for(j = 0; j < SzY; j++)
-			if(grid[i][j] == 'E')
-				return 0;
-	return 1;
-}
+}
\ No newline at end of file
--- a/engine.h
+++ b/engine.h
@@ -79,4 +79,3 @@
 void nextglenda(void);
 void restart(void);
 void undo(void);
-int checkstate(void);