From 30ebb4751e49588b55c52f80da153350a6e1573e Mon Sep 17 00:00:00 2001 From: lowercasedonkey <lowercasedonkey@gmail.com> Date: Sun, 1 Mar 2020 14:26:51 -0500 Subject: [PATCH] fixes --- src/js/backwardsCompatibility.js | 58 ++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/src/js/backwardsCompatibility.js b/src/js/backwardsCompatibility.js index 7b5a37ebcf5..f9f67a0394e 100644 --- a/src/js/backwardsCompatibility.js +++ b/src/js/backwardsCompatibility.js @@ -1,33 +1,28 @@ window.backwardsCompatibility = (function() { /* no-usedOnce disabling checking for only used once instances in this file */ - let t = ""; let r; - t += general(); - t += globalVariables(); - t += specialSlaveRecords(); - t += genePoolRecords(); - t += RAassistantData(); - t += secExp(); - t += oldVersions(); - t += cleanUp(); - - - return t; + return backwardsCompatibility; + + function backwardsCompatibility() { + let t = ""; + t += generalBC(); + t += globalVariables(); + t += slaveRecords(); + t += specialSlaveRecords(); + t += genePoolRecords(); + t += RAassistantData(); + t += secExp(); + t += oldVersions(); + cleanUp(); + return t; + } - function general() { + function generalBC() { r = ""; if (V.releaseID === 1021 || V.releaseID === 1020 || V.releaseID === 1019 || V.releaseID === 2022) { V.releaseID = 1022; } - if (V.releaseID < 1055) { - if (V.disableLisping === 0) { - V.disableLisping = 1; - } else { - V.disableLisping = 0; - } - } - if (Array.isArray(V.nationalities)) { V.nationalities = weightedArray2HashMap(V.nationalities); } @@ -154,10 +149,10 @@ window.backwardsCompatibility = (function() { delete V.basenationalities; } - if ((typeof V.marrying.length === "undefined") || (typeof V.marrying === "undefined")) { + if (typeof V.marrying !== "object") { V.marrying = []; } - if ((typeof V.weddingPlanned === "undefined") || (typeof V.marrying === "undefined") || (typeof V.marrying.length === "undefined") || (V.marrying.length < 1)) { + if ((typeof V.weddingPlanned === "undefined") || (V.marrying.length < 1)) { V.weddingPlanned = 0; } @@ -3567,7 +3562,7 @@ window.backwardsCompatibility = (function() { } function slaveRecords() { - r += `Checking and fixing slave records...`; + r = `Checking and fixing slave records...`; V.slaves.forEach((_Slave) => { App.Entity.Utils.SlaveDataSchemeCleanup(_Slave); SlaveDatatypeCleanup(_Slave); @@ -3767,14 +3762,24 @@ window.backwardsCompatibility = (function() { function secExp() { /* Sec Exp */ + r = ""; App.SecExp.Check.general(); if (V.secExpEnabled === 1) { - return `<br><<include "SecExpBackwardCompatibility">></br>`; + r = `<br><<include "SecExpBackwardCompatibility">></br>`; } - return; + return r; } function oldVersions() { + r = ""; + if (V.releaseID < 1055) { + if (V.disableLisping === 0) { + V.disableLisping = 1; + } else { + V.disableLisping = 0; + } + } + if (V.releaseID === 1043) { V.slaves.forEach(s => { s.skill.whoring = s.skill.whore / 2; }); V.tanks.forEach(s => { s.skill.whoring = s.skill.whore / 2; }); @@ -4020,6 +4025,7 @@ window.backwardsCompatibility = (function() { delete V.SlaveSummaryFiler; } + return r; } function cleanUp() { -- GitLab