From 608cc089b26d6f9c51759b3e803d6016e61ca911 Mon Sep 17 00:00:00 2001 From: phyzical Date: Fri, 4 Feb 2022 17:34:16 +0800 Subject: [PATCH] Added a check for exisiting industry type before expanding --- src/Corporation/Actions.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Corporation/Actions.ts b/src/Corporation/Actions.ts index e69d5bd72..9a510e67d 100644 --- a/src/Corporation/Actions.ts +++ b/src/Corporation/Actions.ts @@ -16,6 +16,9 @@ import { IndustryUpgrades } from "./IndustryUpgrades"; import { ResearchMap } from "./ResearchMap"; export function NewIndustry(corporation: ICorporation, industry: string, name: string): void { + if (corporation.divisions.find(({ type }) => industry == type)) + throw new Error("You have already expanded into this industry!"); + for (let i = 0; i < corporation.divisions.length; ++i) { if (corporation.divisions[i].name === name) { throw new Error("This division name is already in use!");