validator: comment ModelInfo::check
This commit is contained in:
parent
343a4011dd
commit
c4f910c1f0
@ -309,19 +309,19 @@ pub struct MapCheck<'a>{
|
||||
|
||||
impl<'a> ModelInfo<'a>{
|
||||
fn check(self)->MapCheck<'a>{
|
||||
// check class is exactly "Model"
|
||||
// Check class is exactly "Model"
|
||||
let model_class=StringCheckContext{
|
||||
observed:self.model_class,
|
||||
expected:"Model",
|
||||
}.check(());
|
||||
|
||||
// check model name is snake case
|
||||
// Check model name is snake case
|
||||
let model_name=StringCheckContext{
|
||||
observed:self.model_name,
|
||||
expected:self.model_name.to_snake_case(),
|
||||
}.check(());
|
||||
|
||||
// check display name is not empty and has title case
|
||||
// Check display name is not empty and has title case
|
||||
let display_name=self.map_info.display_name.map(|display_name|{
|
||||
StringEmptyCheck::new(display_name).map(|display_name|StringCheckContext{
|
||||
observed:display_name,
|
||||
@ -329,10 +329,10 @@ impl<'a> ModelInfo<'a>{
|
||||
}.check(display_name))
|
||||
});
|
||||
|
||||
// check Creator is not empty
|
||||
// Check Creator is not empty
|
||||
let creator=self.map_info.creator.map(StringEmptyCheck::new);
|
||||
|
||||
// check GameID (model name was prefixed with bhop_ surf_ etc)
|
||||
// Check GameID (model name was prefixed with bhop_ surf_ etc)
|
||||
let game_id=self.map_info.game_id;
|
||||
|
||||
// MapStart must exist
|
||||
@ -349,22 +349,23 @@ impl<'a> ModelInfo<'a>{
|
||||
Err(())
|
||||
};
|
||||
|
||||
// check that at least one end zone exists for each start zone.
|
||||
// Check that at least one finish zone exists for each start zone.
|
||||
// This also checks that there are no finish zones without a corresponding start zone.
|
||||
let mode_finish_counts=SetDifferenceCheckContextAtLeastOne::new(self.counts.mode_finish_counts)
|
||||
.check(&self.counts.mode_start_counts);
|
||||
|
||||
// check that there are no anticheat zones that have no corresponding start zone.
|
||||
// modes are allowed to have 0 anticheat zones.
|
||||
// Check that there are no anticheat zones without a corresponding start zone.
|
||||
// Modes are allowed to have 0 anticheat zones.
|
||||
let mode_anticheat_counts=SetDifferenceCheckContextAllowNone::new(self.counts.mode_anticheat_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();
|
||||
|
||||
// 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();
|
||||
|
||||
// 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();
|
||||
|
||||
MapCheck{
|
||||
|
Loading…
x
Reference in New Issue
Block a user