From c09c253b49a812f8c9de5bd0dc37f3f5afce0705 Mon Sep 17 00:00:00 2001 From: Anton Lysakov Date: Sat, 30 Mar 2019 00:15:48 +0700 Subject: [PATCH] fixing fit from both ends --- src/cc/games/tetris.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/cc/games/tetris.c b/src/cc/games/tetris.c index a0fd0615c..8e7642837 100644 --- a/src/cc/games/tetris.c +++ b/src/cc/games/tetris.c @@ -296,7 +296,14 @@ static void tg_hold(struct games_state *rs,tetris_game *obj) obj->stored.ori = ori; while (!tg_fits(obj, obj->falling)) { obj->falling.loc.row--; + if (tg_fits(obj, obj->falling)) { + break; + } obj->falling.loc.col--; + if (tg_fits(obj, obj->falling)) { + break; + } + obj->falling.loc.col += 2; } } tg_put(obj, obj->falling);