diff --git a/src/data/backwardsCompatibility/backwardsCompatibility.js b/src/data/backwardsCompatibility/backwardsCompatibility.js index 61efa463e4b983af125c56f57a113ffdc75fde0c..7889818b32d2be19fd5ce391403829b43b3b5b90 100644 --- a/src/data/backwardsCompatibility/backwardsCompatibility.js +++ b/src/data/backwardsCompatibility/backwardsCompatibility.js @@ -164,10 +164,6 @@ App.Update.globalVariables = function(node) { } } - // Jobs - { - V.JobIDMap = makeJobIdMap(); - } // Reminders { if (!Array.isArray(V.reminders)) { @@ -198,9 +194,10 @@ App.Update.globalVariables = function(node) { } if (typeof V.abbreviateClothes === "number") { + V.UI.slaveSummary = App.UI.SlaveSummary.makeNewState(); for (const key of ["clothes", "devotion", "diet", "drugs", "genitalia", "health", "hormoneBalance", "mental", "nationality", "origins", "physicals", "race", "rules", "rulesets", "skills"]) { - V.UI.slaveSummary.abbreviation[key] = V["abbreviate" + capFirstChar(key)]; + V.UI.slaveSummary.abbreviation[key] = V["abbreviate" + capFirstChar(key)] || V.UI.slaveSummary.abbreviation[key]; } } } @@ -1234,6 +1231,11 @@ App.Update.slaveRecords = function(node) { if (V.relationLinks) { resetFamilyCounters(); } + + // Jobs + { + V.JobIDMap = makeJobIdMap(); + } }; App.Update.genePoolRecords = function(node) { diff --git a/src/data/backwardsCompatibility/datatypeCleanup.js b/src/data/backwardsCompatibility/datatypeCleanup.js index c08fd9325c4e8f783d7e131888154c81c562239a..3ce6a3b7a02f1d9526fbceebd16bd4b27046b1f8 100644 --- a/src/data/backwardsCompatibility/datatypeCleanup.js +++ b/src/data/backwardsCompatibility/datatypeCleanup.js @@ -38,13 +38,14 @@ App.Entity.Utils.SlaveDataSchemeCleanup = (function() { function migrateHealth(slave) { if (typeof slave.health === "number") { const condition = slave.health; - slave.health = {}; - slave.health.condition = condition; - slave.health.shortDamage = 0; - slave.health.longDamage = 0; - slave.health.illness = 0; - slave.health.tired = 0; - slave.health.health = condition; + slave.health = { + condition: condition, + shortDamage: 0, + longDamage: 0, + illness: 0, + tired: 0, + health: condition + }; } } @@ -524,11 +525,7 @@ globalThis.SlaveDatatypeCleanup = (function SlaveDatatypeCleanup() { if (typeof slave.minorInjury !== "string") { slave.minorInjury = 0; } - if (typeof slave.health === "number") { - const condition = slave.health; - slave.health = {}; - slave.health.condition = condition; - } + slave.health.condition = Math.clamp(slave.health.condition, -100, 100) || 0; slave.health.shortDamage = Math.max(+slave.health.shortDamage, 0) || 0; slave.health.longDamage = Math.max(+slave.health.longDamage, 0) || 0; @@ -1142,6 +1139,9 @@ globalThis.SlaveDatatypeCleanup = (function SlaveDatatypeCleanup() { slave.sexQuality = Math.max(+slave.sexQuality, 0) || 0; slave.whoreClass = Math.max(+slave.whoreClass, 0) || 0; slave.effectiveWhoreClass = Math.max(+slave.effectiveWhoreClass, effectiveWhoreClass(slave)) || 0; + if (!Object.values(Job).includes(slave.assignment)) { + slave.assignment = Job.REST; + } } })();