From 0250820bc25f1e5f500f852f843fe59d48d330f5 Mon Sep 17 00:00:00 2001 From: PeenScreeker Date: Wed, 31 Jul 2024 12:54:20 -0400 Subject: [PATCH] WIP zone validation --- scripts/pages/zoning/zoning.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scripts/pages/zoning/zoning.ts b/scripts/pages/zoning/zoning.ts index 0fc6a637..0f44d798 100644 --- a/scripts/pages/zoning/zoning.ts +++ b/scripts/pages/zoning/zoning.ts @@ -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); + } + } + } + } }