diff --git a/src/editor.rs b/src/editor.rs index 754b426..c359b23 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -120,7 +120,6 @@ pub enum ExitState { Dont, ExitAndSave, Save, - ExitNoSave, } impl Editor { @@ -1087,10 +1086,10 @@ impl Editor { Tool::Mirror => self.set_tile(pos, Tile::Mirror(self.tool_mirror)), Tool::Digits(_pos) => { self.active_tool = Tool::Digits(Some(pos)); - if let Some(tile) = self.source_board.get_mut(pos) { - if !matches!(tile, Tile::Open(OpenTile::Digit(_), _)) { - *tile = Tile::Open(OpenTile::Digit(0), Claim::Free); - } + + let tile = self.source_board.get_or_blank(pos); + if !matches!(tile, Tile::Open(OpenTile::Digit(_), _)) { + self.set_tile(pos, Tile::Open(OpenTile::Digit(0), Claim::Free)); } } Tool::Blueprint => { diff --git a/src/main.rs b/src/main.rs index 2d30e18..e0f22b8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -97,7 +97,6 @@ impl Game { solution.score = editor.score(); solution.save(); } - ExitState::ExitNoSave => self.open_editor = None, } } else { self.draw(&mut d);