From 1f322b962c39121dea4f8712ce67d47a9b1f35af Mon Sep 17 00:00:00 2001 From: Oxore Date: Tue, 1 Aug 2023 21:46:43 +0300 Subject: Fix rendering inside rendered figures --- src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 80f95b8..f670989 100644 --- a/src/main.rs +++ b/src/main.rs @@ -146,8 +146,10 @@ impl Field { continue; } let color = figure.cells[i] & !GHOST_MASK; - if color != 0 { - self.cells[f_x as usize + f_y as usize * FIELD_COLS] = figure.cells[i]; + let current = f_x as usize + f_y as usize * FIELD_COLS; + let ghost_or_empty = (self.cells[current] & GHOST_MASK != 0) || self.cells[current] == 0; + if color != 0 && ghost_or_empty { + self.cells[current] = figure.cells[i]; } } } -- cgit v1.2.3