add an early out if already researched

hotfix/3977

File List:
src/Corporation/Actions.ts
This commit is contained in:
phyzical 2022-08-17 17:46:18 +08:00
parent ba5b0be7f4
commit 016dbe67d9
No known key found for this signature in database
GPG Key ID: 91E97494BCA22BCF

@ -455,6 +455,7 @@ export function Research(division: IIndustry, researchName: string): void {
if (!allResearch.includes(researchName)) throw new Error(`No research named '${researchName}'`); if (!allResearch.includes(researchName)) throw new Error(`No research named '${researchName}'`);
const research = ResearchMap[researchName]; const research = ResearchMap[researchName];
if (division.researched[researchName]) return;
if (division.sciResearch.qty < research.cost) if (division.sciResearch.qty < research.cost)
throw new Error(`You do not have enough Scientific Research for ${research.name}`); throw new Error(`You do not have enough Scientific Research for ${research.name}`);
division.sciResearch.qty -= research.cost; division.sciResearch.qty -= research.cost;