diff --git a/src/debug.rs b/src/debug.rs index 2011045..f9b6aaf 100644 --- a/src/debug.rs +++ b/src/debug.rs @@ -31,7 +31,6 @@ impl Plugin for DebugPlugin { toggle_debug_mode.run_if(on_event::()), display_diagnostics.run_if(resource_exists::), toggle_debug_ui.run_if(resource_changed_or_removed::()), - camera_info.run_if(resource_exists::), ), ); } @@ -128,7 +127,13 @@ fn display_diagnostics( root.iter_mut().for_each(|mut text| { text.sections = diagnostics .iter() - .map(|d| format!("{}: {:.0}\n", d.suffix, d.smoothed().unwrap_or(0.0),)) + .map(|d| { + format!( + "{}: {:.0}\n", + d.path().as_str(), + d.smoothed().unwrap_or(0.0), + ) + }) .chain(debug_infos.iter().map(|(k, v)| format!("{}: {}\n", k, v))) .map(|s| TextSection::new(s, TextStyle { ..default() })) .collect(); @@ -136,19 +141,6 @@ fn display_diagnostics( }); } -fn camera_info(mut debug_infos: ResMut, cameras: Query<(&Camera, &Name)>) { - let camera_names = cameras - .iter() - .filter(|(c, _)| c.is_active) - .map(|(_, n)| n.as_str()) - .collect::>() - .iter() - .copied() - .intersperse(", ") - .collect::(); - debug_infos.set("Cameras".into(), camera_names); -} - fn aabb_gizmo( added: Query>, mut removed: RemovedComponents, diff --git a/src/display3d.rs b/src/display3d.rs index 2bb5927..f008e9a 100644 --- a/src/display3d.rs +++ b/src/display3d.rs @@ -1232,7 +1232,7 @@ fn setup_dissolve_materials( base.alpha_mode = AlphaMode::Mask(0.5); base.base_color = base.base_color.clone().with_a(0.0); - info!("Base material {:#?}", base); + debug!("Base material {:#?}", base); let dis_handle = dissolve_materials.add(ExtendedMaterial { base, extension }); diff --git a/src/game.rs b/src/game.rs index 173cc04..be762be 100644 --- a/src/game.rs +++ b/src/game.rs @@ -366,7 +366,7 @@ impl Board { }); } - // Capture the intened move in the moves ledger + // Capture the intended move in the moves ledger moves.push(Move { epoch, from, @@ -419,8 +419,8 @@ impl Board { let valid_capture = { match self.at(this_board_index) { Some(_) => { - let same_side = Board::side(current_board_index); - Board::side(this_board_index) != same_side + Board::side(this_board_index) + != Board::side(current_board_index) } None => true, } @@ -478,9 +478,31 @@ impl Board { .collect(), // One or two spaces in either horizontal Some(Piece::Drone) => std::iter::empty() - .chain((-2..=2).map(|i| (x.checked_add_signed(i), Some(y)))) - .chain((-2..=2).map(|i| (Some(x), y.checked_add_signed(i)))) - .filter_map(f) + // Checking moves on the X axis + .chain( + (-2..=-1) + .map(|i| f((x.checked_add_signed(i), Some(y)))) + .rev() + .take_while(|x| x.is_some()), + ) + .chain( + (1..=2) + .map(|i| f((x.checked_add_signed(i), Some(y)))) + .take_while(|x| x.is_some()), + ) + // Checking moves on the Y axis + .chain( + (1..=2) + .map(|i| f((Some(x), y.checked_add_signed(i)))) + .take_while(|x| x.is_some()), + ) + .chain( + (-2..=-1) + .map(|i| f((Some(x), y.checked_add_signed(i)))) + .rev() + .take_while(|x| x.is_some()), + ) + .filter_map(|x| x) .collect(), // Any distance in any straight line Some(Piece::Queen) => std::iter::empty()