BUGFIX: Duplicated program in edge case (#1549)

This commit is contained in:
catloversg
2024-08-06 03:43:56 +07:00
committed by GitHub
parent 180dae1d2c
commit 1a8dcad02b
6 changed files with 12 additions and 16 deletions
+3 -2
View File
@@ -18,12 +18,13 @@ export function ProgramsDev(): React.ReactElement {
setProgram(event.target.value as CompletedProgramName);
}
function addProgram(): void {
if (!Player.hasProgram(program)) Player.getHomeComputer().programs.push(program);
Player.getHomeComputer().pushProgram(program);
}
function addAllPrograms(): void {
const home = Player.getHomeComputer();
for (const name of Object.values(CompletedProgramName)) {
if (!Player.hasProgram(name)) Player.getHomeComputer().programs.push(name);
home.pushProgram(name);
}
}