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
+2 -4
View File
@@ -87,14 +87,12 @@ export class CreateProgramWork extends Work {
dialogBoxCreate(lines.join("\n"));
}
if (!Player.getHomeComputer().programs.includes(programName)) {
Player.getHomeComputer().programs.push(programName);
}
Player.getHomeComputer().pushProgram(programName);
} else if (!Player.getHomeComputer().programs.includes(programName)) {
//Incomplete case
const perc = ((100 * this.unitCompleted) / this.unitNeeded()).toFixed(2);
const incompleteName = asProgramFilePath(programName + "-" + perc + "%-INC");
Player.getHomeComputer().programs.push(incompleteName);
Player.getHomeComputer().pushProgram(incompleteName);
}
}