adjusted IGameMode trait

This commit is contained in:
MaxOhn
2024-02-29 22:50:24 +01:00
parent 2c44ef3a35
commit 4731da64dc
9 changed files with 69 additions and 38 deletions
+11 -5
View File
@@ -1,5 +1,3 @@
use std::borrow::Cow;
use rosu_map::section::{general::GameMode, hit_objects::CurveBuffers};
use crate::{
@@ -28,12 +26,20 @@ const RNG_SEED: i32 = 1337;
/// A [`Beatmap`] for [`Catch`] calculations.
pub type CatchBeatmap<'a> = Converted<'a, Catch>;
pub fn try_convert(map: &mut Cow<'_, Beatmap>) -> ConvertStatus {
pub fn check_convert(map: &Beatmap) -> ConvertStatus {
match map.mode {
GameMode::Osu => ConvertStatus::Conversion,
GameMode::Catch => ConvertStatus::Noop,
GameMode::Taiko | GameMode::Mania => ConvertStatus::Incompatible,
}
}
pub fn try_convert(map: &mut Beatmap) -> ConvertStatus {
match map.mode {
GameMode::Osu => {
map.to_mut().mode = GameMode::Catch;
map.mode = GameMode::Catch;
ConvertStatus::Done
ConvertStatus::Conversion
}
GameMode::Catch => ConvertStatus::Noop,
GameMode::Taiko | GameMode::Mania => ConvertStatus::Incompatible,
+5 -3
View File
@@ -1,5 +1,3 @@
use std::borrow::Cow;
use crate::{
any::ModeDifficulty,
model::{
@@ -40,7 +38,11 @@ impl IGameMode for Catch {
type GradualDifficulty = CatchGradualDifficulty;
type GradualPerformance = CatchGradualPerformance;
fn try_convert(map: &mut Cow<'_, Beatmap>) -> ConvertStatus {
fn check_convert(map: &Beatmap) -> ConvertStatus {
convert::check_convert(map)
}
fn try_convert(map: &mut Beatmap) -> ConvertStatus {
convert::try_convert(map)
}