Rename pending match to match config and add match state (#51)
CI / build-and-test (push) Successful in 1m17s
CI / production-build (push) Successful in 9m37s

Reviewed-on: #51
Co-authored-by: Álex Román Núñez <eirexe@eirteam.moe>
This commit was merged in pull request #51.
This commit is contained in:
2026-09-20 11:13:15 +00:00
committed by EIREXE
parent 769d82573a
commit 1276562890
7 changed files with 300 additions and 78 deletions
+22 -3
View File
@@ -3,7 +3,7 @@ use thiserror::Error;
use crate::{
fighter::FighterId,
match_loading::{MatchPlayer, PendingMatch},
match_loading::{MatchConfig, MatchPlayer, MatchRules},
stage::manifest::StageId,
};
@@ -60,7 +60,7 @@ impl MenuMatchConfig {
!has_unselected_fighter
}
pub fn to_pending_match(&self) -> Result<PendingMatch, MenuMatchConfigErrors> {
pub fn to_match_config(&self) -> Result<MatchConfig, MenuMatchConfigErrors> {
let mut match_players = vec![];
let stage = self.stage.ok_or(MenuMatchConfigErrors::StageNotSelected)?;
@@ -78,9 +78,28 @@ impl MenuMatchConfig {
});
}
Ok(PendingMatch {
Ok(MatchConfig {
players: match_players,
stage,
rules: MatchRules::default(),
})
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn menu_config_uses_default_match_rules() {
let menu = MenuMatchConfig {
stage: Some(StageId::TestStage),
players: vec![MenuMatchPlayerSlot {
slot: 0,
fighter: Some(FighterId::TestFighter),
}],
};
assert_eq!(menu.to_match_config().unwrap().rules, MatchRules::default());
}
}
+1 -1
View File
@@ -77,7 +77,7 @@ pub fn stage_selected(
initiate_match(
&mut commands,
&mut next_state,
match_config.to_pending_match()?,
match_config.to_match_config()?,
);
}
Ok(())