Skip to content

Commit

Permalink
fix analysis from history (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
PenguinWithATie authored Jul 28, 2024
1 parent 870d1bc commit 163e149
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions apis/src/components/organisms/analysis/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ impl AnalysisTree {
previous = Some(new_id);
}
let current_node = previous.and_then(|p| tree.get_node_by_id(&p));
Some(Self {
let mut tree = Self {
current_node,
tree,
hashes,
game_type: gs.state.game_type,
})
};
tree.update_node(gs.history_turn.unwrap_or(0)as i32);
Some(tree)
}

pub fn update_node(&mut self, node_id: i32) -> Option<()> {
Expand Down
1 change: 1 addition & 0 deletions apis/src/providers/game_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ impl GameStateSignal {

pub fn do_analysis(&mut self) {
self.signal.update(|s| {
s.view = View::Game;
s.game_id = None;
s.state.game_status = GameStatus::InProgress;
s.black_id = None;
Expand Down

0 comments on commit 163e149

Please sign in to comment.