mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-29 19:13:49 +01:00
Merge pull request #2912 from phyzical/bugfix/2899
Added a check for exisiting industry type before expanding
This commit is contained in:
commit
f117cc8a74
@ -19,6 +19,9 @@ import { ResearchMap } from "./ResearchMap";
|
|||||||
import { isRelevantMaterial } from "./ui/Helpers";
|
import { isRelevantMaterial } from "./ui/Helpers";
|
||||||
|
|
||||||
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 the ${industry} 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