wm: glendy

Download patch

ref: 45fd1ae9d39e63e71ca624ca3514becc989eb818
parent: ea3ae149226b0994eb5b4b202781c19b60434e2a
author: mkf <mkf@cloud9p.org>
date: Wed May 22 09:01:06 EDT 2024

srv4: fix put msg

--- a/srv4.c
+++ b/srv4.c
@@ -188,8 +188,8 @@
 	char *xpos, *ypos;
 	unsigned int x, y, r;
 
-	ypos = strtok(s, " ");
-	xpos = strtok(nil, " ");
+	xpos = strtok(s, " ");
+	ypos = strtok(nil, " ");
 	
 	if(xpos == nil || ypos == nil)
 	{
@@ -205,9 +205,9 @@
 		return;
 	}
 
-	y = atoi(ypos);
-	x = atoi(xpos);	
-
+	/* engine assumes it's XY, protocol assumes it's YX */
+	y = atoi(xpos);
+	x = atoi(ypos);	
 	
 	dprint("put %d %d\n", x, y);
 
@@ -217,8 +217,7 @@
 		return;
 	}
 
-	/* engine assumes it's XY, protocol assumes it's YX */
-	r = doput(Pt(y, x)); 
+	r = doput(Pt(x, y)); 
 	if(r == Wall)
 		fprint(playersock, "WALL %d %d\n", x, y);
 	else if(r == Glenda)