mirror of
https://github.com/adamaq01/mikado.git
synced 2024-11-27 23:50:48 +01:00
fix: cloudlink score creation wasn't working
This commit is contained in:
parent
832fc3e344
commit
b06551e338
@ -76,7 +76,7 @@ pub fn process_pbs(user: &str, music: &Node, encoding: EncodingType) -> Result<V
|
||||
song_id,
|
||||
difficulty,
|
||||
};
|
||||
let score = Score::from_property(value.as_slice().try_into()?);
|
||||
let score = Score::from_slice(value)?;
|
||||
scores.insert(chart, score);
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
use anyhow::Result;
|
||||
|
||||
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
|
||||
pub struct Chart {
|
||||
pub song_id: u32,
|
||||
@ -19,10 +21,14 @@ impl Score {
|
||||
ret
|
||||
}
|
||||
|
||||
pub fn from_property(property: &[u32; 21]) -> Self {
|
||||
Self {
|
||||
property: *property,
|
||||
pub fn from_slice(vec: &[u32]) -> Result<Self> {
|
||||
if vec.len() < 21 {
|
||||
return Err(anyhow::anyhow!("Could not parse score"));
|
||||
}
|
||||
let mut ret = Self::default();
|
||||
ret.property.copy_from_slice(&vec[..21]);
|
||||
|
||||
Ok(ret)
|
||||
}
|
||||
|
||||
pub fn cloud_score_mut(&mut self) -> &mut u32 {
|
||||
|
Loading…
Reference in New Issue
Block a user