diff options
author | Oxore <oxore@protonmail.com> | 2023-08-01 21:46:43 +0300 |
---|---|---|
committer | Oxore <oxore@protonmail.com> | 2023-08-01 22:01:13 +0300 |
commit | 1f322b962c39121dea4f8712ce67d47a9b1f35af (patch) | |
tree | 7bbd110bbb7c8d9a897a4c0fedfec4910f2c9b93 | |
parent | f5b3d6846f06498166b786e5bc2c8f5dcb85f76c (diff) |
Fix rendering inside rendered figures
-rw-r--r-- | src/main.rs | 6 |
1 files 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]; } } } |