diff --git a/src/js/assignJS.js b/src/js/assignJS.js index 46c52ca7b2eb8c7f33dec0d49b47f7f5c03d2079..3e300d1f626632daf75b7daf9003f0601a92f301 100644 --- a/src/js/assignJS.js +++ b/src/js/assignJS.js @@ -18,19 +18,23 @@ window.assignJob = function assignJob(slave, job) { }; /* Tracking for the following cases: */ - switch (job.toLowerCase()) { - case "be confined in the cellblock": - case "cellblock": - case "get treatment in the clinic": - case "clinic": - case "learn in the schoolroom": - case "schoolroom": - case "rest in the spa": - case "spa": - if (oldJob !== "rest") { - V.assignmentRecords[slave.ID] = oldJob; // these jobs are temporary, so we save what the slave will return to if it is meaningful. - } - break; + if (V.assignmentRecords[slave.ID] === "choose her own job") { // if choosesOwnAssignment was set before removeJob (and wipes it out), it's saved in assignmentRecords. We don't want to overwrite that here, as we want to be able to get it back. + slave.choosesOwnAssignment = 1; + } else { + switch (job.toLowerCase()) { + case "be confined in the cellblock": + case "cellblock": + case "get treatment in the clinic": + case "clinic": + case "learn in the schoolroom": + case "schoolroom": + case "rest in the spa": + case "spa": + if (oldJob !== "rest") { + V.assignmentRecords[slave.ID] = oldJob; // these jobs are temporary, so we save what the slave will return to if it is meaningful. + } + break; + } } /* use .toLowerCase() to get rid of a few dupe conditions. */ @@ -403,7 +407,8 @@ window.assignJob = function assignJob(slave, job) { }; window.assignJobSafely = function assignJobSafely(slave, assignmentStr){ - if (slave.choosesOwnAssignment === 1) { + if (V.assignmentRecords[slave.ID] === "choose her own job") { + slave.choosesOwnAssignment = 1; assignJob(slave, "rest"); } else if (!App.Utils.jobForAssignment(assignmentStr).canEmploy(slave).length) { // If nothing complains about job requirements not being met assignJob(slave, assignmentStr); @@ -614,6 +619,10 @@ window.removeJob = function removeJob(slave, assignment) { slave.rules.living = "normal"; } + if (slave.choosesOwnAssignment > 0) { + V.assignmentRecords[slave.ID] = "choose her own job"; + } + slave.choosesOwnAssignment = 0; slave.sentence = 0; }