UI: Fixes #3132 several Sleeve can no longer works concurrently in the same company

fixes #3132
fixes #3394

Fixed the faulty possibleJob() logic in Sleeve/UI/TaskSelector
This commit is contained in:
borisflagell 2022-05-23 19:31:46 +02:00
parent 27bf6cba39
commit 08d8f405c0

@ -44,7 +44,7 @@ interface ITaskDetails {
function possibleJobs(player: IPlayer, sleeve: Sleeve): string[] {
// Array of all companies that other sleeves are working at
const forbiddenCompanies = [];
const forbiddenCompanies: string[] = [];
for (const otherSleeve of player.sleeves) {
if (sleeve === otherSleeve) {
continue;
@ -54,13 +54,8 @@ function possibleJobs(player: IPlayer, sleeve: Sleeve): string[] {
}
}
const allJobs: string[] = Object.keys(player.jobs);
for (let i = 0; i < allJobs.length; ++i) {
if (!forbiddenCompanies.includes(allJobs[i])) {
allJobs[i];
}
}
return allJobs;
return allJobs.filter((company) => !forbiddenCompanies.includes(company));
}
function possibleFactions(player: IPlayer, sleeve: Sleeve): string[] {