Skip to content

Commit

Permalink
WIP zone validation
Browse files Browse the repository at this point in the history
  • Loading branch information
PeenScreeker committed Jul 31, 2024
1 parent 2388907 commit 0250820
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions scripts/pages/zoning/zoning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -907,4 +907,22 @@ class ZoneMenu {
!!this.selectedZone.zone
};
}

static validateZones() {
if (!this.mapZoneData) return;
const warningMessage: string[] = [];
const main = this.mapZoneData.tracks.main;
if (main.zones.end === undefined || main.zones.end === null)
warningMessage.push($.Localize('#Zoning_Error_MissingTrackEndZone') as string);
for (const [i, segment] of main.zones.segments.entries()) {
if (!main.stagesEndAtStageStarts) {
if (segment.checkpoints.length < 2) {
warningMessage.push($.Localize('Zoning_Error_SegmentEndZone') as string);
}
if (!segment.checkpointsOrdered) {
warningMessage.push($.Localize('Zoning_Error_SegmentEndZone') as string);
}
}
}
}
}

0 comments on commit 0250820

Please sign in to comment.