Add spawn points (#71)
CI / build-and-test (push) Successful in 2m1s
CI / production-build (push) Successful in 11m33s

Reviewed-on: #71
Co-authored-by: Álex Román Núñez <eirexe@eirteam.moe>
This commit was merged in pull request #71.
This commit is contained in:
2026-09-27 10:06:55 +00:00
committed by EIREXE
parent ce00af0809
commit bb238d2cbc
4 changed files with 148 additions and 22 deletions
+14 -3
View File
@@ -140,7 +140,7 @@ fn validate(replay: &Replay) -> Result<(), String> {
));
}
if replay.players_are_invalid() {
return Err("replay player handles must cover 0..player_count".into());
return Err("replay player handles must be unique".into());
}
if replay.frames.is_empty() {
return Err("replay must contain at least one frame".into());
@@ -169,7 +169,16 @@ fn validate(replay: &Replay) -> Result<(), String> {
if replay
.frames
.iter()
.any(|frame| frame.inputs.len() != replay.match_config.players.len())
.any(|frame| {
frame.inputs.len()
!= replay
.match_config
.players
.iter()
.map(|player| player.handle)
.max()
.map_or(0, |handle| handle + 1)
})
{
return Err("replay frame input count does not match player count".into());
}
@@ -185,7 +194,9 @@ impl Replay {
.map(|player| player.handle)
.collect();
handles.sort_unstable();
handles != (0..handles.len()).collect::<Vec<_>>()
handles.is_empty()
|| handles.windows(2).any(|handles| handles[0] == handles[1])
|| handles.last() == Some(&usize::MAX)
}
fn frame(&self, frame: i32) -> Option<&ReplayFrame> {