From b9f28f764f51fc78f4425f586ab850a6ae9c65eb Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Wed, 2 Mar 2022 20:28:11 -0600 Subject: [PATCH] allowSmall -> defaultShowSmall, allow it to be overrided --- src/data/projInfo.json | 2 +- src/features/resources/resource.ts | 4 ++-- src/util/break_eternity.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/data/projInfo.json b/src/data/projInfo.json index 69ff3eb..28be7d1 100644 --- a/src/data/projInfo.json +++ b/src/data/projInfo.json @@ -9,7 +9,7 @@ "versionTitle": "Initial Commit", "allowGoBack": true, - "allowSmall": false, + "defaultShowSmall": false, "defaultDecimalsShown": 2, "useHeader": true, "banner": null, diff --git a/src/features/resources/resource.ts b/src/features/resources/resource.ts index c1f956a..46984e2 100644 --- a/src/features/resources/resource.ts +++ b/src/features/resources/resource.ts @@ -6,14 +6,14 @@ import { State, persistent } from "@/game/persistence"; export interface Resource extends Ref { displayName: string; precision: number; - small: boolean; + small?: boolean; } export function createResource( defaultValue: T | Ref, displayName = "points", precision = 0, - small = false + small = undefined ): Resource { const resource: Partial> = persistent(defaultValue); resource.displayName = displayName; diff --git a/src/util/break_eternity.ts b/src/util/break_eternity.ts index 08500cf..a4c9328 100644 --- a/src/util/break_eternity.ts +++ b/src/util/break_eternity.ts @@ -64,7 +64,7 @@ const thousandth = new Decimal(0.001); const zero = new Decimal(0); export function format(num: DecimalSource, precision?: number, small?: boolean): string { if (precision == null) precision = projInfo.defaultDecimalsShown; - small = small || projInfo.allowSmall; + small = small ?? projInfo.defaultShowSmall; num = new Decimal(num); if (isNaN(num.sign) || isNaN(num.layer) || isNaN(num.mag)) { return "NaN";