fix undo for digit tile placement
This commit is contained in:
parent
64fb7ca5ba
commit
73a1c62f52
2 changed files with 4 additions and 6 deletions
|
@ -120,7 +120,6 @@ pub enum ExitState {
|
||||||
Dont,
|
Dont,
|
||||||
ExitAndSave,
|
ExitAndSave,
|
||||||
Save,
|
Save,
|
||||||
ExitNoSave,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Editor {
|
impl Editor {
|
||||||
|
@ -1087,10 +1086,10 @@ impl Editor {
|
||||||
Tool::Mirror => self.set_tile(pos, Tile::Mirror(self.tool_mirror)),
|
Tool::Mirror => self.set_tile(pos, Tile::Mirror(self.tool_mirror)),
|
||||||
Tool::Digits(_pos) => {
|
Tool::Digits(_pos) => {
|
||||||
self.active_tool = Tool::Digits(Some(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(_), _)) {
|
let tile = self.source_board.get_or_blank(pos);
|
||||||
*tile = Tile::Open(OpenTile::Digit(0), Claim::Free);
|
if !matches!(tile, Tile::Open(OpenTile::Digit(_), _)) {
|
||||||
}
|
self.set_tile(pos, Tile::Open(OpenTile::Digit(0), Claim::Free));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Tool::Blueprint => {
|
Tool::Blueprint => {
|
||||||
|
|
|
@ -97,7 +97,6 @@ impl Game {
|
||||||
solution.score = editor.score();
|
solution.score = editor.score();
|
||||||
solution.save();
|
solution.save();
|
||||||
}
|
}
|
||||||
ExitState::ExitNoSave => self.open_editor = None,
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.draw(&mut d);
|
self.draw(&mut d);
|
||||||
|
|
Loading…
Reference in a new issue