shithub: gm4s

Download patch

ref: 53846c7acde9959077f3903c22ad8e323b866736
parent: 46167609619811b450262f642eef192ee827b2f6
author: qwx <qwx@sciops.net>
date: Thu Aug 7 15:05:03 EDT 2025

game: fix hold piece skipping next piece as well

--- a/game.c
+++ b/game.c
@@ -65,12 +65,12 @@
 }
 
 static void
-spawn(void)
+spawn(int next)
 {
 	static Current cur0;
 
 	memset(&cur0, 0, sizeof cur0);
-	cur0.type = nextpiece();
+	cur0.type = next < 0 ? nextpiece() : next;
 	cur0.rot = Up;
 	cur0.x = Ncol / 2 - 2;
 	cur0.y = Nstartrow - Nextrarows - 1;
@@ -146,7 +146,7 @@
 		return;
 	p = held;
 	held = cur->type;
-	spawn();
+	spawn(p);
 	if(p != -1)
 		cur->type = p;
 	cur->flags |= Fswapped;
@@ -207,7 +207,7 @@
 	u64int t;
 
 	if(cur == nil){
-		spawn();
+		spawn(-1);
 		return;
 	}else if(collide(cur->x, cur->y+1, cur->rot)){
 		t = nanosec();
--