mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-27 10:03:48 +01:00
Added a check for exisiting industry type before expanding
This commit is contained in:
parent
9ddb1c4379
commit
608cc089b2
@ -16,6 +16,9 @@ import { IndustryUpgrades } from "./IndustryUpgrades";
|
|||||||
import { ResearchMap } from "./ResearchMap";
|
import { ResearchMap } from "./ResearchMap";
|
||||||
|
|
||||||
export function NewIndustry(corporation: ICorporation, industry: string, name: string): void {
|
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) {
|
for (let i = 0; i < corporation.divisions.length; ++i) {
|
||||||
if (corporation.divisions[i].name === name) {
|
if (corporation.divisions[i].name === name) {
|
||||||
throw new Error("This division name is already in use!");
|
throw new Error("This division name is already in use!");
|
||||||
|
Loading…
Reference in New Issue
Block a user