From c7dde2eeab5d34d91d2f7e041e4e3c1fb61a396f Mon Sep 17 00:00:00 2001 From: Harry Hopkinson Date: Fri, 30 Aug 2024 12:42:36 +0100 Subject: [PATCH] Add clamp for the soft guest cap --- src/main.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main.ts b/src/main.ts index 3f112ae..463a083 100644 --- a/src/main.ts +++ b/src/main.ts @@ -27,9 +27,15 @@ export const MainWindow = window({ "This is the maximum number of guests that will be allowed in your park", }), textbox({ - text: CurrentGuestMaximum.get().toString(), + text: "0", onChange: (text: string) => { - SuggestedMaxGuests.set(Number(text)); + if (Number(text) < 0 || Number(text) > 65536) { + ui.showError( + "Input not supported", + "Soft Guest Cap must be between 0 and 65,536", + ); + SuggestedMaxGuests.set(CurrentGuestMaximum.get()); + } else SuggestedMaxGuests.set(Number(text)); }, }), checkbox({