share CurvePointIter between features again
This commit is contained in:
@@ -37,7 +37,7 @@ impl<'p> ControlPointIter<'p> {
|
|||||||
pub(crate) enum ControlPoint {
|
pub(crate) enum ControlPoint {
|
||||||
Timing {
|
Timing {
|
||||||
time: f32,
|
time: f32,
|
||||||
#[cfg(not(feature = "no_sliders_no_leniency"))]
|
#[allow(dead_code)]
|
||||||
beat_len: f32,
|
beat_len: f32,
|
||||||
},
|
},
|
||||||
Difficulty {
|
Difficulty {
|
||||||
@@ -46,9 +46,9 @@ pub(crate) enum ControlPoint {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "no_sliders_no_leniency"))]
|
|
||||||
impl ControlPoint {
|
impl ControlPoint {
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[allow(dead_code)]
|
||||||
pub(crate) fn time(&self) -> f32 {
|
pub(crate) fn time(&self) -> f32 {
|
||||||
match self {
|
match self {
|
||||||
Self::Timing { time, .. } => *time,
|
Self::Timing { time, .. } => *time,
|
||||||
@@ -62,21 +62,10 @@ impl<'p> Iterator for ControlPointIter<'p> {
|
|||||||
|
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
match (self.next_timing, self.next_difficulty) {
|
match (self.next_timing, self.next_difficulty) {
|
||||||
(Some((time, _beat_len)), Some((d, _))) if time <= d => {
|
(Some((time, beat_len)), Some((d, _))) if time <= d => {
|
||||||
self.next_timing = next_tuple!(self.timing_points, (time, beat_len));
|
self.next_timing = next_tuple!(self.timing_points, (time, beat_len));
|
||||||
|
|
||||||
#[cfg(not(feature = "no_sliders_no_leniency"))]
|
Some(ControlPoint::Timing { time, beat_len })
|
||||||
{
|
|
||||||
Some(ControlPoint::Timing {
|
|
||||||
time,
|
|
||||||
beat_len: _beat_len,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "no_sliders_no_leniency")]
|
|
||||||
{
|
|
||||||
Some(ControlPoint::Timing { time })
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
(_, Some((time, speed_mult))) => {
|
(_, Some((time, speed_mult))) => {
|
||||||
self.next_difficulty =
|
self.next_difficulty =
|
||||||
@@ -84,21 +73,10 @@ impl<'p> Iterator for ControlPointIter<'p> {
|
|||||||
|
|
||||||
Some(ControlPoint::Difficulty { time, speed_mult })
|
Some(ControlPoint::Difficulty { time, speed_mult })
|
||||||
}
|
}
|
||||||
(Some((time, _beat_len)), None) => {
|
(Some((time, beat_len)), None) => {
|
||||||
self.next_timing = next_tuple!(self.timing_points, (time, beat_len));
|
self.next_timing = next_tuple!(self.timing_points, (time, beat_len));
|
||||||
|
|
||||||
#[cfg(not(feature = "no_sliders_no_leniency"))]
|
Some(ControlPoint::Timing { time, beat_len })
|
||||||
{
|
|
||||||
Some(ControlPoint::Timing {
|
|
||||||
time,
|
|
||||||
beat_len: _beat_len,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "no_sliders_no_leniency")]
|
|
||||||
{
|
|
||||||
Some(ControlPoint::Timing { time })
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
(None, None) => None,
|
(None, None) => None,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ impl<'p> SliderState<'p> {
|
|||||||
self.px_per_beat = map.sv * 100.0 * self.prev_sv;
|
self.px_per_beat = map.sv * 100.0 * self.prev_sv;
|
||||||
|
|
||||||
match self.control_points.next() {
|
match self.control_points.next() {
|
||||||
Some(ControlPoint::Timing { time }) => {
|
Some(ControlPoint::Timing { time, .. }) => {
|
||||||
self.next_time = time;
|
self.next_time = time;
|
||||||
self.prev_sv = 1.0;
|
self.prev_sv = 1.0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user