diff --git a/src/js/assignJS.js b/src/js/assignJS.js index af4e705db55b4d878bf93b50689114b12693ee17..03285aff851b1fa43c30e93da9a2afb57152a2b6 100644 --- a/src/js/assignJS.js +++ b/src/js/assignJS.js @@ -319,6 +319,7 @@ window.assignJob = function assignJob(slave, job) { r += `${slave.slaveName} no longer has your personal attention.`; } } + V.JobIDArray = resetJobIDArray(); if (idx >= 0) V.slaves[idx] = slave; @@ -514,8 +515,32 @@ window.removeJob = function removeJob(slave, assignment) { slave.choosesOwnAssignment = 0; slave.sentence = 0; } + V.JobIDArray = resetJobIDArray(); if (idx >= 0) V.slaves[idx] = slave; return r; }; + +window.resetJobIDArray = function resetJobIDArray() { /* todo: expand to all assignments */ + const slaves = State.variables.slaves; + const JobIDArray = { + "rest": [], + "please you": [], + "work a glory hole": [], + "take classes": [], + "be a servant": [], + "whore": [], + "serve the public": [], + "get milked": [], + "stay confined": [], + "be a subordinate slave": [] + }; + + slaves.forEach(function (slave) { + if (JobIDArray.hasOwnProperty(slave.assignment)) + JobIDArray[slave.assignment].push(slave.ID); + }); + + return JobIDArray; +}; diff --git a/src/js/datatypeCleanupJS.js b/src/js/datatypeCleanupJS.js index 2608876e7c936177d7b32f55d7136ea364319833..93b6a172a0a8c75616cec163a012f519cf2394fb 100644 --- a/src/js/datatypeCleanupJS.js +++ b/src/js/datatypeCleanupJS.js @@ -49,9 +49,10 @@ window.SlaveDatatypeCleanup = (function SlaveDatatypeCleanup() { return SlaveDatatypeCleanup; /** @param {App.Entity.SlaveState} slave */ - function SlaveDatatypeCleanup(slave) { + function SlaveDatatypeCleanup(slave, isIncubatorSlave) { V = State.variables; - slaveAgeDatatypeCleanup(slave); + if (isIncubatorSlave !== true) + slaveAgeDatatypeCleanup(slave); slavePhysicalDatatypeCleanup(slave); slaveFaceDatatypeCleanup(slave); slaveHairDatatypeCleanup(slave); diff --git a/src/uncategorized/BackwardsCompatibility.tw b/src/uncategorized/BackwardsCompatibility.tw index b34c01358032e02e662642d2cc733ad2ffba9043..78a049d3f9c79b6334efd87c88425ce80d865289 100644 --- a/src/uncategorized/BackwardsCompatibility.tw +++ b/src/uncategorized/BackwardsCompatibility.tw @@ -3356,6 +3356,7 @@ Done<br> Checking and fixing records for incubator tanks... <<for _Slave range $tanks>> <<run App.Entity.Utils.SlaveDataSchemeCleanup(_Slave)>> + <<run SlaveDatatypeCleanup(_Slave, true)>> /* pass second argument as true so that slaveAgeDatatypeCleanup is not run */ <</for>> Done<br> <</if>> @@ -3611,5 +3612,7 @@ Done! <<set $upgradeMultiplierMedicine = upgradeMultiplierMedicine()>> <<set $upgradeMultiplierTrade = upgradeMultiplierTrade()>> +<<set $JobIDArray = resetJobIDArray()>> + /* reset NaNArray after BC is run */ <<set $NaNArray = findNaN()>>