diff --git a/client/src/dialog.rs b/client/src/dialog.rs index e984a35..82d4742 100644 --- a/client/src/dialog.rs +++ b/client/src/dialog.rs @@ -504,7 +504,7 @@ impl DialogImpl for ConfirmDialog { Confirm::Submit(_, Some(_)) => "Place two stones?", Confirm::Pass(None) => "Place no stone and pass?", Confirm::Pass(Some(_)) => "Place one stone and pass?", - Confirm::Claim(tentative, ..) => match tentative.len() { + Confirm::Claim(tentatives, ..) => match tentatives.len() { // TODO: Inform the user if they're claiming a win for the opponent? 0 => "Claim a win?", 1 => "Place one stone and claim a win?", diff --git a/client/src/game_view.rs b/client/src/game_view.rs index af9becc..05a165c 100644 --- a/client/src/game_view.rs +++ b/client/src/game_view.rs @@ -230,7 +230,7 @@ pub fn GameView( #[prop(optional)] view_center: RwSignal, #[prop(optional)] cursor_pos: RwSignal>, #[prop(optional)] phantom_pos: RwSignal>, - #[prop(optional)] tentative_pos: RwSignal>, + #[prop(optional)] tentatives_pos: RwSignal>, #[prop(optional)] win_claim: RwSignal>, ) -> impl IntoView { let disabled = Memo::new(move |_| disabled()); @@ -268,7 +268,7 @@ pub fn GameView( // are enough tentative stones, the move is automatically submitted. let hit_cursor = move |cursor: Point| { let phantom = phantom_pos.get(); - let mut tentative = tentative_pos.get(); + let mut tentatives = tentatives_pos.get(); if calc().board_to_view_pos(cursor).is_none() { return; @@ -292,7 +292,7 @@ pub fn GameView( if record.write_untracked().with_temp_placements( stone, - &tentative, + &tentatives, |record| record.test_winning_row(p, dir).is_some(), ) { WinClaim::Ready(p, dir) @@ -316,18 +316,18 @@ pub fn GameView( return; } - if let Some(i) = tentative.iter().position(|&p| p == cursor) { - phantom_pos.set(Some(tentative.remove(i))); - tentative_pos.set(tentative); + if let Some(i) = tentatives.iter().position(|&p| p == cursor) { + phantom_pos.set(Some(tentatives.remove(i))); + tentatives_pos.set(tentatives); } else if phantom == Some(cursor) { phantom_pos.set(None); - tentative.push(cursor); - tentative_pos.set(tentative); + tentatives.push(cursor); + tentatives_pos.set(tentatives); - if tentative.len() == record.read().max_stones_to_play() { + if tentatives.len() == record.read().max_stones_to_play() { on_event(Event::Submit); } - } else if tentative.len() < record.read().max_stones_to_play() { + } else if tentatives.len() < record.read().max_stones_to_play() { phantom_pos.set(Some(cursor)); } }; @@ -884,7 +884,7 @@ pub fn GameView( } // Draw the tentative stones. - for p in tentative_pos + for p in tentatives_pos .get_untracked() .into_iter() .filter_map(|p| calc.board_to_view_pos(p)) @@ -957,7 +957,7 @@ pub fn GameView( // Clear phantom, tentatives and win claim if the record or the stone changed. *phantom_pos.write_untracked() = None; - *tentative_pos.write_untracked() = ArrayVec::new(); + *tentatives_pos.write_untracked() = ArrayVec::new(); *win_claim.write_untracked() = None; changed.notify(); @@ -965,7 +965,7 @@ pub fn GameView( Effect::new(move || { phantom_pos.track(); - tentative_pos.track(); + tentatives_pos.track(); win_claim.track(); changed.notify(); diff --git a/client/src/lib.rs b/client/src/lib.rs index fa7d8f5..2519c5b 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -95,7 +95,7 @@ pub fn App() -> impl IntoView { let record = RwSignal::new(Record::new()); let stone = RwSignal::new(None::); - let tentative_pos = RwSignal::new(ArrayVec::new()); + let tentatives_pos = RwSignal::new(ArrayVec::new()); let win_claim = RwSignal::new(None); let game_id = RwSignal::new(String::new()); @@ -349,12 +349,12 @@ pub fn App() -> impl IntoView { match ev { Event::Menu => show_game_menu_dialog(), Event::Submit => { - let tentative = tentative_pos.get(); + let tentatives = tentatives_pos.get(); let claim = win_claim.get(); if online() { confirm(match claim { - Some(WinClaim::Ready(p, dir)) => Confirm::Claim(tentative, p, dir), - _ => match tentative[..] { + Some(WinClaim::Ready(p, dir)) => Confirm::Claim(tentatives, p, dir), + _ => match tentatives[..] { [] => Confirm::Pass(None), [p] if record.read().has_past() => Confirm::Pass(Some(p)), [p] => Confirm::Submit(p, None), @@ -366,12 +366,12 @@ pub fn App() -> impl IntoView { let mut record = record.write(); if let Some(WinClaim::Ready(p, dir)) = claim { - if !tentative.is_empty() { - record.make_move(Move::Place(tentative[0], tentative.get(1).copied())); + if !tentatives.is_empty() { + record.make_move(Move::Place(tentatives[0], tentatives.get(1).copied())); } record.make_move(Move::Win(p, dir)); } else { - record.make_move(match tentative[..] { + record.make_move(match tentatives[..] { [] => Move::Pass, [p] => Move::Place(p, None), [p1, p2] => Move::Place(p1, Some(p2)), @@ -532,11 +532,11 @@ pub fn App() -> impl IntoView { Confirm::Submit(p1, p2) => send(ClientMessage::Place(p1, p2)), Confirm::Pass(None) => send(ClientMessage::Pass), Confirm::Pass(Some(p)) => send(ClientMessage::Place(p, None)), - Confirm::Claim(tentative, p, dir) => { - if !tentative.is_empty() { + Confirm::Claim(tentatives, p, dir) => { + if !tentatives.is_empty() { send(ClientMessage::Place( - tentative[0], - tentative.get(1).copied(), + tentatives[0], + tentatives.get(1).copied(), )); } send(ClientMessage::ClaimWin(p, dir)); @@ -586,7 +586,7 @@ pub fn App() -> impl IntoView { stone=stone.read_only() disabled=move || !dialog_entries.read().is_empty() on_event=on_event - tentative_pos=tentative_pos + tentatives_pos=tentatives_pos win_claim=win_claim />