Fix Validator Logic Errors #132

Merged
Quaternions merged 2 commits from val into staging 2025-04-12 19:31:47 +00:00

@ -220,7 +220,7 @@ impl std::fmt::Display for StringEmpty{
} }
} }
fn check_empty(value:&str)->Result<&str,StringEmpty>{ fn check_empty(value:&str)->Result<&str,StringEmpty>{
value.is_empty().then_some(value).ok_or(StringEmpty) (!value.is_empty()).then_some(value).ok_or(StringEmpty)
} }
// check for duplicate objects // check for duplicate objects
@ -394,7 +394,7 @@ impl<'a> ModelInfo<'a>{
.check(&self.counts.mode_start_counts); .check(&self.counts.mode_start_counts);
// There must be exactly one start zone for every mode in the map. // There must be exactly one start zone for every mode in the map.
let mode_start_counts=DuplicateCheckContext(self.counts.mode_start_counts).check(|c|c.len()<=1); let mode_start_counts=DuplicateCheckContext(self.counts.mode_start_counts).check(|c|1<c.len());
// Check that there are no Teleports without a corresponding Spawn. // Check that there are no Teleports without a corresponding Spawn.
// Spawns are allowed to have 0 Teleports. // Spawns are allowed to have 0 Teleports.
@ -402,7 +402,7 @@ impl<'a> ModelInfo<'a>{
.check(&self.counts.spawn_counts); .check(&self.counts.spawn_counts);
// There must be exactly one of any perticular spawn id in the map. // There must be exactly one of any perticular spawn id in the map.
let spawn_counts=DuplicateCheckContext(self.counts.spawn_counts).check(|&c|c<=1); let spawn_counts=DuplicateCheckContext(self.counts.spawn_counts).check(|&c|1<c);
// Check that at least one WormholeIn exists for each WormholeOut. // Check that at least one WormholeIn exists for each WormholeOut.
// This also checks that there are no WormholeIn without a corresponding WormholeOut. // This also checks that there are no WormholeIn without a corresponding WormholeOut.
@ -410,7 +410,7 @@ impl<'a> ModelInfo<'a>{
.check(&self.counts.wormhole_out_counts); .check(&self.counts.wormhole_out_counts);
// There must be exactly one of any perticular wormhole out id in the map. // There must be exactly one of any perticular wormhole out id in the map.
let wormhole_out_counts=DuplicateCheckContext(self.counts.wormhole_out_counts).check(|&c|c<=1); let wormhole_out_counts=DuplicateCheckContext(self.counts.wormhole_out_counts).check(|&c|1<c);
MapCheck{ MapCheck{
model_class, model_class,